aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--matchbox/core/mb-window-manager.c2
-rw-r--r--matchbox/core/mb-wm-atoms.c1
-rw-r--r--matchbox/core/mb-wm-client-window.c56
-rw-r--r--matchbox/core/mb-wm-client-window.h6
-rw-r--r--matchbox/core/mb-wm-types.h1
6 files changed, 72 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f811ed..5e76a07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-09-16 Tomas Frydrych <tf@linux.intel.com>
+
+ * matchbox/core/mb-window-manager.c:
+ * matchbox/core/mb-wm-atoms.c:
+ * matchbox/core/mb-wm-client-window.c:
+ * matchbox/core/mb-wm-client-window.h:
+ * matchbox/core/mb-wm-types.h:
+ Use WM_NORMAL_HINTS for window gravity (instead of the X
+ attribute) and user position (patch by Aurélien Bauchet
+ <abauchet@comwax.com>).
+
2008-09-15 Ross Burton <ross@linux.intel.com>
* matchbox/core/mb-window-manager.[ch]:
diff --git a/matchbox/core/mb-window-manager.c b/matchbox/core/mb-window-manager.c
index 6bb5bb6..84971a7 100644
--- a/matchbox/core/mb-window-manager.c
+++ b/matchbox/core/mb-window-manager.c
@@ -551,6 +551,8 @@ mb_wm_handle_property_notify (XPropertyEvent *xev,
flag = MBWM_WINDOW_PROP_NAME;
else if (xev->atom == wm->atoms[MBWM_ATOM_WM_HINTS])
flag = MBWM_WINDOW_PROP_WM_HINTS;
+ else if (xev->atom == wm->atoms[MBWM_ATOM_WM_NORMAL_HINTS])
+ flag = MBWM_WINDOW_PROP_WM_NORMAL_HINTS;
else if (xev->atom == wm->atoms[MBWM_ATOM_NET_WM_ICON])
flag = MBWM_WINDOW_PROP_NET_ICON;
else if (xev->atom == wm->atoms[MBWM_ATOM_WM_PROTOCOLS])
diff --git a/matchbox/core/mb-wm-atoms.c b/matchbox/core/mb-wm-atoms.c
index c54b457..5d7e805 100644
--- a/matchbox/core/mb-wm-atoms.c
+++ b/matchbox/core/mb-wm-atoms.c
@@ -14,6 +14,7 @@ mb_wm_atoms_init(MBWindowManager *wm)
"WM_NAME",
"WM_STATE",
"WM_HINTS",
+ "WM_NORMAL_HINTS",
"WM_CHANGE_STATE",
"WM_PROTOCOLS",
"WM_DELETE_WINDOW",
diff --git a/matchbox/core/mb-wm-client-window.c b/matchbox/core/mb-wm-client-window.c
index 17b0d91..19aa703 100644
--- a/matchbox/core/mb-wm-client-window.c
+++ b/matchbox/core/mb-wm-client-window.c
@@ -22,6 +22,7 @@
/* Via Xatomtype.h */
#define NumPropWMHintsElements 9 /* number of elements in this structure */
+#define NumPropWMSizeHintsElements 18
enum {
COOKIE_WIN_TYPE = 0,
@@ -29,8 +30,8 @@ enum {
COOKIE_WIN_GEOM,
COOKIE_WIN_NAME,
COOKIE_WIN_NAME_UTF8,
- COOKIE_WIN_SIZE_HINTS,
COOKIE_WIN_WM_HINTS,
+ COOKIE_WIN_WM_NORMAL_HINTS,
COOKIE_WIN_TRANSIENCY,
COOKIE_WIN_PROTOS,
COOKIE_WIN_MACHINE,
@@ -262,6 +263,18 @@ mb_wm_client_window_sync_properties ( MBWMClientWindow *win,
XA_WM_HINTS);
}
+ if (props_req & MBWM_WINDOW_PROP_WM_NORMAL_HINTS)
+ {
+ cookies[COOKIE_WIN_WM_NORMAL_HINTS]
+ = mb_wm_property_req (wm,
+ xwin,
+ wm->atoms[MBWM_ATOM_WM_NORMAL_HINTS],
+ 0,
+ 1024L,
+ False,
+ XA_WM_SIZE_HINTS);
+ }
+
if (props_req & MBWM_WINDOW_PROP_MWM_HINTS)
{
cookies[COOKIE_WIN_MWM_HINTS]
@@ -471,7 +484,7 @@ mb_wm_client_window_sync_properties ( MBWMClientWindow *win,
win->x_geometry.y,
win->x_geometry.width,
win->x_geometry.height);
-
+
/* FIXME is it right that we directly/immeditaly update
* win->geometry here, perhaps that should be left as a
* responsability for a signal handler? */
@@ -492,7 +505,12 @@ mb_wm_client_window_sync_properties ( MBWMClientWindow *win,
win->visual = xwin_attr->visual;
win->colormap = xwin_attr->colormap;
- win->gravity = xwin_attr->win_gravity;
+
+ /* Window gravity should not be set from the window attribute
+ * but using the WM_NORMAL_HINTS atom
+ */
+
+ /* win->gravity = xwin_attr->win_gravity;*/
win->override_redirect = xwin_attr->override_redirect;
win->window_class = xwin_attr->class;
}
@@ -590,6 +608,38 @@ mb_wm_client_window_sync_properties ( MBWMClientWindow *win,
changes |= MBWM_WINDOW_PROP_WM_HINTS;
}
}
+ if (props_req & MBWM_WINDOW_PROP_WM_NORMAL_HINTS)
+ {
+ XSizeHints *sizehints = NULL;
+
+ sizehints = mb_wm_property_get_reply_and_validate (wm,
+ cookies[COOKIE_WIN_WM_NORMAL_HINTS],
+ XA_WM_SIZE_HINTS,
+ 32,
+ NumPropWMSizeHintsElements,
+ NULL,
+ &x_error_code);
+ if (sizehints)
+ {
+ MBWM_DBG("@@@ New Window WM Normal Hints @@@");
+
+ if (sizehints->flags & PWinGravity)
+ {
+ win->gravity = sizehints->win_gravity;
+ MBWM_DBG("Window Gravity : %i", sizehints->win_gravity);
+ }
+
+ win->user_pos = (sizehints->flags & USPosition) ? True : False;
+ MBWM_DBG ("User positioning : %s", win->user_pos ? "yes" : "no");
+
+ /* May be used to recover other information */
+
+ XFree (sizehints);
+
+ changes |= MBWM_WINDOW_PROP_WM_NORMAL_HINTS;
+ }
+
+ }
if (props_req & MBWM_WINDOW_PROP_MWM_HINTS)
{
diff --git a/matchbox/core/mb-wm-client-window.h b/matchbox/core/mb-wm-client-window.h
index 5d4a574..287f881 100644
--- a/matchbox/core/mb-wm-client-window.h
+++ b/matchbox/core/mb-wm-client-window.h
@@ -32,8 +32,8 @@
#define MBWM_WINDOW_PROP_GEOMETRY (1<<1)
#define MBWM_WINDOW_PROP_ATTR (1<<2)
#define MBWM_WINDOW_PROP_NAME (1<<3)
-#define MBWM_WINDOW_PROP_SIZE_HINTS (1<<4)
-#define MBWM_WINDOW_PROP_WM_HINTS (1<<5)
+#define MBWM_WINDOW_PROP_WM_HINTS (1<<4)
+#define MBWM_WINDOW_PROP_WM_NORMAL_HINTS (1<<5)
#define MBWM_WINDOW_PROP_NET_ICON (1<<6)
#define MBWM_WINDOW_PROP_NET_PID (1<<7)
#define MBWM_WINDOW_PROP_PROTOS (1<<8)
@@ -149,6 +149,8 @@ struct MBWMClientWindow
int window_class;
Bool override_redirect;
Bool undecorated;
+
+ Bool user_pos;
};
struct MBWMClientWindowClass
diff --git a/matchbox/core/mb-wm-types.h b/matchbox/core/mb-wm-types.h
index b71f683..249c875 100644
--- a/matchbox/core/mb-wm-types.h
+++ b/matchbox/core/mb-wm-types.h
@@ -160,6 +160,7 @@ typedef enum MBWMAtom
MBWM_ATOM_WM_NAME = 0,
MBWM_ATOM_WM_STATE,
MBWM_ATOM_WM_HINTS,
+ MBWM_ATOM_WM_NORMAL_HINTS,
MBWM_ATOM_WM_CHANGE_STATE,
MBWM_ATOM_WM_PROTOCOLS,
MBWM_ATOM_WM_DELETE_WINDOW,