aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--matchbox/client-types/mb-wm-client-panel.c4
-rw-r--r--matchbox/core/mb-window-manager.c54
-rw-r--r--matchbox/core/mb-wm-client-base.c112
-rw-r--r--matchbox/core/mb-wm-client-window.c17
-rw-r--r--matchbox/core/mb-wm-client-window.h1
-rw-r--r--matchbox/core/mb-wm-client.c10
-rw-r--r--matchbox/core/mb-wm-client.h6
-rw-r--r--matchbox/core/mb-wm-types.h2
-rw-r--r--matchbox/managers/maemo/maemo-toolbar.c12
10 files changed, 142 insertions, 95 deletions
diff --git a/ChangeLog b/ChangeLog
index 7aae58f..f643a98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2008-04-16 Robert Bragg <bob@o-hand.com>
+
+ * matchbox-window-manager-2/matchbox/client-types/mb-wm-client-panel.c
+ * matchbox-window-manager-2/matchbox/core/mb-wm-client-window.c
+ * matchbox-window-manager-2/matchbox/core/mb-wm-client.h
+ * matchbox-window-manager-2/matchbox/core/mb-wm-client-window.h
+ * matchbox-window-manager-2/matchbox/core/mb-wm-types.h
+ * matchbox-window-manager-2/matchbox/core/mb-wm-client-base.c
+ * matchbox-window-manager-2/matchbox/core/mb-window-manager.c
+ * matchbox-window-manager-2/matchbox/core/mb-wm-client.c
+ * matchbox-window-manager-2/matchbox/managers/maemo/maemo-toolbar.c:
+
+ Changes how we respond to configure notifications. We now defer the
+ response until after all layout decisions so we know for sure when we
+ need to send a synthetic event. Note this adds a new
+ client->window->x_geometry member that is meant to always be a pristine
+ copy of the X dimensions for the client xwindow.
+ client->window->geometry continues to be used for layout purposes.
+
2008-04-14 Ross Burton <ross@openedhand.com>
* matchbox/client-types/mb-wm-client-desktop.c:
diff --git a/matchbox/client-types/mb-wm-client-panel.c b/matchbox/client-types/mb-wm-client-panel.c
index 8e038cb..c915d6b 100644
--- a/matchbox/client-types/mb-wm-client-panel.c
+++ b/matchbox/client-types/mb-wm-client-panel.c
@@ -84,8 +84,8 @@ mb_wm_client_panel_init (MBWMObject *this, va_list vap)
win->geometry.y = y;
win->geometry.width = w;
win->geometry.height = h;
-
- XMoveResizeWindow (wm->xdpy, win->xwindow, x, y, w, h);
+
+ mb_wm_client_geometry_mark_dirty (client);
}
if (!client->layout_hints)
diff --git a/matchbox/core/mb-window-manager.c b/matchbox/core/mb-window-manager.c
index a641fa3..4045b3a 100644
--- a/matchbox/core/mb-window-manager.c
+++ b/matchbox/core/mb-window-manager.c
@@ -631,49 +631,21 @@ mb_wm_handle_config_request (XConfigureRequestEvent *xev,
req_geom.width = (value_mask & CWWidth) ? req_w : win_geom->width;
req_geom.height = (value_mask & CWHeight) ? req_h : win_geom->height;
-
-#if 0 /* stacking to sort */
- if (value_mask & (CWSibling|CWStackMode))
- {
-
- }
-#endif
-
- if (mb_geometry_compare (&req_geom, win_geom))
- {
- /* No change in window geometry, but needs configure request
- * per ICCCM.
- */
- mb_wm_client_synthetic_config_event_queue (client);
- return True;
- }
-
- /*
- * Check for position-only change (needs to be done before we
- * request new geometry as that call changes the win_geom values if
- * successful.
+ /* We can't determine at this point what the right response
+ * to this configure request is since layout management might
+ * also want to tweak the window geometry.
+ *
+ * We make a note that the configure request needs a response
+ * and when we reach mb_wm_sync - but after all layout decisions
+ * have been made - then we can determine if the request
+ * has been accepted or not and send any synthetic events as
+ * needed.
*/
- no_size_change = (req_geom.width == win_geom->width &&
- req_geom.height == win_geom->height);
-
- if (no_size_change
- || !mb_wm_client_request_geometry (client,
- &req_geom,
- MBWMClientReqGeomIsViaConfigureReq))
- {
- /* ICCCM says if you ignore a configure request or you respond
- * by only moving/re-stacking the window - without a size change,
- * then the WM must send a synthetic ConfigureNotify.
- */
- mb_wm_client_synthetic_config_event_queue (client);
- }
+ mb_wm_client_configure_request_ack_queue (client);
-#if ENABLE_COMPOSITE
- if (mb_wm_comp_mgr_enabled (wm->comp_mgr))
- {
- mb_wm_comp_mgr_client_configure (client->cm_client);
- }
-#endif
+ mb_wm_client_request_geometry (client,
+ &req_geom,
+ MBWMClientReqGeomIsViaConfigureReq);
return True;
}
diff --git a/matchbox/core/mb-wm-client-base.c b/matchbox/core/mb-wm-client-base.c
index 28a33b9..daa679d 100644
--- a/matchbox/core/mb-wm-client-base.c
+++ b/matchbox/core/mb-wm-client-base.c
@@ -354,6 +354,72 @@ mb_wm_client_base_set_state_props (MBWindowManagerClient *c)
}
static void
+send_synthetic_configure_notify (MBWindowManagerClient *client)
+{
+ MBWindowManager *wm = client->wmref;
+ XConfigureEvent ce;
+
+ ce.type = ConfigureNotify;
+ ce.event = MB_WM_CLIENT_XWIN(client);
+ ce.window = MB_WM_CLIENT_XWIN(client);
+ ce.x = client->window->geometry.x;
+ ce.y = client->window->geometry.y;
+ ce.width = client->window->geometry.width;
+ ce.height = client->window->geometry.height;
+ ce.border_width = 0;
+ ce.above = None;
+ ce.override_redirect = 0;
+
+ XSendEvent(wm->xdpy, MB_WM_CLIENT_XWIN(client), False,
+ StructureNotifyMask, (XEvent *)&ce);
+}
+
+static void
+move_resize_client_xwin (MBWindowManagerClient *client, int x, int y, int w, int h)
+{
+ MBWindowManager *wm = client->wmref;
+
+ /* ICCCM says if you ignore a configure request or you respond
+ * by only moving/re-stacking the window - without a size change,
+ * then the WM must send a synthetic ConfigureNotify.
+ *
+ * NB: the above description assumes that a move/re-stack may be
+ * done by the WM by moving the frame (whereby a regular
+ * ConfigureNotify wouldn't be sent in direct response to the
+ * request which I think is the real point)
+ *
+ * NB: It's assumed that no cleverness is going elsewhere
+ * to optimise out calls to this function when the move/resize
+ * is obviously not needed (e.g. when just moving the frame
+ * of a client)
+ */
+ if (mb_wm_client_needs_configure_request_ack (client)
+ && x == client->window->x_geometry.x
+ && y == client->window->x_geometry.y
+ && w == client->window->x_geometry.width
+ && h == client->window->x_geometry.height)
+ {
+ send_synthetic_configure_notify (client);
+ }
+ else
+ {
+ XMoveResizeWindow(wm->xdpy, MB_WM_CLIENT_XWIN(client),
+ x, y, w, h);
+ client->window->x_geometry.x = x;
+ client->window->x_geometry.y = y;
+ client->window->x_geometry.width = w;
+ client->window->x_geometry.height = h;
+
+#if ENABLE_COMPOSITE
+ if (mb_wm_comp_mgr_enabled (wm->comp_mgr))
+ {
+ mb_wm_comp_mgr_client_configure (client->cm_client);
+ }
+#endif
+ }
+}
+
+static void
mb_wm_client_base_display_sync (MBWindowManagerClient *client)
{
MBWindowManager *wm = client->wmref;
@@ -433,17 +499,18 @@ mb_wm_client_base_display_sync (MBWindowManagerClient *client)
if (fullscreen || !client->xwin_frame)
{
- x = client->window->geometry.x;
- y = client->window->geometry.y;
- w = client->window->geometry.width;
- h = client->window->geometry.height;
-
- XMoveResizeWindow(wm->xdpy, MB_WM_CLIENT_XWIN(client),
- x, y, w, h);
- wgeom[0] = 0;
- wgeom[1] = 0;
- wgeom[2] = 0;
- wgeom[3] = 0;
+
+ x = client->window->geometry.x;
+ y = client->window->geometry.y;
+ w = client->window->geometry.width;
+ h = client->window->geometry.height;
+
+ move_resize_client_xwin (client, x, y, w, h);
+
+ wgeom[0] = 0;
+ wgeom[1] = 0;
+ wgeom[2] = 0;
+ wgeom[3] = 0;
}
else
{
@@ -463,8 +530,7 @@ mb_wm_client_base_display_sync (MBWindowManagerClient *client)
w = client->window->geometry.width;
h = client->window->geometry.height;
- XMoveResizeWindow(wm->xdpy, MB_WM_CLIENT_XWIN(client),
- x, y, w, h);
+ move_resize_client_xwin (client, x, y, w, h);
wgeom[0] = x;
wgeom[1] = client->frame_geometry.width - w - x;
@@ -487,25 +553,9 @@ mb_wm_client_base_display_sync (MBWindowManagerClient *client)
mb_wm_util_untrap_x_errors();
}
+ else if (mb_wm_client_needs_configure_request_ack (client))
+ send_synthetic_configure_notify (client);
- if (mb_wm_client_needs_synthetic_config_event (client))
- {
- XConfigureEvent ce;
-
- ce.type = ConfigureNotify;
- ce.event = MB_WM_CLIENT_XWIN(client);
- ce.window = MB_WM_CLIENT_XWIN(client);
- ce.x = client->window->geometry.x;
- ce.y = client->window->geometry.y;
- ce.width = client->window->geometry.width;
- ce.height = client->window->geometry.height;
- ce.border_width = 0;
- ce.above = None;
- ce.override_redirect = 0;
-
- XSendEvent(wm->xdpy, MB_WM_CLIENT_XWIN(client), False,
- StructureNotifyMask, (XEvent *)&ce);
- }
/* Handle any mapping - should be visible state ? */
diff --git a/matchbox/core/mb-wm-client-window.c b/matchbox/core/mb-wm-client-window.c
index 2435afd..17b0d91 100644
--- a/matchbox/core/mb-wm-client-window.c
+++ b/matchbox/core/mb-wm-client-window.c
@@ -451,7 +451,7 @@ mb_wm_client_window_sync_properties ( MBWMClientWindow *win,
{
if (!mb_wm_xwin_get_geometry_reply (wm,
cookies[COOKIE_WIN_GEOM],
- &win->geometry,
+ &win->x_geometry,
&foo,
&win->depth,
&x_error_code))
@@ -467,11 +467,16 @@ mb_wm_client_window_sync_properties ( MBWMClientWindow *win,
MBWM_DBG("Win: %lx", win->xwindow);
MBWM_DBG("Type: %lx",win->net_type);
MBWM_DBG("Geom: +%i+%i,%ix%i",
- win->geometry.x,
- win->geometry.y,
- win->geometry.width,
- win->geometry.height);
- }
+ win->x_geometry.x,
+ 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? */
+ win->geometry = win->x_geometry;
+ }
if (props_req & MBWM_WINDOW_PROP_ATTR)
{
diff --git a/matchbox/core/mb-wm-client-window.h b/matchbox/core/mb-wm-client-window.h
index 98068e8..5d4a574 100644
--- a/matchbox/core/mb-wm-client-window.h
+++ b/matchbox/core/mb-wm-client-window.h
@@ -115,6 +115,7 @@ struct MBWMClientWindow
MBWMObject parent;
MBGeometry geometry;
+ MBGeometry x_geometry;
unsigned int depth;
char *name;
Window xwindow;
diff --git a/matchbox/core/mb-wm-client.c b/matchbox/core/mb-wm-client.c
index f19a05a..698ad57 100644
--- a/matchbox/core/mb-wm-client.c
+++ b/matchbox/core/mb-wm-client.c
@@ -256,19 +256,19 @@ mb_wm_client_visibility_mark_dirty (MBWindowManagerClient *client)
}
void
-mb_wm_client_synthetic_config_event_queue (MBWindowManagerClient *client)
+mb_wm_client_configure_request_ack_queue (MBWindowManagerClient *client)
{
- mb_wm_display_sync_queue (client->wmref, MBWMSyncSyntheticConfigEv);
+ mb_wm_display_sync_queue (client->wmref, MBWMSyncConfigRequestAck);
- client->priv->sync_state |= MBWMSyncSyntheticConfigEv;
+ client->priv->sync_state |= MBWMSyncConfigRequestAck;
MBWM_DBG(" sync state: %i", client->priv->sync_state);
}
Bool
-mb_wm_client_needs_synthetic_config_event (MBWindowManagerClient *client)
+mb_wm_client_needs_configure_request_ack (MBWindowManagerClient *client)
{
- return (client->priv->sync_state & MBWMSyncSyntheticConfigEv);
+ return (client->priv->sync_state & MBWMSyncConfigRequestAck);
}
void
diff --git a/matchbox/core/mb-wm-client.h b/matchbox/core/mb-wm-client.h
index 33265e9..8127b07 100644
--- a/matchbox/core/mb-wm-client.h
+++ b/matchbox/core/mb-wm-client.h
@@ -244,10 +244,10 @@ Bool
mb_wm_client_needs_decor_sync (MBWindowManagerClient *client);
Bool
-mb_wm_client_needs_synthetic_config_event (MBWindowManagerClient *client);
+mb_wm_client_needs_configure_request_ack (MBWindowManagerClient *client);
-void /* FIXME: rename */
-mb_wm_client_synthetic_config_event_queue (MBWindowManagerClient *client);
+void
+mb_wm_client_configure_request_ack_queue (MBWindowManagerClient *client);
Bool
mb_wm_client_needs_sync (MBWindowManagerClient *client);
diff --git a/matchbox/core/mb-wm-types.h b/matchbox/core/mb-wm-types.h
index 0438d29..74bbf7e 100644
--- a/matchbox/core/mb-wm-types.h
+++ b/matchbox/core/mb-wm-types.h
@@ -396,7 +396,7 @@ typedef enum MBWMSyncType
MBWMSyncGeometry = (1<<2),
MBWMSyncVisibility = (1<<3),
MBWMSyncDecor = (1<<4),
- MBWMSyncSyntheticConfigEv = (1<<5),
+ MBWMSyncConfigRequestAck = (1<<5),
MBWMSyncFullscreen = (1<<6),
} MBWMSyncType;
diff --git a/matchbox/managers/maemo/maemo-toolbar.c b/matchbox/managers/maemo/maemo-toolbar.c
index a13a4b1..436d8c4 100644
--- a/matchbox/managers/maemo/maemo-toolbar.c
+++ b/matchbox/managers/maemo/maemo-toolbar.c
@@ -108,13 +108,13 @@ maemo_toolbar_init (MBWMObject *this, va_list vap)
win->geometry.y = y;
win->geometry.width = w;
win->geometry.height = h;
-
- XMoveResizeWindow (wm->xdpy, win->xwindow, x, y, w, h);
+
+ mb_wm_client_geometry_mark_dirty (client);
}
else
{
win->geometry.width = w;
- XMoveResizeWindow (wm->xdpy, win->xwindow, x, y, w, h);
+ mb_wm_client_geometry_mark_dirty (client);
}
return 1;
@@ -161,7 +161,7 @@ maemo_toolbar_init (MBWMObject *this, va_list vap)
win->geometry.width = w;
win->geometry.height = h;
- XMoveResizeWindow (wm->xdpy, win->xwindow, x, y, w, h);
+ mb_wm_client_geometry_mark_dirty (client);
}
else if (hints & LayoutPrefReserveEdgeNorth)
{
@@ -171,12 +171,12 @@ maemo_toolbar_init (MBWMObject *this, va_list vap)
win->geometry.width = w;
win->geometry.height = h;
- XMoveResizeWindow (wm->xdpy, win->xwindow, x, y, w, h);
+ mb_wm_client_geometry_mark_dirty (client);
}
else
{
win->geometry.width = w;
- XMoveResizeWindow (wm->xdpy, win->xwindow, x, y, w, h);
+ mb_wm_client_geometry_mark_dirty (client);
}
return 1;