[maemo-commits] [maemo-commits] r19294 - in projects/haf/branches/libmatchbox2: . bug.134557.nivea/matchbox/core
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Sep 4 18:52:11 EEST 2009
- Previous message: [maemo-commits] r19293 - projects/haf/trunk/libmatchbox2/debian
- Next message: [maemo-commits] r19295 - in projects/haf/trunk/gtk+: . gtk
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: aendrodi Date: 2009-09-04 18:51:38 +0300 (Fri, 04 Sep 2009) New Revision: 19294 Added: projects/haf/branches/libmatchbox2/bug.134557.nivea/ Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-window-manager.c projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-window-manager.h projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-atoms.c projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-base.c projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-window.c projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-window.h projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client.c projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client.h projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-root-window.c projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-types.h Log: nivea patch mb part Copied: projects/haf/branches/libmatchbox2/bug.134557.nivea (from rev 19293, projects/haf/trunk/libmatchbox2) Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-window-manager.c =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-window-manager.c 2009-09-04 15:51:38 UTC (rev 19294) @@ -660,6 +660,7 @@ void *userdata) { MBWindowManager * wm = (MBWindowManager*)userdata; + MBWindowManagerClient * c; wm->xdpy_width = xev->width; wm->xdpy_height = xev->height; @@ -676,6 +677,15 @@ } #endif + /* Bastard hack part 2: now that the screen is reconfigured + * map and activate the client which caused us to rotate. */ + for (c = wm->stack_top; c; c = c->stacked_below) + if (!mb_wm_client_is_map_confirmed (c) && c->window->portrait_on_map) + { + mb_wm_activate_client (wm, c); + break; + } + mb_wm_display_sync_queue (wm, MBWMSyncGeometry); return True; } @@ -1268,10 +1278,15 @@ mb_wm_comp_mgr_register_client (wm->comp_mgr, client); #endif - if (activate && MB_WM_CLIENT_CLIENT_TYPE (client) != MBWMClientTypeDesktop) + if (!activate || MB_WM_CLIENT_CLIENT_TYPE (client) == MBWMClientTypeDesktop) + mb_wm_client_show (client); + else if (!mb_wm_client_wants_portrait(client)) mb_wm_activate_client (wm, client); else - mb_wm_client_show (client); + /* Leave it up to the desktop to do something and we'll show + * and activate the client when the screen size changes. */ + mb_wm_object_signal_emit (MB_WM_OBJECT (wm), + MBWindowManagerSignalPortraitForecast); mb_wm_display_sync_queue (client->wmref, sync_flags); } Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-window-manager.h =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.h 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-window-manager.h 2009-09-04 15:51:38 UTC (rev 19294) @@ -66,6 +66,7 @@ typedef enum { MBWindowManagerSignalThemeChange = 1, + MBWindowManagerSignalPortraitForecast, } MBWindowManagerSignal; typedef enum Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-atoms.c =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-atoms.c 2009-09-04 15:51:38 UTC (rev 19294) @@ -107,6 +107,7 @@ "_HILDON_WM_WINDOW_TYPE_ANIMATION_ACTOR", "_HILDON_WM_WINDOW_TYPE", "_HILDON_WM_WINDOW_TYPE_LEGACY_MENU", + "_HILDON_PORTRAIT_MODE_REQUEST", "_MAEMO_SUPPRESS_ROOT_RECONFIGURATION", }; Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-base.c =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-base.c 2009-09-04 15:51:38 UTC (rev 19294) @@ -627,9 +627,9 @@ } /* - * Sync up any geometry + * Sync up any geometry. Don't touch hidden (and not-yet-shown) clients. */ - if (mb_wm_client_needs_geometry_sync (client)) + if (mb_wm_client_is_mapped (client) && mb_wm_client_needs_geometry_sync (client)) { int x, y, w, h; CARD32 wgeom[4]; Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-window.c =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-window.c 2009-09-04 15:51:38 UTC (rev 19294) @@ -44,6 +44,7 @@ COOKIE_WIN_MWM_HINTS, COOKIE_WIN_HILDON_STACKING, COOKIE_WIN_HILDON_TYPE, + COOKIE_WIN_PORTRAIT_REQUEST, N_COOKIES }; @@ -359,6 +360,13 @@ wm->atoms[MBWM_ATOM_HILDON_STACKING_LAYER]); } + if (props_req & MBWM_WINDOW_PROP_PORTRAIT_REQUEST) + { + cookies[COOKIE_WIN_PORTRAIT_REQUEST] + = mb_wm_property_cardinal_req (wm, xwin, + wm->atoms[MBWM_ATOM_HILDON_PORTRAIT_MODE_REQUEST]); + } + { int err; /* FIXME: toggling 'offline' mode in power menu can cause X error here */ @@ -1166,6 +1174,41 @@ changes |= MBWM_WINDOW_PROP_HILDON_STACKING; } + if (props_req & MBWM_WINDOW_PROP_PORTRAIT_REQUEST) + { + unsigned char *value = NULL; + + mb_wm_property_reply (wm, + cookies[COOKIE_WIN_PORTRAIT_REQUEST], + &actual_type_return, + &actual_format_return, + &nitems_return, + &bytes_after_return, + &value, + &x_error_code); + + if (x_error_code + || actual_type_return != XA_CARDINAL + || actual_format_return != 32 + || value == NULL + ) + { + if (x_error_code == BadWindow) + { + if (value) + XFree(value); + goto badwindow_error; + } + } + else + win->portrait_on_map = *(unsigned *)value; + + if (value) + XFree(value); + + changes |= MBWM_WINDOW_PROP_PORTRAIT_REQUEST; + } + if (changes) mb_wm_object_signal_emit (MB_WM_OBJECT (win), changes); Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-window.h =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client-window.h 2009-09-04 15:51:38 UTC (rev 19294) @@ -48,6 +48,7 @@ #define MBWM_WINDOW_PROP_MWM_HINTS (1<<18) #define MBWM_WINDOW_PROP_HILDON_STACKING (1<<19) #define MBWM_WINDOW_PROP_WIN_HILDON_TYPE (1<<20) +#define MBWM_WINDOW_PROP_PORTRAIT_REQUEST (1<<21) #define MBWM_WINDOW_PROP_ALL (0xffffffff) @@ -161,6 +162,9 @@ /* value of the atom _HILDON_STACKING_LAYER (1-10) */ unsigned int hildon_stacking_layer; + + /* value of _HILDON_PORTRAIT_MODE_REQUEST when the window was mapped */ + unsigned portrait_on_map; }; struct MBWMClientWindowClass Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client.c =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client.c 2009-09-04 15:51:38 UTC (rev 19294) @@ -1221,3 +1221,26 @@ right >= right_of_screen && bottom >= bottom_of_screen; } + +/* Returns whether we're confident the newly mapped @client wants + * the screen to be rotated. */ +Bool +mb_wm_client_wants_portrait (MBWindowManagerClient * client) +{ + if (!client->window->portrait_on_map) + /* Out of scope. */ + return False; + + if (!(MB_WM_CLIENT_CLIENT_TYPE (client) + & (MBWMClientTypeApp|MBWMClientTypeDialog))) + /* Only care about applications (full screen coverage) and dialogs. */ + return False; + + if ((MB_WM_CLIENT_CLIENT_TYPE (client) & MBWMClientTypeDialog) + && client->window->portrait_on_map < 2) + /* But only dialogs which demant rotation. */ + return False; + + /* If we cannot say for sure hd will decide. */ + return True; +} Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client.h =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-client.h 2009-09-04 15:51:38 UTC (rev 19294) @@ -436,6 +436,9 @@ Bool mb_wm_client_covers_screen (MBWindowManagerClient * client); +Bool +mb_wm_client_wants_portrait (MBWindowManagerClient * client); + static inline MBWMClientLayoutHints mb_wm_client_get_layout_hints (MBWindowManagerClient *client) { Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-root-window.c =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-root-window.c 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-root-window.c 2009-09-04 15:51:38 UTC (rev 19294) @@ -353,7 +353,8 @@ { Window xwin = e->window; - if ((c = mb_wm_managed_client_from_xwindow (wm, xwin)) != NULL) + g_warning("ACTIVE WINDOW 0x%lx", xwin); + if (1 && (c = mb_wm_managed_client_from_xwindow (wm, xwin)) != NULL) mb_wm_activate_client (wm, c); return 1; Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-types.h =================================================================== --- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h 2009-09-04 14:38:12 UTC (rev 19293) +++ projects/haf/branches/libmatchbox2/bug.134557.nivea/matchbox/core/mb-wm-types.h 2009-09-04 15:51:38 UTC (rev 19294) @@ -305,6 +305,9 @@ MBWM_ATOM_HILDON_WM_WINDOW_TYPE, MBWM_ATOM_HILDON_WM_WINDOW_TYPE_LEGACY_MENU, + /* See the description in hildon-desktop. */ + MBWM_ATOM_HILDON_PORTRAIT_MODE_REQUEST, + /* * This doesn't exactly suppress root reconfigs, but almost. * More importantly it enables/disables Expose event generation
- Previous message: [maemo-commits] r19293 - projects/haf/trunk/libmatchbox2/debian
- Next message: [maemo-commits] r19295 - in projects/haf/trunk/gtk+: . gtk
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]