From 345de05371e0ee5070b45f499dcd73a394d19bb1 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 14 May 2007 00:29:10 +0000 Subject: [PATCH] merge r6508-6510 from trunk --- doc/openbox.1.in | 10 +++++- doc/openbox.1.sgml | 9 ++++++ openbox/action.c | 47 ++++++++++++----------------- openbox/client.c | 72 +++++++++++++++++--------------------------- openbox/extensions.c | 10 +++++- openbox/openbox.c | 5 +++ openbox/openbox.h | 1 + 7 files changed, 79 insertions(+), 75 deletions(-) diff --git a/doc/openbox.1.in b/doc/openbox.1.in index f8979751..68f1dac4 100644 --- a/doc/openbox.1.in +++ b/doc/openbox.1.in @@ -4,7 +4,7 @@ openbox \(em Next generation, highly configurable window manager .SH "SYNOPSIS" .PP -\fBopenbox\fR [\fB\-\-help\fP] [\fB\-\-version\fP] [\fB\-\-replace\fP] [\fB\-\-reconfigure\fP] [\fB\-\-sm-disable\fP] [\fB\-\-sync\fP] [\fB\-\-debug\fP] [\fB\-\-debug-focus\fP] +\fBopenbox\fR [\fB\-\-help\fP] [\fB\-\-version\fP] [\fB\-\-replace\fP] [\fB\-\-reconfigure\fP] [\fB\-\-sm-disable\fP] [\fB\-\-sync\fP] [\fB\-\-debug\fP] [\fB\-\-debug-focus\fP] [\fB\-\-debug-xinerama\fP] .SH "DESCRIPTION" .PP Openbox is a next generation, highly @@ -72,6 +72,10 @@ Run in synchronous mode (for debugging). Display debugging output. .IP "\fB\-\-debug-focus\fP" 10 Display debugging output for focus handling. +.IP "\fB\-\-debug-xinerama\fP" 10 +Split the display into two fake xinerama regions, if +xinerama is not already enabled. This is for debugging +xinerama support. .SH "SEE ALSO" .PP obconf (1), openbox-gnome-session (1), openbox-kde-session (1). @@ -84,6 +88,7 @@ Please report bugs to: \fBhttp://bugzilla.icculus.org/ \fP <<<<<<< .working <<<<<<< .working +<<<<<<< .working .\" created by instant / docbook-to-man, Sun 13 May 2007, 17:59 ======= .\" created by instant / docbook-to-man, Sun 13 May 2007, 19:06 @@ -91,3 +96,6 @@ Please report bugs to: \fBhttp://bugzilla.icculus.org/ ======= .\" created by instant / docbook-to-man, Sun 13 May 2007, 19:06 >>>>>>> .merge-right.r6502 +======= +.\" created by instant / docbook-to-man, Sun 13 May 2007, 20:29 +>>>>>>> .merge-right.r6510 diff --git a/doc/openbox.1.sgml b/doc/openbox.1.sgml index 2a619526..4ed2139e 100644 --- a/doc/openbox.1.sgml +++ b/doc/openbox.1.sgml @@ -44,6 +44,7 @@ manpage.1: manpage.sgml + @@ -147,6 +148,14 @@ manpage.1: manpage.sgml Display debugging output for focus handling. + + + + Split the display into two fake xinerama regions, if + xinerama is not already enabled. This is for debugging + xinerama support. + + diff --git a/openbox/action.c b/openbox/action.c index cb703a66..20bf686f 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -1095,7 +1095,6 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context, { GSList *it; ObAction *a; - gboolean inter = FALSE; if (!acts) return; @@ -1103,33 +1102,6 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context, if (x < 0 && y < 0) screen_pointer_pos(&x, &y); - if (grab_on_keyboard()) - inter = TRUE; - else - for (it = acts; it; it = g_slist_next(it)) { - a = it->data; - if (a->data.any.interactive) { - inter = TRUE; - break; - } - } - - if (!inter && button == 0) { - /* Ungrab the keyboard before running the action, if it was - not from a mouse event. - - We have to do this because a key press causes a passive - grab on the keyboard, and so if the action we are running - wants to grab the keyboard, it will fail if the button is still - held down (which is likely). - - Use the X function not out own, because we're not considering - a grab to be in place at all so our function won't try ungrab - anything. - */ - XUngrabKeyboard(ob_display, time); - } - for (it = acts; it; it = g_slist_next(it)) { a = it->data; @@ -1216,6 +1188,25 @@ void action_execute(union ActionData *data) GError *e = NULL; gchar *cmd, **argv = 0; if (data->execute.path) { + /* Ungrab the keyboard before running the action. + + If there is an interactive action going on, then cancel it to + release the keyboard. If not, then call XUngrabKeyboard(). + + We call XUngrabKeyboard because a key press causes a passive + grab on the keyboard, and so if program we are executing wants to + grab the keyboard, it will fail if the button is still held down + (which is likely). + + Use the X function not out own, because we're not considering + a grab to be in place at all so our function won't try ungrab + anything. + */ + if (keyboard_interactively_grabbed()) + keyboard_interactive_cancel(); + else + XUngrabKeyboard(ob_display, data->any.time); + cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL); if (cmd) { if (!g_shell_parse_argv (cmd, NULL, &argv, &e)) { diff --git a/openbox/client.c b/openbox/client.c index dd47fff4..5ac18700 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2822,28 +2822,21 @@ void client_fullscreen(ObClient *self, gboolean fs) self->pre_fullscreen_area.height = self->pre_max_area.height; } - /* these are not actually used cuz client_configure will set them - as appropriate when the window is fullscreened */ - x = y = w = h = 0; + /* these will help configure_full figure out where to fullscreen + the window */ + x = self->area.x; + y = self->area.y; + w = self->area.width; + h = self->area.height; } else { - Rect *a; + g_assert(self->pre_fullscreen_area.width > 0 && + self->pre_fullscreen_area.height > 0); - if (self->pre_fullscreen_area.width > 0 && - self->pre_fullscreen_area.height > 0) - { - x = self->pre_fullscreen_area.x; - y = self->pre_fullscreen_area.y; - w = self->pre_fullscreen_area.width; - h = self->pre_fullscreen_area.height; - RECT_SET(self->pre_fullscreen_area, 0, 0, 0, 0); - } else { - /* pick some fallbacks... */ - a = screen_area_monitor(self->desktop, 0); - x = a->x + a->width / 4; - y = a->y + a->height / 4; - w = a->width / 2; - h = a->height / 2; - } + x = self->pre_fullscreen_area.x; + y = self->pre_fullscreen_area.y; + w = self->pre_fullscreen_area.width; + h = self->pre_fullscreen_area.height; + RECT_SET(self->pre_fullscreen_area, 0, 0, 0, 0); } client_setup_decor_and_functions(self); @@ -2939,8 +2932,8 @@ void client_maximize(ObClient *self, gboolean max, gint dir) if (dir == 2 && !self->max_vert) return; } - /* we just tell it to configure in the same place and client_configure - worries about filling the screen with the window */ + /* these will help configure_full figure out which screen to fill with + the window */ x = self->area.x; y = self->area.y; w = self->area.width; @@ -2958,34 +2951,23 @@ void client_maximize(ObClient *self, gboolean max, gint dir) self->pre_max_area.width, self->area.height); } } else { - Rect *a; - - a = screen_area_monitor(self->desktop, 0); if ((dir == 0 || dir == 1) && self->max_horz) { /* horz */ - if (self->pre_max_area.width > 0) { - x = self->pre_max_area.x; - w = self->pre_max_area.width; + g_assert(self->pre_max_area.width > 0); - RECT_SET(self->pre_max_area, 0, self->pre_max_area.y, - 0, self->pre_max_area.height); - } else { - /* pick some fallbacks... */ - x = a->x + a->width / 4; - w = a->width / 2; - } + x = self->pre_max_area.x; + w = self->pre_max_area.width; + + RECT_SET(self->pre_max_area, 0, self->pre_max_area.y, + 0, self->pre_max_area.height); } if ((dir == 0 || dir == 2) && self->max_vert) { /* vert */ - if (self->pre_max_area.height > 0) { - y = self->pre_max_area.y; - h = self->pre_max_area.height; + g_assert(self->pre_max_area.height > 0); - RECT_SET(self->pre_max_area, self->pre_max_area.x, 0, - self->pre_max_area.width, 0); - } else { - /* pick some fallbacks... */ - y = a->y + a->height / 4; - h = a->height / 2; - } + y = self->pre_max_area.y; + h = self->pre_max_area.height; + + RECT_SET(self->pre_max_area, self->pre_max_area.x, 0, + self->pre_max_area.width, 0); } } diff --git a/openbox/extensions.c b/openbox/extensions.c index d57b8357..b7d8e73a 100644 --- a/openbox/extensions.c +++ b/openbox/extensions.c @@ -99,7 +99,15 @@ void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) XFree(info); } else #endif - { + if (ob_debug_xinerama) { + gint w = WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)); + gint h = HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)); + *nxin = 2; + *xin_areas = g_new(Rect, *nxin + 1); + RECT_SET((*xin_areas)[0], 0, 0, w/2, h); + RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h); + } + else { *nxin = 1; *xin_areas = g_new(Rect, *nxin + 1); RECT_SET((*xin_areas)[0], 0, 0, diff --git a/openbox/openbox.c b/openbox/openbox.c index 0f2ba923..1b8aef43 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -90,6 +90,7 @@ gboolean ob_sm_use = TRUE; gchar *ob_sm_id = NULL; gchar *ob_sm_save_file = NULL; gchar *ob_config_type = NULL; +gboolean ob_debug_xinerama = FALSE; static ObState state; static gboolean xsync = FALSE; @@ -474,6 +475,7 @@ static void print_help() g_print(_(" --sync Run in synchronous mode\n")); g_print(_(" --debug Display debugging output\n")); g_print(_(" --debug-focus Display debugging output for focus handling\n")); + g_print(_(" --debug-xinerama Split the display into fake xinerama screens\n")); g_print(_("\nPlease report bugs at %s\n"), PACKAGE_BUGREPORT); } @@ -532,6 +534,9 @@ static void parse_args(gint *argc, gchar **argv) ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE); ob_debug_enable(OB_DEBUG_FOCUS, TRUE); } + else if (!strcmp(argv[i], "--debug-xinerama")) { + ob_debug_xinerama = TRUE; + } else if (!strcmp(argv[i], "--reconfigure")) { remote_control = 1; /* don't make this do anything if it's not in --help .. diff --git a/openbox/openbox.h b/openbox/openbox.h index b5d722e9..673826a4 100644 --- a/openbox/openbox.h +++ b/openbox/openbox.h @@ -47,6 +47,7 @@ extern gchar *ob_sm_id; extern gchar *ob_sm_save_file; extern gboolean ob_replace_wm; extern gchar *ob_config_type; +extern gboolean ob_debug_xinerama; /* The state of execution of the window manager */ ObState ob_state(); -- 2.39.2