[Pkg-mozext-commits] [firetray] 227/399: make sure window is subscribed to mandatory event-masks

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:48 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit 31881fa3f54621e0a1ee169ac30d5128935a7412
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Wed Apr 18 00:51:50 2012 +0200

    make sure window is subscribed to mandatory event-masks
    
    TODO: we should do this with xlib.
---
 src/modules/ctypes/linux/gdk.jsm     |   26 +++++++++++++++++++++++++-
 src/modules/ctypes/linux/x11.jsm     |   29 +++--------------------------
 src/modules/linux/FiretrayWindow.jsm |   12 ++++++++++--
 3 files changed, 38 insertions(+), 29 deletions(-)

diff --git a/src/modules/ctypes/linux/gdk.jsm b/src/modules/ctypes/linux/gdk.jsm
index 855c643..19535f0 100644
--- a/src/modules/ctypes/linux/gdk.jsm
+++ b/src/modules/ctypes/linux/gdk.jsm
@@ -117,6 +117,29 @@ function gdk_defines(lib) {
   this.GDK_SCROLL_DOWN  = 1;
   this.GDK_SCROLL_LEFT  = 2;
   this.GDK_SCROLL_RIGHT = 3;
+  this.GdkEventMask = ctypes.int; // enum
+  this.GDK_EXPOSURE_MASK            = 1 << 1,
+  this.GDK_POINTER_MOTION_MASK      = 1 << 2,
+  this.GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
+  this.GDK_BUTTON_MOTION_MASK       = 1 << 4,
+  this.GDK_BUTTON1_MOTION_MASK      = 1 << 5,
+  this.GDK_BUTTON2_MOTION_MASK      = 1 << 6,
+  this.GDK_BUTTON3_MOTION_MASK      = 1 << 7,
+  this.GDK_BUTTON_PRESS_MASK        = 1 << 8,
+  this.GDK_BUTTON_RELEASE_MASK      = 1 << 9,
+  this.GDK_KEY_PRESS_MASK           = 1 << 10,
+  this.GDK_KEY_RELEASE_MASK         = 1 << 11,
+  this.GDK_ENTER_NOTIFY_MASK        = 1 << 12,
+  this.GDK_LEAVE_NOTIFY_MASK        = 1 << 13,
+  this.GDK_FOCUS_CHANGE_MASK        = 1 << 14,
+  this.GDK_STRUCTURE_MASK           = 1 << 15,
+  this.GDK_PROPERTY_CHANGE_MASK     = 1 << 16,
+  this.GDK_VISIBILITY_NOTIFY_MASK   = 1 << 17,
+  this.GDK_PROXIMITY_IN_MASK        = 1 << 18,
+  this.GDK_PROXIMITY_OUT_MASK       = 1 << 19,
+  this.GDK_SUBSTRUCTURE_MASK        = 1 << 20,
+  this.GDK_SCROLL_MASK              = 1 << 21,
+  this.GDK_ALL_EVENTS_MASK          = 0x3FFFFE
 
   this.GdkWindow = ctypes.StructType("GdkWindow");
   this.GdkByteOrder = ctypes.int; // enum
@@ -240,6 +263,8 @@ function gdk_defines(lib) {
   lib.lazy_bind("gdk_window_beep", ctypes.void_t, this.GdkWindow.ptr);
   lib.lazy_bind("gdk_window_get_width", ctypes.int, this.GdkWindow.ptr);
 
+  lib.lazy_bind("gdk_window_get_events", this.GdkEventMask, this.GdkWindow.ptr);
+  lib.lazy_bind("gdk_window_set_events", ctypes.void_t, this.GdkWindow.ptr, this.GdkEventMask);
   lib.lazy_bind("gdk_window_add_filter", ctypes.void_t, this.GdkWindow.ptr, this.GdkFilterFunc, gobject.gpointer);
   lib.lazy_bind("gdk_display_get_default", this.GdkDisplay.ptr);
   lib.lazy_bind("gdk_x11_display_get_xdisplay", x11.Display.ptr, this.GdkDisplay.ptr);
@@ -253,7 +278,6 @@ function gdk_defines(lib) {
 
   lib.lazy_bind("gdk_display_get_n_screens", gobject.gint, this.GdkDisplay.ptr);
   lib.lazy_bind("gdk_display_get_screen", this.GdkScreen.ptr, this.GdkDisplay.ptr, gobject.gint);
-
 }
 
 new ctypes_library(GDK_LIBNAME, GDK_ABIS, gdk_defines, this);
diff --git a/src/modules/ctypes/linux/x11.jsm b/src/modules/ctypes/linux/x11.jsm
index 449f8e1..c706151 100644
--- a/src/modules/ctypes/linux/x11.jsm
+++ b/src/modules/ctypes/linux/x11.jsm
@@ -117,8 +117,11 @@ function x11_defines(lib) {
   this.XA_ATOM     = 4;
   this.XA_CARDINAL = 6;
   // Input Event Masks
+  this.VisibilityChangeMask     = 1<<16
+  this.StructureNotifyMask      = 1<<17
   this.SubstructureNotifyMask   = 1<<19;
   this.SubstructureRedirectMask = 1<<20;
+  this.PropertyChangeMask       = 1<<22
 
   this.Bool = ctypes.int;
   this.Status = ctypes.int;
@@ -154,29 +157,6 @@ function x11_defines(lib) {
     { "time": this.Time },
     { "state": ctypes.int }     /* NewValue or Deleted */
   ]);
-  // typedef struct {
-  //      int x, y;                /* location of window */
-  //      int width, height;       /* width and height of window */
-  //      int border_width;        /* border width of window */
-  //      int depth;               /* depth of window */
-  //      Visual *visual;          /* the associated visual structure */
-  //      Window root;             /* root of screen containing window */
-  //      int class;               /* InputOutput, InputOnly*/
-  //      int bit_gravity;         /* one of the bit gravity values */
-  //      int win_gravity;         /* one of the window gravity values */
-  //      int backing_store;       /* NotUseful, WhenMapped, Always */
-  //      unsigned long backing_planes;/* planes to be preserved if possible */
-  //      unsigned long backing_pixel;/* value to be used when restoring planes */
-  //      Bool save_under;         /* boolean, should bits under be saved? */
-  //      Colormap colormap;       /* color map to be associated with window */
-  //      Bool map_installed;      /* boolean, is color map currently installed*/
-  //      int map_state;           /* IsUnmapped, IsUnviewable, IsViewable */
-  //      long all_event_masks;    /* set of events all people have interest in*/
-  //      long your_event_mask;    /* my event mask */
-  //      long do_not_propagate_mask;/* set of events that should not propagate */
-  //      Bool override_redirect;  /* boolean value for override-redirect */
-  //      Screen *screen;          /* back pointer to correct screen */
-  // } XWindowAttributes;
 
   lib.lazy_bind("XFree", ctypes.int, ctypes.void_t.ptr);
   lib.lazy_bind("XInternAtom", this.Atom, this.Display.ptr, ctypes.char.ptr, this.Bool); // only_if_exsits
@@ -185,9 +165,6 @@ function x11_defines(lib) {
   lib.lazy_bind("XDefaultRootWindow", this.Window, this.Display.ptr);
   lib.lazy_bind("XSendEvent", this.Status, this.Display.ptr, this.Window, this.Bool, ctypes.long, this.XEvent.ptr);
   lib.lazy_bind("XRaiseWindow", ctypes.int, this.Display.ptr, this.Window);
-  // Status XGetWindowAttributes(Display *display, Window w, XWindowAttributes *window_attributes_return);
-  // int XChangeWindowAttributes(Display *display, Window w, unsigned long valuemask, XSetWindowAttributes *attributes);
-
 }
 
 new ctypes_library(X11_LIBNAME, X11_ABIS, x11_defines, this);
diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm
index 0d842b0..ab91f3a 100644
--- a/src/modules/linux/FiretrayWindow.jsm
+++ b/src/modules/linux/FiretrayWindow.jsm
@@ -285,10 +285,12 @@ firetray.Window = {
     F.LOG("restored WindowStates: " + winStates);
     if (winStates & FIRETRAY_XWINDOW_MAXIMIZED) {
       firetray.Handler.windows[xid].chromeWin.maximize();
+      F.LOG("restored maximized");
     }
     let hides_on_minimize = firetray.Utils.prefService.getBoolPref('hides_on_minimize');
     if (!hides_on_minimize && (winStates & FIRETRAY_XWINDOW_HIDDEN)) {
       firetray.Handler.windows[xid].chromeWin.minimize();
+      F.LOG("restored minimized");
     }
 
     delete firetray.Handler.windows[xid].savedStates;
@@ -464,8 +466,6 @@ firetray.Window = {
       return null;
   },
 
-  // TODO: maybe we should subscribe to StructureNotifyMask (UnmapNotify),
-  // VisibilityChangeMask, PropertyChangeMask
   filterWindow: function(xev, gdkEv, data) {
     if (!xev)
       return gdk.GDK_FILTER_CONTINUE;
@@ -538,6 +538,14 @@ firetray.Handler.registerWindow = function(win) {
 
   // register
   let [gtkWin, gdkWin, xid] = firetray.Window.getWindowsFromChromeWindow(win);
+  let eventMask = gdk.gdk_window_get_events(gdkWin);
+  F.LOG(eventMask);
+  let eventMaskNeeded = gdk.GDK_STRUCTURE_MASK|gdk.GDK_PROPERTY_CHANGE_MASK|gdk.GDK_VISIBILITY_NOTIFY_MASK;
+  F.LOG(eventMaskNeeded);
+  if ((eventMask & eventMaskNeeded) !== eventMaskNeeded) {
+    F.WARN("subscribing window to missing mandatory event-masks");
+    gdk.gdk_window_set_events(gdkWin, eventMask|eventMaskNeeded);
+  }
   this.windows[xid] = {};
   this.windows[xid].chromeWin = win;
   this.windows[xid].baseWin = firetray.Handler.getWindowInterface(win, "nsIBaseWindow");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git



More information about the Pkg-mozext-commits mailing list