Ejemplo n.º 1
0
 def do_expose_event(self, event):
     ClientWindow.do_expose_event(self, event)
     if not self.border_shown:
         return
     #now paint our border import gtk.gdk
     s = 5
     ww, wh = self.window.get_size()
     borders = []
     if ww>s*2:
         #window is wide enough, add borders on the side:
         borders.append((0, 0, s, wh))           #left
         borders.append((ww-s, 0, s, wh))        #right
     if wh>s*2:
         #window is tall enough, add borders on top and bottom:
         borders.append((0, 0, ww, s))           #top
         borders.append((0, wh-s, ww, s))        #bottom
     for x, y, w, h in borders:
         if w<=0 or h<=0:
             continue
         r = gtk.gdk.Rectangle(x, y, w, h)
         rect = event.area.intersect(r)
         if rect.width==0 or rect.height==0:
             continue
         context = self.window.cairo_create()
         context.rectangle(rect)
         context.clip()
         context.set_source_rgba(1.0, 0.0, 0.0, 0.5)
         context.fill()
         context.paint()
Ejemplo n.º 2
0
 def do_expose_event(self, event):
     ClientWindow.do_expose_event(self, event)
     b = self.border
     if b is None or not b.shown:
         return
     #now paint our border import gtk.gdk
     s = b.size
     ww, wh = self.window.get_size()
     borders = []
     #window is wide enough, add borders on the side:
     borders.append((0, 0, s, wh))           #left
     borders.append((ww-s, 0, s, wh))        #right
     #window is tall enough, add borders on top and bottom:
     borders.append((0, 0, ww, s))           #top
     borders.append((0, wh-s, ww, s))        #bottom
     for x, y, w, h in borders:
         if w<=0 or h<=0:
             continue
         r = gtk.gdk.Rectangle(x, y, w, h)
         rect = event.area.intersect(r)
         if rect.width==0 or rect.height==0:
             continue
         context = self.window.cairo_create()
         context.rectangle(rect)
         context.clip()
         context.set_source_rgba(self.border.red, self.border.green, self.border.blue, self.border.alpha)
         context.fill()
         context.paint()
Ejemplo n.º 3
0
 def do_expose_event(self, event):
     ClientWindow.do_expose_event(self, event)
     if self.border is None or not self.border.shown:
         return
     #now paint our border import gtk.gdk
     s = self.border.size
     ww, wh = self.window.get_size()
     borders = []
     #window is wide enough, add borders on the side:
     borders.append((0, 0, s, wh))  #left
     borders.append((ww - s, 0, s, wh))  #right
     #window is tall enough, add borders on top and bottom:
     borders.append((0, 0, ww, s))  #top
     borders.append((0, wh - s, ww, s))  #bottom
     for x, y, w, h in borders:
         if w <= 0 or h <= 0:
             continue
         r = gtk.gdk.Rectangle(x, y, w, h)
         rect = event.area.intersect(r)
         if rect.width == 0 or rect.height == 0:
             continue
         context = self.window.cairo_create()
         context.rectangle(rect)
         context.clip()
         context.set_source_rgba(self.border.red, self.border.green,
                                 self.border.blue, self.border.alpha)
         context.fill()
         context.paint()
Ejemplo n.º 4
0
 def set_alpha(self):
     ClientWindow.set_alpha(self)
     rgb_formats = self._client_properties.get("encodings.rgb_formats", [])
     #gl_window_backing supports BGR(A) too:
     if "RGBA" in rgb_formats:
         rgb_formats.append("BGRA")
     if "RGB" in rgb_formats:
         rgb_formats.append("BGR")
Ejemplo n.º 5
0
 def set_alpha(self):
     ClientWindow.set_alpha(self)
     rgb_formats = self._client_properties.get("encodings.rgb_formats", [])
     #gl_window_backing supports BGR(A) too:
     if "RGBA" in rgb_formats:
         rgb_formats.append("BGRA")
     if "RGB" in rgb_formats:
         rgb_formats.append("BGR")
Ejemplo n.º 6
0
 def __init__(self, client, group_leader, wid, x, y, w, h, metadata,
              override_redirect, client_properties, auto_refresh_delay):
     debug("GLClientWindow(..)")
     ClientWindow.__init__(self, client, group_leader, wid, x, y, w, h,
                           metadata, override_redirect, client_properties,
                           auto_refresh_delay)
     self._client_properties["encoding.uses_swscale"] = False
     self.set_reallocate_redraws(True)
     self.add(self._backing._backing)
Ejemplo n.º 7
0
 def setup_window(self):
     self.debug("setup_window()")
     self._has_custom_decorations = False
     self._top_bar_box = None
     if not self._override_redirect:
         self._has_custom_decorations = True
         vbox = gtk.VBox()
         hbox = gtk.HBox()
         self.add_top_bar_widgets(hbox)
         vbox.pack_start(hbox, False, False, 0)
         self.add(vbox)
         vbox.show_all()
         w, h = vbox.size_request()
         self.debug("vbox size: %sx%s", w, h)
         self._top_bar_box = vbox
         self._top_bar_box.hide()
     ClientWindow.setup_window(self)
Ejemplo n.º 8
0
 def setup_window(self):
     self.border_shown = not self._override_redirect
     ClientWindow.setup_window(self)
Ejemplo n.º 9
0
 def setup_window(self, *args):
     self.border = None
     ClientWindow.setup_window(self, *args)
Ejemplo n.º 10
0
 def setup_window(self):
     self.border = None
     ClientWindow.setup_window(self)
Ejemplo n.º 11
0
 def destroy(self):
     self._backing.paint_screen = False
     ClientWindow.destroy(self)
Ejemplo n.º 12
0
 def do_configure_event(self, event):
     debug("GL do_configure_event(%s)", event)
     ClientWindow.do_configure_event(self, event)
     self._backing.paint_screen = True
Ejemplo n.º 13
0
 def setup_window(self):
     self.border_shown = not self._override_redirect
     ClientWindow.setup_window(self)
Ejemplo n.º 14
0
 def setup_window(self, *args):
     ClientWindow.setup_window(self, *args)
Ejemplo n.º 15
0
 def destroy(self):
     self._backing.paint_screen = False
     ClientWindow.destroy(self)
Ejemplo n.º 16
0
 def do_configure_event(self, event):
     debug("GL do_configure_event(%s)", event)
     ClientWindow.do_configure_event(self, event)
     self._backing.paint_screen = True
Ejemplo n.º 17
0
 def __init__(self, client, group_leader, wid, x, y, w, h, metadata, override_redirect, client_properties, auto_refresh_delay):
     debug("GLClientWindow(..)")
     ClientWindow.__init__(self, client, group_leader, wid, x, y, w, h, metadata, override_redirect, client_properties, auto_refresh_delay)
     self._client_properties["encoding.uses_swscale"] = False
     self.set_reallocate_redraws(True)
     self.add(self._backing._backing)
Ejemplo n.º 18
0
 def do_expose_event(self, event):
     if self._has_custom_decorations and self._top_bar_box.get_visible():
         gtk.Window.do_expose_event(self, event)
     ClientWindow.do_expose_event(self, event)