From ca7e943e7294bdb6e4c8f86ebeaf03ac19ef8b8b Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 13 May 2004 21:43:52 +0000 Subject: Get rid of out own Xinerama impl. and use GdkScreen routines instead (that fixes at least two issues I can see ,the requirement to have Xienrama enabled in libxfcegui4 to get support for in in xfwm4, and as a side effect, xfwm4 is now compatible with SUN Xinerama which is slightly different from XFree Xinierama) Add a new theme, from my numerous attempts to deign a default xfwm4 theme for 4.2 Remove the theme "synthetic" that sould be moved to xfwm4-themes package (Old svn revision: 11752) --- src/Makefile.in | 3 + src/client.c | 197 +++--- src/client.h | 40 +- src/events.c | 35 +- src/events.h | 26 +- src/focus.c | 394 ++++++------ src/focus.h | 24 +- src/frame.c | 1325 +++++++++++++++++++------------------- src/frame.h | 26 +- src/hints.c | 28 +- src/hints.h | 28 +- src/keyboard.c | 428 ++++++------- src/keyboard.h | 26 +- src/main.c | 50 +- src/main.h | 2 + src/menu.c | 358 +++++------ src/menu.h | 32 +- src/misc.c | 22 +- src/misc.h | 26 +- src/mypixmap.c | 73 +-- src/mypixmap.h | 26 +- src/mywindow.c | 84 +-- src/mywindow.h | 26 +- src/netwm.c | 27 +- src/netwm.h | 24 +- src/parserc.c | 271 ++++---- src/parserc.h | 26 +- src/placement.c | 515 +++++++-------- src/poswin.c | 31 +- src/poswin.h | 26 +- src/session.c | 760 +++++++++++----------- src/session.h | 2 +- src/settings.c | 1530 ++++++++++++++++++++++---------------------- src/settings.h | 26 +- src/spinning_cursor.c | 34 +- src/spinning_cursor.h | 26 +- src/stacking.c | 540 ++++++++-------- src/stacking.h | 24 +- src/startup_notification.c | 200 +++--- src/startup_notification.h | 26 +- src/tabwin.c | 36 +- src/tabwin.h | 24 +- src/transients.c | 194 +++--- src/transients.h | 24 +- src/workspaces.c | 214 +++---- src/workspaces.h | 26 +- 46 files changed, 3955 insertions(+), 3930 deletions(-) (limited to 'src') diff --git a/src/Makefile.in b/src/Makefile.in index 688ad95d7..3dcc01fc9 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -141,6 +141,9 @@ FFLAGS = @FFLAGS@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ diff --git a/src/client.c b/src/client.c index 5d5860f26..e090d2f40 100644 --- a/src/client.c +++ b/src/client.c @@ -22,10 +22,6 @@ #include #endif -#ifdef GDK_MULTIHEAD_SAFE -#undef GDK_MULTIHEAD_SAFE -#endif - #include #include #include @@ -1413,8 +1409,8 @@ clientFrame (Window w, gboolean recapture) c->legacy_fullscreen = FALSE; /* Fullscreen for older legacy apps */ if ((c->x == 0) && (c->y == 0) && - (c->width == MyDisplayFullWidth (dpy, screen)) && - (c->height == MyDisplayFullHeight (dpy, screen)) && + (c->width == gdk_screen_get_width (gscr)) && + (c->height == gdk_screen_get_height (gscr)) && !FLAG_TEST(c->flags, CLIENT_FLAG_HAS_BORDER) && (c->win_layer == WIN_LAYER_NORMAL) && (c->type == WINDOW_NORMAL)) @@ -1660,8 +1656,8 @@ clientFrameAll () clientSetFocus (NULL, NO_FOCUS_FLAG); shield = setTmpEventWin (0, 0, - MyDisplayFullWidth (dpy, screen), - MyDisplayFullHeight (dpy, screen), + gdk_screen_get_width (gscr), + gdk_screen_get_height (gscr), EnterWindowMask); XSync (dpy, FALSE); @@ -1980,32 +1976,32 @@ clientToggleShowDesktop (gboolean show_desktop) if (show_desktop) { for (index = windows_stack; index; index = g_list_next (index)) - { + { Client *c = (Client *) index->data; if (CLIENT_CAN_HIDE_WINDOW (c) - && FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, CLIENT_FLAG_HIDDEN)) + && FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, CLIENT_FLAG_HIDDEN)) { - { - FLAG_SET (c->flags, CLIENT_FLAG_WAS_SHOWN); + { + FLAG_SET (c->flags, CLIENT_FLAG_WAS_SHOWN); clientHide (c, c->win_workspace, TRUE); - } + } } - } + } clientFocusTop (WIN_LAYER_DESKTOP); } else { for (index = g_list_last(windows_stack); index; index = g_list_previous (index)) - { + { Client *c = (Client *) index->data; if (FLAG_TEST (c->flags, CLIENT_FLAG_WAS_SHOWN)) { - { + { clientShow (c, TRUE); - } + } } - FLAG_UNSET (c->flags, CLIENT_FLAG_WAS_SHOWN); - } + FLAG_UNSET (c->flags, CLIENT_FLAG_WAS_SHOWN); + } clientFocusTop (WIN_LAYER_NORMAL); } } @@ -2302,8 +2298,9 @@ void clientToggleMaximized (Client * c, int mode) { XWindowChanges wc; - int cx, cy, left, right, top, bottom; - int full_x, full_y, full_w, full_h; + int cx, cy, full_x, full_y, full_w, full_h; + GdkRectangle rect; + gint monitor_nbr; g_return_if_fail (c != NULL); TRACE ("entering clientToggleMaximized"); @@ -2318,15 +2315,17 @@ clientToggleMaximized (Client * c, int mode) cx = frameX (c) + (frameWidth (c) / 2); cy = frameY (c) + (frameHeight (c) / 2); - left = (isLeftMostHead (dpy, screen, cx, cy) ? params.xfwm_margins[LEFT] : 0); - right = (isRightMostHead (dpy, screen, cx, cy) ? params.xfwm_margins[RIGHT] : 0); - top = (isTopMostHead (dpy, screen, cx, cy) ? params.xfwm_margins[TOP] : 0); - bottom = (isBottomMostHead (dpy, screen, cx, cy) ? params.xfwm_margins[BOTTOM] : 0); + monitor_nbr = gdk_screen_get_monitor_at_point (gscr, cx, cy); + gdk_screen_get_monitor_geometry (gscr, monitor_nbr, &rect); + + full_x = MAX (params.xfwm_margins[LEFT], rect.x); + full_y = MAX (params.xfwm_margins[TOP], rect.y); + full_w = MIN (gdk_screen_get_width (gscr) - params.xfwm_margins[RIGHT], + full_x + rect.width) - full_x; + full_h = MIN (gdk_screen_get_height (gscr) - params.xfwm_margins[BOTTOM], + full_y + rect.height) - full_y; - full_x = MyDisplayX (cx, cy) + left; - full_y = MyDisplayY (cx, cy) + top; - full_w = MyDisplayWidth (dpy, screen, cx, cy) - left - right; - full_h = MyDisplayHeight (dpy, screen, cx, cy) - top - bottom; + /* Adjust size to the widest size available, not covering struts */ clientMaxSpace (&full_x, &full_y, &full_w, &full_h); if (mode & WIN_STATE_MAXIMIZED_HORIZ) @@ -2416,7 +2415,7 @@ clientScreenResize(void) { return; } - + for (index = list_of_windows; index; index = g_list_next (index)) { c = (Client *) index->data; @@ -2460,7 +2459,9 @@ clientSnapPosition (Client * c) int best_delta_x = params.snap_width + 1; int best_delta_y = params.snap_width + 1; int c_frame_x1, c_frame_x2, c_frame_y1, c_frame_y2; - + GdkRectangle rect; + gint monitor_nbr; + g_return_if_fail (c != NULL); TRACE ("entering clientSnapPosition"); TRACE ("Snapping client \"%s\" (0x%lx)", c->name, c->window); @@ -2482,11 +2483,14 @@ clientSnapPosition (Client * c) best_frame_x = frame_x; best_frame_y = frame_y; - disp_x = MyDisplayX (cx, cy); - disp_y = MyDisplayY (cx, cy); - disp_max_x = MyDisplayMaxX (dpy, screen, cx, cy); - disp_max_y = MyDisplayMaxY (dpy, screen, cx, cy); + monitor_nbr = gdk_screen_get_monitor_at_point (gscr, cx, cy); + gdk_screen_get_monitor_geometry (gscr, monitor_nbr, &rect); + disp_x = rect.x; + disp_y = rect.y; + disp_max_x = rect.x + rect.width; + disp_max_y = rect.y + rect.height; + if (params.snap_to_border) { if (abs (disp_x - frame_x) < abs (disp_max_x - frame_x2)) @@ -2515,8 +2519,8 @@ clientSnapPosition (Client * c) for (c2 = clients, i = 0; i < client_count; c2 = c2->next, i++) { if (FLAG_TEST (c2->flags, CLIENT_FLAG_VISIBLE) && (c2 != c) && - (((params.snap_to_windows) && (c2->win_layer == c->win_layer)) - || ((params.snap_to_border) && FLAG_TEST_ALL (c2->flags, CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE)))) + (((params.snap_to_windows) && (c2->win_layer == c->win_layer)) + || ((params.snap_to_border) && FLAG_TEST_ALL (c2->flags, CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE)))) { c_frame_x1 = frameX (c2); c_frame_x2 = c_frame_x1 + frameWidth (c2); @@ -2645,7 +2649,7 @@ clientMove_event_filter (XEvent * xevent, gpointer data) { while (XCheckMaskEvent (dpy, ButtonMotionMask | PointerMotionMask, xevent)) ; /* Skip event */ - + if (xevent->type == ButtonRelease) { moving = FALSE; @@ -2671,7 +2675,7 @@ clientMove_event_filter (XEvent * xevent, gpointer data) msx = xevent->xmotion.x_root; msy = xevent->xmotion.y_root; - max = MyDisplayFullWidth (dpy, screen) - 1; + max = gdk_screen_get_width (gscr) - 1; if ((msx == 0) || (msx == max)) { @@ -2790,8 +2794,8 @@ clientMove (Client * c, XEvent * e) passdata.tmp_event_window = setTmpEventWin (0, 0, - MyDisplayFullWidth (dpy, screen), - MyDisplayFullHeight (dpy, screen), + gdk_screen_get_width (gscr), + gdk_screen_get_height (gscr), ButtonMotionMask | ButtonReleaseMask); if (e->type == KeyPress) @@ -2889,6 +2893,8 @@ clientResize_event_filter (XEvent * xevent, gpointer data) int cx, cy, disp_x, disp_y, disp_max_x, disp_max_y; int frame_x, frame_y, frame_height, frame_width; int frame_top, frame_left, frame_right, frame_bottom; + GdkRectangle rect; + gint monitor_nbr; TRACE ("entering clientResize_event_filter"); frame_x = frameX (c); @@ -2903,10 +2909,13 @@ clientResize_event_filter (XEvent * xevent, gpointer data) cx = frame_x + (frame_width / 2); cy = frame_y + (frame_height / 2); - disp_x = MyDisplayX (cx, cy); - disp_y = MyDisplayY (cx, cy); - disp_max_x = MyDisplayMaxX (dpy, screen, cx, cy); - disp_max_y = MyDisplayMaxY (dpy, screen, cx, cy); + monitor_nbr = gdk_screen_get_monitor_at_point (gscr, cx, cy); + gdk_screen_get_monitor_geometry (gscr, monitor_nbr, &rect); + + disp_x = rect.x; + disp_y = rect.y; + disp_max_x = rect.x + rect.width; + disp_max_y = rect.y + rect.height; if (xevent->type == KeyPress) { @@ -2968,24 +2977,24 @@ clientResize_event_filter (XEvent * xevent, gpointer data) { clientConstrainRatio (c, c->width, c->height, corner); } - if (!clientCkeckTitle (c)) - { - c->height = prev_height; - c->width = prev_width; - } - else - { - if ((c->x + c->width < disp_x + CLIENT_MIN_VISIBLE) - || (c->x + c->width < margins [LEFT] + CLIENT_MIN_VISIBLE)) - { + if (!clientCkeckTitle (c)) + { + c->height = prev_height; + c->width = prev_width; + } + else + { + if ((c->x + c->width < disp_x + CLIENT_MIN_VISIBLE) + || (c->x + c->width < margins [LEFT] + CLIENT_MIN_VISIBLE)) + { c->width = prev_width; - } - if ((c->y + c->height < disp_y + CLIENT_MIN_VISIBLE) - || (c->y + c->height < margins [TOP] + CLIENT_MIN_VISIBLE)) - { + } + if ((c->y + c->height < disp_y + CLIENT_MIN_VISIBLE) + || (c->y + c->height < margins [TOP] + CLIENT_MIN_VISIBLE)) + { c->height = prev_height; - } - } + } + } if (passdata->poswin) { poswinSetPosition (passdata->poswin, c); @@ -3087,59 +3096,59 @@ clientResize_event_filter (XEvent * xevent, gpointer data) c->y = c->y - (c->height - passdata->oldh); frame_y = frameY (c); } - if (!clientCkeckTitle (c)) - { + if (!clientCkeckTitle (c)) + { c->x = prev_x; c->y = prev_y; c->height = prev_height; c->width = prev_width; - } - else - { + } + else + { if ((passdata->corner == CORNER_TOP_LEFT) - || (passdata->corner == CORNER_TOP_RIGHT)) + || (passdata->corner == CORNER_TOP_RIGHT)) { - if ((c->y > disp_max_y - CLIENT_MIN_VISIBLE) - || (c->y > MyDisplayFullHeight (dpy, screen) - - margins [BOTTOM] - CLIENT_MIN_VISIBLE)) - { + if ((c->y > disp_max_y - CLIENT_MIN_VISIBLE) + || (c->y > gdk_screen_get_height (gscr) + - margins [BOTTOM] - CLIENT_MIN_VISIBLE)) + { c->y = prev_y; c->height = prev_height; - } + } } else if ((passdata->corner == CORNER_BOTTOM_LEFT) - || (passdata->corner == CORNER_BOTTOM_RIGHT) - || (passdata->corner == 4 + SIDE_BOTTOM)) + || (passdata->corner == CORNER_BOTTOM_RIGHT) + || (passdata->corner == 4 + SIDE_BOTTOM)) { - if ((c->y + c->height < disp_y + CLIENT_MIN_VISIBLE) - || (c->y + c->height < margins [TOP] + CLIENT_MIN_VISIBLE)) - { + if ((c->y + c->height < disp_y + CLIENT_MIN_VISIBLE) + || (c->y + c->height < margins [TOP] + CLIENT_MIN_VISIBLE)) + { c->height = prev_height; - } + } } if ((passdata->corner == CORNER_TOP_LEFT) - || (passdata->corner == CORNER_BOTTOM_LEFT) - || (passdata->corner == 4 + SIDE_LEFT)) + || (passdata->corner == CORNER_BOTTOM_LEFT) + || (passdata->corner == 4 + SIDE_LEFT)) { - if ((c->x > disp_max_x - CLIENT_MIN_VISIBLE) - || (c->x > MyDisplayFullWidth (dpy, screen) - - margins [RIGHT] - CLIENT_MIN_VISIBLE)) - { + if ((c->x > disp_max_x - CLIENT_MIN_VISIBLE) + || (c->x > gdk_screen_get_width (gscr) + - margins [RIGHT] - CLIENT_MIN_VISIBLE)) + { c->x = prev_x; c->width = prev_width; - } + } } else if ((passdata->corner == CORNER_TOP_RIGHT) - || (passdata->corner == CORNER_BOTTOM_RIGHT) - || (passdata->corner == 4 + SIDE_RIGHT)) + || (passdata->corner == CORNER_BOTTOM_RIGHT) + || (passdata->corner == 4 + SIDE_RIGHT)) { - if ((c->x + c->width < disp_x + CLIENT_MIN_VISIBLE) - || (c->x + c->width < margins [LEFT] + CLIENT_MIN_VISIBLE)) - { + if ((c->x + c->width < disp_x + CLIENT_MIN_VISIBLE) + || (c->x + c->width < margins [LEFT] + CLIENT_MIN_VISIBLE)) + { c->width = prev_width; - } + } } - } + } if (passdata->poswin) { poswinSetPosition (passdata->poswin, c); @@ -3212,8 +3221,8 @@ clientResize (Client * c, int corner, XEvent * e) passdata.corner = corner; passdata.tmp_event_window = setTmpEventWin (0, 0, - MyDisplayFullWidth (dpy, screen), - MyDisplayFullHeight (dpy, screen), + gdk_screen_get_width (gscr), + gdk_screen_get_height (gscr), ButtonMotionMask | ButtonReleaseMask); if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) diff --git a/src/client.h b/src/client.h index 972c08f89..9535a66af 100644 --- a/src/client.h +++ b/src/client.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2004 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2004 Olivier Fourdan */ @@ -130,13 +130,13 @@ #define WM_FLAG_CONTEXT_HELP (1L<<3) #define CLIENT_FLAG_INITIAL_VALUES CLIENT_FLAG_HAS_BORDER | \ - CLIENT_FLAG_HAS_MENU | \ - CLIENT_FLAG_HAS_MAXIMIZE | \ - CLIENT_FLAG_HAS_STICK | \ - CLIENT_FLAG_HAS_HIDE | \ - CLIENT_FLAG_HAS_CLOSE | \ - CLIENT_FLAG_HAS_MOVE | \ - CLIENT_FLAG_HAS_RESIZE + CLIENT_FLAG_HAS_MENU | \ + CLIENT_FLAG_HAS_MAXIMIZE | \ + CLIENT_FLAG_HAS_STICK | \ + CLIENT_FLAG_HAS_HIDE | \ + CLIENT_FLAG_HAS_CLOSE | \ + CLIENT_FLAG_HAS_MOVE | \ + CLIENT_FLAG_HAS_RESIZE #define ALL_WORKSPACES (int) 0xFFFFFFFF diff --git a/src/events.c b/src/events.c index c544decf2..148e28a3e 100644 --- a/src/events.c +++ b/src/events.c @@ -22,10 +22,6 @@ #include #endif -#ifdef GDK_MULTIHEAD_SAFE -#undef GDK_MULTIHEAD_SAFE -#endif - #include #include #include @@ -252,7 +248,7 @@ handleMotionNotify (XMotionEvent * ev) { msx = ev->x_root; msy = ev->y_root; - max = MyDisplayFullWidth (dpy, screen) - 1; + max = gdk_screen_get_width (gscr) - 1; if ((msx == 0) || (msx == max)) { @@ -1051,6 +1047,8 @@ handleConfigureRequest (XConfigureRequestEvent * ev) clientCoordGravitate (c, APPLY, &wc.x, &wc.y); if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) { + GdkRectangle rect; + gint monitor_nbr; int cx, cy; /* size request from fullscreen windows get fullscreen */ @@ -1058,10 +1056,13 @@ handleConfigureRequest (XConfigureRequestEvent * ev) cx = frameX (c) + (frameWidth (c) / 2); cy = frameY (c) + (frameHeight (c) / 2); - wc.x = MyDisplayX (cx, cy); - wc.y = MyDisplayY (cx, cy); - wc.width = MyDisplayWidth (dpy, screen, cx, cy); - wc.height = MyDisplayHeight (dpy, screen, cx, cy); + monitor_nbr = gdk_screen_get_monitor_at_point (gscr, cx, cy); + gdk_screen_get_monitor_geometry (gscr, monitor_nbr, &rect); + + wc.x = rect.x; + wc.y = rect.y; + wc.width = rect.width; + wc.height = rect.height; ev->value_mask |= (CWX | CWY | CWWidth | CWHeight); } @@ -1093,8 +1094,8 @@ handleConfigureRequest (XConfigureRequestEvent * ev) } if (ev->value_mask & CWStackMode) { - clientPassGrabButton1 (NULL); - } + clientPassGrabButton1 (NULL); + } #if 0 /* Let's say that if the client performs a XRaiseWindow, we show the window if hidden */ if ((ev->value_mask & CWStackMode) && (wc.stack_mode == Above)) @@ -1374,9 +1375,9 @@ handlePropertyNotify (XPropertyEvent * ev) else if (ev->atom == net_wm_user_time) { if (getNetWMUserTime (dpy, c->window, &c->user_time)) - { + { FLAG_SET (c->flags, CLIENT_FLAG_HAS_USER_TIME); - } + } } #ifdef HAVE_STARTUP_NOTIFICATION else if (ev->atom == net_startup_id) @@ -1559,8 +1560,8 @@ handleClientMessage (XClientMessageEvent * ev) && (ev->format == 32)) { TRACE ("root has received a net_showing_desktop event"); - clientToggleShowDesktop (ev->data.l[0]); - setHint (dpy, root, net_showing_desktop, ev->data.l[0]); + clientToggleShowDesktop (ev->data.l[0]); + setHint (dpy, root, net_showing_desktop, ev->data.l[0]); } else { @@ -1925,8 +1926,8 @@ show_popup_cb (GtkWidget * widget, GdkEventButton * ev, gpointer data) trouble. */ menu_event_window = setTmpEventWin (0, 0, - MyDisplayFullWidth (dpy, screen), - MyDisplayFullHeight (dpy, screen), + gdk_screen_get_width (gscr), + gdk_screen_get_height (gscr), NoEventMask); menu = menu_default (ops, insensitive, menu_callback, c->win_workspace, diff --git a/src/events.h b/src/events.h index 4ace179d9..f64fcc70f 100644 --- a/src/events.h +++ b/src/events.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/focus.c b/src/focus.c index bc6be4313..2251daf29 100644 --- a/src/focus.c +++ b/src/focus.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2004 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2004 Olivier Fourdan */ @@ -22,10 +22,6 @@ #include #endif -#ifdef GDK_MULTIHEAD_SAFE -#undef GDK_MULTIHEAD_SAFE -#endif - #include #include #include @@ -72,31 +68,31 @@ clientGetTopMostFocusable (int layer, Client * exclude) top_client.prefered = top_client.highest = NULL; for (index = windows_stack; index; index = g_list_next (index)) { - c = (Client *) index->data; - TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name, - c->window, (int) c->win_layer); + c = (Client *) index->data; + TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name, + c->window, (int) c->win_layer); - if ((c->type & (WINDOW_SPLASHSCREEN | WINDOW_DOCK | WINDOW_DESKTOP)) + if ((c->type & (WINDOW_SPLASHSCREEN | WINDOW_DOCK | WINDOW_DESKTOP)) || ((layer != WIN_LAYER_DESKTOP) && (c->type & WINDOW_DESKTOP))) - { - continue; - } - - if (!exclude || (c != exclude)) - { - if ((c->win_layer <= layer) && FLAG_TEST (c->flags, CLIENT_FLAG_VISIBLE)) - { - if (clientSelectMask (c, 0)) - { - top_client.prefered = c; - } - top_client.highest = c; - } - else if (c->win_layer > layer) - { - break; - } - } + { + continue; + } + + if (!exclude || (c != exclude)) + { + if ((c->win_layer <= layer) && FLAG_TEST (c->flags, CLIENT_FLAG_VISIBLE)) + { + if (clientSelectMask (c, 0)) + { + top_client.prefered = c; + } + top_client.highest = c; + } + else if (c->win_layer > layer) + { + break; + } + } } return top_client; @@ -110,11 +106,11 @@ clientFocusTop (int layer) top_client = clientGetTopMostFocusable (layer, NULL); if (top_client.prefered) { - clientSetFocus (top_client.prefered, NO_FOCUS_FLAG); + clientSetFocus (top_client.prefered, NO_FOCUS_FLAG); } else { - clientSetFocus (top_client.highest, NO_FOCUS_FLAG); + clientSetFocus (top_client.highest, NO_FOCUS_FLAG); } } @@ -127,30 +123,30 @@ clientFocusNew(Client * c) if (!clientAcceptFocus (c)) { - return; + return; } /* Try to avoid focus stealing */ if (client_focus) { - if (FLAG_TEST(c->flags, CLIENT_FLAG_HAS_USER_TIME) && + if (FLAG_TEST(c->flags, CLIENT_FLAG_HAS_USER_TIME) && FLAG_TEST(client_focus->flags, CLIENT_FLAG_HAS_USER_TIME)) { if (c->user_time < client_focus->user_time) { - give_focus = FALSE; + give_focus = FALSE; } } } if (give_focus || FLAG_TEST(c->flags, CLIENT_FLAG_STATE_MODAL)) { - clientSetFocus (c, FOCUS_IGNORE_MODAL); - clientPassGrabButton1 (c); + clientSetFocus (c, FOCUS_IGNORE_MODAL); + clientPassGrabButton1 (c); } else { - clientPassGrabButton1 (NULL); + clientPassGrabButton1 (NULL); } } @@ -162,25 +158,25 @@ clientSelectMask (Client * c, int mask) TRACE ("entering clientSelectMask"); if ((!clientAcceptFocus (c)) && !(mask & INCLUDE_SKIP_FOCUS)) { - okay = FALSE; + okay = FALSE; } if (FLAG_TEST (c->flags, CLIENT_FLAG_HIDDEN) && !(mask & INCLUDE_HIDDEN)) { - okay = FALSE; + okay = FALSE; } if (FLAG_TEST (c->flags, CLIENT_FLAG_SKIP_PAGER) - && !(mask & INCLUDE_SKIP_PAGER)) + && !(mask & INCLUDE_SKIP_PAGER)) { - okay = FALSE; + okay = FALSE; } if (FLAG_TEST (c->flags, CLIENT_FLAG_SKIP_TASKBAR) - && !(mask & INCLUDE_SKIP_TASKBAR)) + && !(mask & INCLUDE_SKIP_TASKBAR)) { - okay = FALSE; + okay = FALSE; } if ((c->win_workspace != workspace) && !(mask & INCLUDE_ALL_WORKSPACES)) { - okay = FALSE; + okay = FALSE; } return okay; @@ -196,18 +192,18 @@ clientGetNext (Client * c, int mask) if (c) { - for (c2 = c->next, i = 0; (c2) && (i < client_count); - c2 = c2->next, i++) - { - if (c2->type & (WINDOW_SPLASHSCREEN | WINDOW_DOCK | WINDOW_DESKTOP)) - { - continue; - } - if (clientSelectMask (c2, mask)) - { - return c2; - } - } + for (c2 = c->next, i = 0; (c2) && (i < client_count); + c2 = c2->next, i++) + { + if (c2->type & (WINDOW_SPLASHSCREEN | WINDOW_DOCK | WINDOW_DESKTOP)) + { + continue; + } + if (clientSelectMask (c2, mask)) + { + return c2; + } + } } return NULL; } @@ -222,18 +218,18 @@ clientGetPrevious (Client * c, int mask) if (c) { - for (c2 = c->prev, i = 0; (c2) && (i < client_count); - c2 = c2->prev, i++) - { - if (c2->type & (WINDOW_SPLASHSCREEN | WINDOW_DOCK | WINDOW_DESKTOP)) - { - continue; - } - if (clientSelectMask (c2, mask)) - { - return c2; - } - } + for (c2 = c->prev, i = 0; (c2) && (i < client_count); + c2 = c2->prev, i++) + { + if (c2->type & (WINDOW_SPLASHSCREEN | WINDOW_DOCK | WINDOW_DESKTOP)) + { + continue; + } + if (clientSelectMask (c2, mask)) + { + return c2; + } + } } return NULL; } @@ -254,50 +250,50 @@ clientPassFocus (Client * c) if (pending_focus) { - current_focus = pending_focus; + current_focus = pending_focus; } if ((c || current_focus) && (c != current_focus)) { - return; + return; } top_most = clientGetTopMostFocusable (look_in_layer, c); if (params.click_to_focus) { - if ((c) && clientIsModal (c)) - { - /* If the window is a modal, send focus back to its parent window - Modals are transients, and we aren"t interested in modal - for group, so it safe to sue clientGetTransient because - it's really what we want... - */ - - c2 = clientGetTransient (c); - if (c2 && FLAG_TEST(c2->flags, CLIENT_FLAG_VISIBLE)) - { - new_focus = c2; - /* Usability: raise the parent, to grab user's attention */ - clientRaise (c2); - } - } + if ((c) && clientIsModal (c)) + { + /* If the window is a modal, send focus back to its parent window + Modals are transients, and we aren"t interested in modal + for group, so it safe to sue clientGetTransient because + it's really what we want... + */ + + c2 = clientGetTransient (c); + if (c2 && FLAG_TEST(c2->flags, CLIENT_FLAG_VISIBLE)) + { + new_focus = c2; + /* Usability: raise the parent, to grab user's attention */ + clientRaise (c2); + } + } } else if (XQueryPointer (dpy, root, &dr, &window, &rx, &ry, &wx, &wy, &mask)) { - new_focus = clientAtPosition (rx, ry, c); + new_focus = clientAtPosition (rx, ry, c); } if (!new_focus) { - new_focus = top_most.prefered ? top_most.prefered : top_most.highest; + new_focus = top_most.prefered ? top_most.prefered : top_most.highest; } clientSetFocus (new_focus, FOCUS_IGNORE_MODAL | FOCUS_FORCE); if (new_focus == top_most.highest) { - clientPassGrabButton1 (new_focus); + clientPassGrabButton1 (new_focus); } else if (last_ungrab == c) { - clientPassGrabButton1 (NULL); + clientPassGrabButton1 (NULL); } } @@ -311,16 +307,16 @@ clientAcceptFocus (Client * c) /* Modal dialogs *always* accept focus */ if (FLAG_TEST(c->flags, CLIENT_FLAG_STATE_MODAL)) { - return TRUE; + return TRUE; } /* First check GNOME protocol */ if (c->win_hints & WIN_HINTS_SKIP_FOCUS) { - return FALSE; + return FALSE; } if (!FLAG_TEST (c->wm_flags, WM_FLAG_INPUT | WM_FLAG_TAKEFOCUS)) { - return FALSE; + return FALSE; } return TRUE; @@ -334,13 +330,13 @@ clientSortRing(Client *c) TRACE ("Sorting..."); if (client_count > 2 && c != clients) { - c->prev->next = c->next; - c->next->prev = c->prev; + c->prev->next = c->next; + c->next->prev = c->prev; - c->prev = clients->prev; - c->next = clients; - clients->prev->next = c; - clients->prev = c; + c->prev = clients->prev; + c->next = clients; + clients->prev->next = c; + clients->prev = c; } clients = c; } @@ -356,64 +352,64 @@ clientUpdateFocus (Client * c, unsigned short flags) pending_focus = NULL; if ((c) && !clientAcceptFocus (c)) { - TRACE ("SKIP_FOCUS set for client \"%s\" (0x%lx)", c->name, c->window); - return; + TRACE ("SKIP_FOCUS set for client \"%s\" (0x%lx)", c->name, c->window); + return; } if ((c == client_focus) && !(flags & FOCUS_FORCE)) { - TRACE ("client \"%s\" (0x%lx) is already focused, ignoring request", - c->name, c->window); - return; + TRACE ("client \"%s\" (0x%lx) is already focused, ignoring request", + c->name, c->window); + return; } client_focus = c; if (c) { - clientInstallColormaps (c); - if (flags & FOCUS_SORT) - { - clientSortRing(c); - } - data[0] = c->window; - if ((c->legacy_fullscreen) || FLAG_TEST(c->flags, CLIENT_FLAG_FULLSCREEN)) - { - clientSetLayer (c, WIN_LAYER_ABOVE_DOCK); - } - frameDraw (c, FALSE, FALSE); + clientInstallColormaps (c); + if (flags & FOCUS_SORT) + { + clientSortRing(c); + } + data[0] = c->window; + if ((c->legacy_fullscreen) || FLAG_TEST(c->flags, CLIENT_FLAG_FULLSCREEN)) + { + clientSetLayer (c, WIN_LAYER_ABOVE_DOCK); + } + frameDraw (c, FALSE, FALSE); } else { - data[0] = None; + data[0] = None; } if (c2) { - TRACE ("redrawing previous focus client \"%s\" (0x%lx)", c2->name, - c2->window); - /* Requires a bit of explanation here... Legacy apps automatically - switch to above layer when receiving focus, and return to - normal layer when loosing focus. - The following "logic" is in charge of that behaviour. - */ - if ((c2->legacy_fullscreen) || FLAG_TEST(c2->flags, CLIENT_FLAG_FULLSCREEN)) - { - if (FLAG_TEST(c2->flags, CLIENT_FLAG_FULLSCREEN)) - { - clientSetLayer (c2, c2->fullscreen_old_layer); - } - else - { - clientSetLayer (c2, WIN_LAYER_NORMAL); - } - if (c) - { - clientRaise(c); - clientPassGrabButton1 (c); - } - } - frameDraw (c2, FALSE, FALSE); + TRACE ("redrawing previous focus client \"%s\" (0x%lx)", c2->name, + c2->window); + /* Requires a bit of explanation here... Legacy apps automatically + switch to above layer when receiving focus, and return to + normal layer when loosing focus. + The following "logic" is in charge of that behaviour. + */ + if ((c2->legacy_fullscreen) || FLAG_TEST(c2->flags, CLIENT_FLAG_FULLSCREEN)) + { + if (FLAG_TEST(c2->flags, CLIENT_FLAG_FULLSCREEN)) + { + clientSetLayer (c2, c2->fullscreen_old_layer); + } + else + { + clientSetLayer (c2, WIN_LAYER_NORMAL); + } + if (c) + { + clientRaise(c); + clientPassGrabButton1 (c); + } + } + frameDraw (c2, FALSE, FALSE); } data[1] = None; XChangeProperty (dpy, root, net_active_window, XA_WINDOW, 32, - PropModeReplace, (unsigned char *) data, 2); + PropModeReplace, (unsigned char *) data, 2); } void @@ -425,55 +421,55 @@ clientSetFocus (Client * c, unsigned short flags) if ((c) && !(flags & FOCUS_IGNORE_MODAL)) { - c2 = clientGetModalFor (c); + c2 = clientGetModalFor (c); - if (c2) - { - c = c2; - } + if (c2) + { + c = c2; + } } c2 = ((client_focus != c) ? client_focus : NULL); if ((c) && FLAG_TEST (c->flags, CLIENT_FLAG_VISIBLE)) { - TRACE ("setting focus to client \"%s\" (0x%lx)", c->name, c->window); - if ((c == client_focus) && !(flags & FOCUS_FORCE)) - { - TRACE ("client \"%s\" (0x%lx) is already focused, ignoring request", - c->name, c->window); - return; - } - if (!clientAcceptFocus (c)) - { - TRACE ("SKIP_FOCUS set for client \"%s\" (0x%lx)", c->name, c->window); - return; - } - if (FLAG_TEST (c->wm_flags, WM_FLAG_INPUT)) - { - pending_focus = c; - XSetInputFocus (dpy, c->window, RevertToPointerRoot, CurrentTime); - } - if (FLAG_TEST(c->wm_flags, WM_FLAG_TAKEFOCUS)) - { - sendClientMessage (c->window, wm_protocols, wm_takefocus, CurrentTime); - } - XFlush (dpy); + TRACE ("setting focus to client \"%s\" (0x%lx)", c->name, c->window); + if ((c == client_focus) && !(flags & FOCUS_FORCE)) + { + TRACE ("client \"%s\" (0x%lx) is already focused, ignoring request", + c->name, c->window); + return; + } + if (!clientAcceptFocus (c)) + { + TRACE ("SKIP_FOCUS set for client \"%s\" (0x%lx)", c->name, c->window); + return; + } + if (FLAG_TEST (c->wm_flags, WM_FLAG_INPUT)) + { + pending_focus = c; + XSetInputFocus (dpy, c->window, RevertToPointerRoot, CurrentTime); + } + if (FLAG_TEST(c->wm_flags, WM_FLAG_TAKEFOCUS)) + { + sendClientMessage (c->window, wm_protocols, wm_takefocus, CurrentTime); + } + XFlush (dpy); } else { - unsigned long data[2]; - + unsigned long data[2]; + TRACE ("setting focus to none"); - + client_focus = NULL; - if (c2) - { - frameDraw (c2, FALSE, FALSE); - } - XSetInputFocus (dpy, gnome_win, RevertToPointerRoot, CurrentTime); - XFlush (dpy); - data[0] = data[1] = None; - XChangeProperty (dpy, root, net_active_window, XA_WINDOW, 32, - PropModeReplace, (unsigned char *) data, 2); + if (c2) + { + frameDraw (c2, FALSE, FALSE); + } + XSetInputFocus (dpy, gnome_win, RevertToPointerRoot, CurrentTime); + XFlush (dpy); + data[0] = data[1] = None; + XChangeProperty (dpy, root, net_active_window, XA_WINDOW, 32, + PropModeReplace, (unsigned char *) data, 2); } } @@ -517,22 +513,22 @@ clientPassGrabButton1(Client * c) if (c == NULL) { - if (last_ungrab) - { - clientGrabButton1 (last_ungrab); - } - last_ungrab = NULL; - return; + if (last_ungrab) + { + clientGrabButton1 (last_ungrab); + } + last_ungrab = NULL; + return; } if (last_ungrab == c) { - return; + return; } if (last_ungrab) { - clientGrabButton1 (last_ungrab); + clientGrabButton1 (last_ungrab); } clientUngrabButton1 (c); diff --git a/src/focus.h b/src/focus.h index a09b5873c..e8448e5b4 100644 --- a/src/focus.h +++ b/src/focus.h @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2002-2004 Olivier Fourdan + xfwm4 - (c) 2002-2004 Olivier Fourdan */ diff --git a/src/frame.c b/src/frame.c index 51a0c29de..0fba8349b 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ @@ -22,6 +22,9 @@ #include #endif +#include +#include +#include #include #include #include "main.h" @@ -36,9 +39,9 @@ frameLeft (Client * c) TRACE ("entering frameLeft"); if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_FULLSCREEN)) { - return params.sides[SIDE_LEFT][ACTIVE].width; + return params.sides[SIDE_LEFT][ACTIVE].width; } return 0; } @@ -49,9 +52,9 @@ frameRight (Client * c) TRACE ("entering frameRight"); if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_FULLSCREEN)) { - return params.sides[SIDE_RIGHT][ACTIVE].width; + return params.sides[SIDE_RIGHT][ACTIVE].width; } return 0; } @@ -62,9 +65,9 @@ frameTop (Client * c) TRACE ("entering frameTop"); if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_FULLSCREEN)) { - return params.title[TITLE_3][ACTIVE].height; + return params.title[TITLE_3][ACTIVE].height; } return 0; } @@ -75,9 +78,9 @@ frameBottom (Client * c) TRACE ("entering frameBottom"); if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_FULLSCREEN)) { - return params.sides[SIDE_BOTTOM][ACTIVE].height; + return params.sides[SIDE_BOTTOM][ACTIVE].height; } return 0; } @@ -88,9 +91,9 @@ frameX (Client * c) TRACE ("entering frameX"); if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_FULLSCREEN)) { - return c->x - frameLeft (c); + return c->x - frameLeft (c); } return c->x; } @@ -101,9 +104,9 @@ frameY (Client * c) TRACE ("entering frameY"); if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_FULLSCREEN)) { - return c->y - frameTop (c); + return c->y - frameTop (c); } return c->y; } @@ -114,9 +117,9 @@ frameWidth (Client * c) TRACE ("entering frameWidth"); if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_FULLSCREEN)) { - return c->width + frameLeft (c) + frameRight (c); + return c->width + frameLeft (c) + frameRight (c); } return c->width; } @@ -127,15 +130,15 @@ frameHeight (Client * c) TRACE ("entering frameHeight"); if (FLAG_TEST_AND_NOT (c->flags, - CLIENT_FLAG_HAS_BORDER | CLIENT_FLAG_SHADED, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_HAS_BORDER | CLIENT_FLAG_SHADED, + CLIENT_FLAG_FULLSCREEN)) { - return frameTop (c) + frameBottom (c); + return frameTop (c) + frameBottom (c); } else if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) + CLIENT_FLAG_FULLSCREEN)) { - return c->height + frameTop (c) + frameBottom (c); + return c->height + frameTop (c) + frameBottom (c); } return c->height; } @@ -152,7 +155,7 @@ fillRectangle (Display * dpy, Drawable d, Pixmap pm, int x, int y, int width, if ((width < 1) || (height < 1)) { - return; + return; } gv.fill_style = FillTiled; gv.tile = pm; @@ -161,11 +164,11 @@ fillRectangle (Display * dpy, Drawable d, Pixmap pm, int x, int y, int width, gv.foreground = WhitePixel (dpy, screen); if (gv.tile != None) { - mask = GCTile | GCFillStyle | GCTileStipXOrigin; + mask = GCTile | GCFillStyle | GCTileStipXOrigin; } else { - mask = GCForeground; + mask = GCForeground; } gc = XCreateGC (dpy, d, mask, &gv); XFillRectangle (dpy, d, gc, x, y, width, height); @@ -188,36 +191,36 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, if (left > right) { - temp = left; - left = right; - right = temp; + temp = left; + left = right; + right = temp; } width = - frameWidth (c) - params.corners[CORNER_TOP_LEFT][ACTIVE].width - - params.corners[CORNER_TOP_RIGHT][ACTIVE].width; + frameWidth (c) - params.corners[CORNER_TOP_LEFT][ACTIVE].width - + params.corners[CORNER_TOP_RIGHT][ACTIVE].width; if (width < 1) { - pm->pixmap = None; - pm->mask = None; - pm->width = 0; - pm->height = 0; - return; + pm->pixmap = None; + pm->mask = None; + pm->width = 0; + pm->height = 0; + return; } if (left < params.corners[CORNER_TOP_LEFT][ACTIVE].width) { - left = params.corners[CORNER_TOP_LEFT][ACTIVE].width; + left = params.corners[CORNER_TOP_LEFT][ACTIVE].width; } if (right > - frameWidth (c) - params.corners[CORNER_TOP_RIGHT][ACTIVE].width) + frameWidth (c) - params.corners[CORNER_TOP_RIGHT][ACTIVE].width) { - right = - frameWidth (c) - params.corners[CORNER_TOP_RIGHT][ACTIVE].width; + right = + frameWidth (c) - params.corners[CORNER_TOP_RIGHT][ACTIVE].width; } if (right < params.corners[CORNER_TOP_LEFT][ACTIVE].width) { - right = params.corners[CORNER_TOP_LEFT][ACTIVE].width; + right = params.corners[CORNER_TOP_LEFT][ACTIVE].width; } left = left - params.corners[CORNER_TOP_LEFT][ACTIVE].width; @@ -231,58 +234,58 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, if (params.full_width_title) { - w1 = left; - w5 = width - right; - w3 = width - w1 - w2 - w4 - w5; - if (w3 < 0) - { - w3 = 0; - } - switch (params.title_alignment) - { - case ALIGN_LEFT: - tp = params.title_horizontal_offset; - break; - case ALIGN_RIGHT: - tp = w3 - logical_rect.width - params.title_horizontal_offset; - break; - case ALIGN_CENTER: - tp = (w3 >> 1) - (logical_rect.width >> 1); - break; - } - if (tp < params.title_horizontal_offset) - { - tp = params.title_horizontal_offset; - } + w1 = left; + w5 = width - right; + w3 = width - w1 - w2 - w4 - w5; + if (w3 < 0) + { + w3 = 0; + } + switch (params.title_alignment) + { + case ALIGN_LEFT: + tp = params.title_horizontal_offset; + break; + case ALIGN_RIGHT: + tp = w3 - logical_rect.width - params.title_horizontal_offset; + break; + case ALIGN_CENTER: + tp = (w3 >> 1) - (logical_rect.width >> 1); + break; + } + if (tp < params.title_horizontal_offset) + { + tp = params.title_horizontal_offset; + } } else { - w3 = logical_rect.width; - w5 = width; - if (w3 > width - w2 - w4) - { - w3 = width - w2 - w4; - } - if (w3 < 0) - { - w3 = 0; - } - switch (params.title_alignment) - { - case ALIGN_LEFT: - w1 = left + params.title_horizontal_offset; - break; - case ALIGN_RIGHT: - w1 = right - w2 - w3 - w4 - params.title_horizontal_offset; - break; - case ALIGN_CENTER: - w1 = left + ((right - left) / 2) - (w3 >> 1) - w2; - break; - } - if (w1 < left) - { - w1 = left; - } + w3 = logical_rect.width; + w5 = width; + if (w3 > width - w2 - w4) + { + w3 = width - w2 - w4; + } + if (w3 < 0) + { + w3 = 0; + } + switch (params.title_alignment) + { + case ALIGN_LEFT: + w1 = left + params.title_horizontal_offset; + break; + case ALIGN_RIGHT: + w1 = right - w2 - w3 - w4 - params.title_horizontal_offset; + break; + case ALIGN_CENTER: + w1 = left + ((right - left) / 2) - (w3 >> 1) - w2; + break; + } + if (w1 < left) + { + w1 = left; + } } myPixmapCreate (dpy, pm, width, frameTop (c)); @@ -292,64 +295,64 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, if (w1 > 0) { - fillRectangle (dpy, pm->pixmap, params.title[TITLE_1][state].pixmap, - 0, 0, w1, frameTop (c)); - fillRectangle (dpy, pm->mask, params.title[TITLE_1][state].mask, 0, 0, - w1, frameTop (c)); - x = x + w1; + fillRectangle (dpy, pm->pixmap, params.title[TITLE_1][state].pixmap, + 0, 0, w1, frameTop (c)); + fillRectangle (dpy, pm->mask, params.title[TITLE_1][state].mask, 0, 0, + w1, frameTop (c)); + x = x + w1; } fillRectangle (dpy, pm->pixmap, params.title[TITLE_2][state].pixmap, x, 0, - w2, frameTop (c)); + w2, frameTop (c)); fillRectangle (dpy, pm->mask, params.title[TITLE_2][state].mask, x, 0, w2, - frameTop (c)); + frameTop (c)); x = x + w2; if (w3 > 0) { - if (state == ACTIVE) - { - voffset = params.title_vertical_offset_active; - } - else - { - voffset = params.title_vertical_offset_inactive; - } - fillRectangle (dpy, pm->pixmap, params.title[TITLE_3][state].pixmap, - x, 0, w3, frameTop (c)); - fillRectangle (dpy, pm->mask, params.title[TITLE_3][state].mask, x, 0, - w3, frameTop (c)); - if (params.title_shadow[state]) - { - gdk_gc_get_values (params.black_gc, &values); - gdk_gc_set_values (gc, &values, GDK_GC_FOREGROUND); - gdk_draw_layout (gpixmap, gc, x + tp + 1, - (frameTop (c) + voffset - logical_rect.height) / 2 + 1, - layout); - } - gdk_gc_get_values (params.title_colors[state].gc, &values); - gdk_gc_set_values (gc, &values, GDK_GC_FOREGROUND); - gdk_draw_layout (gpixmap, gc, x + tp, - (frameTop (c) + voffset - logical_rect.height) / 2, layout); - x = x + w3; + if (state == ACTIVE) + { + voffset = params.title_vertical_offset_active; + } + else + { + voffset = params.title_vertical_offset_inactive; + } + fillRectangle (dpy, pm->pixmap, params.title[TITLE_3][state].pixmap, + x, 0, w3, frameTop (c)); + fillRectangle (dpy, pm->mask, params.title[TITLE_3][state].mask, x, 0, + w3, frameTop (c)); + if (params.title_shadow[state]) + { + gdk_gc_get_values (params.black_gc, &values); + gdk_gc_set_values (gc, &values, GDK_GC_FOREGROUND); + gdk_draw_layout (gpixmap, gc, x + tp + 1, + (frameTop (c) + voffset - logical_rect.height) / 2 + 1, + layout); + } + gdk_gc_get_values (params.title_colors[state].gc, &values); + gdk_gc_set_values (gc, &values, GDK_GC_FOREGROUND); + gdk_draw_layout (gpixmap, gc, x + tp, + (frameTop (c) + voffset - logical_rect.height) / 2, layout); + x = x + w3; } if (x > right - w4) { - x = right - w4; + x = right - w4; } fillRectangle (dpy, pm->pixmap, params.title[TITLE_4][state].pixmap, x, 0, - w4, frameTop (c)); + w4, frameTop (c)); fillRectangle (dpy, pm->mask, params.title[TITLE_4][state].mask, x, 0, w4, - frameTop (c)); + frameTop (c)); x = x + w4; if (w5 > 0) { - fillRectangle (dpy, pm->pixmap, params.title[TITLE_5][state].pixmap, - x, 0, w5, frameTop (c)); - fillRectangle (dpy, pm->mask, params.title[TITLE_5][state].mask, x, 0, - w5, frameTop (c)); + fillRectangle (dpy, pm->pixmap, params.title[TITLE_5][state].pixmap, + x, 0, w5, frameTop (c)); + fillRectangle (dpy, pm->mask, params.title[TITLE_5][state].mask, x, 0, + w5, frameTop (c)); } g_object_unref (G_OBJECT (gc)); g_object_unref (G_OBJECT (gpixmap)); @@ -365,45 +368,45 @@ getButtonFromLetter (char chr, Client * c) switch (chr) { - case 'H': - if (CLIENT_CAN_HIDE_WINDOW (c)) - { - b = HIDE_BUTTON; - } - break; - case 'C': - if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_CLOSE)) - { - b = CLOSE_BUTTON; - } - break; - case 'M': - if (CLIENT_CAN_MAXIMIZE_WINDOW (c)) - { - b = MAXIMIZE_BUTTON; - } - break; - case 'S': - b = SHADE_BUTTON; - break; - case 'T': - if (FLAG_TEST_ALL (c->flags, - CLIENT_FLAG_HAS_STICK | CLIENT_FLAG_HAS_MENU)) - { - b = STICK_BUTTON; - } - break; - case 'O': - if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_MENU)) - { - b = MENU_BUTTON; - } - break; - case '|': - b = TITLE_SEPARATOR; - break; - default: - b = -1; + case 'H': + if (CLIENT_CAN_HIDE_WINDOW (c)) + { + b = HIDE_BUTTON; + } + break; + case 'C': + if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_CLOSE)) + { + b = CLOSE_BUTTON; + } + break; + case 'M': + if (CLIENT_CAN_MAXIMIZE_WINDOW (c)) + { + b = MAXIMIZE_BUTTON; + } + break; + case 'S': + b = SHADE_BUTTON; + break; + case 'T': + if (FLAG_TEST_ALL (c->flags, + CLIENT_FLAG_HAS_STICK | CLIENT_FLAG_HAS_MENU)) + { + b = STICK_BUTTON; + } + break; + case 'O': + if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_MENU)) + { + b = MENU_BUTTON; + } + break; + case '|': + b = TITLE_SEPARATOR; + break; + default: + b = -1; } return b; } @@ -417,42 +420,42 @@ getLetterFromButton (int i, Client * c) switch (i) { - case HIDE_BUTTON: - if (CLIENT_CAN_HIDE_WINDOW (c)) - { - chr = 'H'; - } - break; - case CLOSE_BUTTON: - if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_CLOSE)) - { - chr = 'C'; - } - break; - case MAXIMIZE_BUTTON: - if (CLIENT_CAN_MAXIMIZE_WINDOW (c)) - { - chr = 'M'; - } - break; - case SHADE_BUTTON: - chr = 'S'; - break; - case STICK_BUTTON: - if (FLAG_TEST_ALL (c->flags, - CLIENT_FLAG_HAS_STICK | CLIENT_FLAG_HAS_MENU)) - { - chr = 'T'; - } - break; - case MENU_BUTTON: - if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_MENU)) - { - chr = 'O'; - } - break; - default: - chr = 0; + case HIDE_BUTTON: + if (CLIENT_CAN_HIDE_WINDOW (c)) + { + chr = 'H'; + } + break; + case CLOSE_BUTTON: + if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_CLOSE)) + { + chr = 'C'; + } + break; + case MAXIMIZE_BUTTON: + if (CLIENT_CAN_MAXIMIZE_WINDOW (c)) + { + chr = 'M'; + } + break; + case SHADE_BUTTON: + chr = 'S'; + break; + case STICK_BUTTON: + if (FLAG_TEST_ALL (c->flags, + CLIENT_FLAG_HAS_STICK | CLIENT_FLAG_HAS_MENU)) + { + chr = 'T'; + } + break; + case MENU_BUTTON: + if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_MENU)) + { + chr = 'O'; + } + break; + default: + chr = 0; } return chr; } @@ -462,32 +465,32 @@ frameGetPixmap (Client * c, int button, int state) { switch (button) { - case SHADE_BUTTON: - if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) - && params.buttons[SHADE_BUTTON][state + 3].pixmap) - { - return ¶ms.buttons[SHADE_BUTTON][state + 3]; - } - return ¶ms.buttons[SHADE_BUTTON][state]; - break; - case STICK_BUTTON: - if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY) - && params.buttons[STICK_BUTTON][state + 3].pixmap) - { - return ¶ms.buttons[STICK_BUTTON][state + 3]; - } - return ¶ms.buttons[STICK_BUTTON][state]; - break; - case MAXIMIZE_BUTTON: - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED) - && params.buttons[MAXIMIZE_BUTTON][state + 3].pixmap) - { - return ¶ms.buttons[MAXIMIZE_BUTTON][state + 3]; - } - return ¶ms.buttons[MAXIMIZE_BUTTON][state]; - break; - default: - break; + case SHADE_BUTTON: + if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) + && params.buttons[SHADE_BUTTON][state + 3].pixmap) + { + return ¶ms.buttons[SHADE_BUTTON][state + 3]; + } + return ¶ms.buttons[SHADE_BUTTON][state]; + break; + case STICK_BUTTON: + if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY) + && params.buttons[STICK_BUTTON][state + 3].pixmap) + { + return ¶ms.buttons[STICK_BUTTON][state + 3]; + } + return ¶ms.buttons[STICK_BUTTON][state]; + break; + case MAXIMIZE_BUTTON: + if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED) + && params.buttons[MAXIMIZE_BUTTON][state + 3].pixmap) + { + return ¶ms.buttons[MAXIMIZE_BUTTON][state + 3]; + } + return ¶ms.buttons[MAXIMIZE_BUTTON][state]; + break; + default: + break; } return ¶ms.buttons[button][state]; } @@ -507,169 +510,169 @@ frameSetShape (Client * c, int state, ClientPixmapCache * pm_cache, if (!shape) { - return; + return; } temp = - XCreateSimpleWindow (dpy, root, 0, 0, frameWidth (c), frameHeight (c), - 0, 0, 0); + XCreateSimpleWindow (dpy, root, 0, 0, frameWidth (c), frameHeight (c), + 0, 0, 0); if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) { - rect.x = 0; - rect.y = 0; - rect.width = frameWidth (c); - rect.height = frameHeight (c); - XShapeCombineRectangles (dpy, temp, ShapeBounding, 0, 0, &rect, 1, - ShapeSubtract, 0); + rect.x = 0; + rect.y = 0; + rect.width = frameWidth (c); + rect.height = frameHeight (c); + XShapeCombineRectangles (dpy, temp, ShapeBounding, 0, 0, &rect, 1, + ShapeSubtract, 0); } else { - XShapeCombineShape (dpy, temp, ShapeBounding, frameLeft (c), - frameTop (c), c->window, ShapeBounding, ShapeSet); + XShapeCombineShape (dpy, temp, ShapeBounding, frameLeft (c), + frameTop (c), c->window, ShapeBounding, ShapeSet); } if (pm_cache) { - XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->title), ShapeBounding, 0, - 0, pm_cache->pm_title[state].mask, ShapeSet); - if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) - { - XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->sides[SIDE_LEFT]), - ShapeBounding, 0, 0, - pm_cache->pm_sides[SIDE_LEFT][state].mask, ShapeSet); - XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->sides[SIDE_RIGHT]), - ShapeBounding, 0, 0, - pm_cache->pm_sides[SIDE_RIGHT][state].mask, ShapeSet); - } - XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->sides[SIDE_BOTTOM]), - ShapeBounding, 0, 0, pm_cache->pm_sides[SIDE_BOTTOM][state].mask, - ShapeSet); - XShapeCombineMask (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), ShapeBounding, - 0, 0, params.corners[CORNER_BOTTOM_LEFT][state].mask, ShapeSet); - XShapeCombineMask (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), ShapeBounding, - 0, 0, params.corners[CORNER_BOTTOM_RIGHT][state].mask, ShapeSet); - XShapeCombineMask (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), ShapeBounding, 0, - 0, params.corners[CORNER_TOP_LEFT][state].mask, ShapeSet); - XShapeCombineMask (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), ShapeBounding, 0, - 0, params.corners[CORNER_TOP_RIGHT][state].mask, ShapeSet); - - for (i = 0; i < BUTTON_COUNT; i++) - { - my_pixmap = - frameGetPixmap (c, i, c->button_pressed[i] ? PRESSED : state); - XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->buttons[i]), - ShapeBounding, 0, 0, my_pixmap->mask, ShapeSet); - } - - if (params.corners[CORNER_TOP_LEFT][ACTIVE].height > - frameHeight (c) - frameBottom (c) + 1) - { - rect.x = 0; - rect.y = frameHeight (c) - frameBottom (c) + 1; - rect.width = params.corners[CORNER_TOP_LEFT][ACTIVE].width; - rect.height = - params.corners[CORNER_TOP_LEFT][ACTIVE].height - - (frameHeight (c) - frameBottom (c) + 1); - XShapeCombineRectangles (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), ShapeBounding, - 0, 0, &rect, 1, ShapeSubtract, 0); - } - if (params.corners[CORNER_TOP_RIGHT][ACTIVE].height > - frameHeight (c) - frameBottom (c) + 1) - { - rect.x = 0; - rect.y = frameHeight (c) - frameBottom (c) + 1; - rect.width = params.corners[CORNER_TOP_RIGHT][ACTIVE].width; - rect.height = - params.corners[CORNER_TOP_RIGHT][ACTIVE].height - - (frameHeight (c) - frameBottom (c) + 1); - XShapeCombineRectangles (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), - ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, 0); - } - if (params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height > - frameHeight (c) - frameTop (c) + 1) - { - rect.x = 0; - rect.y = 0; - rect.width = params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width; - rect.height = - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height - - (frameHeight (c) - frameTop (c) + 1); - XShapeCombineRectangles (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), - ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, 0); - } - if (params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height > - frameHeight (c) - frameTop (c) + 1) - { - rect.x = 0; - rect.y = 0; - rect.width = params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width; - rect.height = - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height - - (frameHeight (c) - frameTop (c) + 1); - XShapeCombineRectangles (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), - ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, 0); - } - - if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) - { - XShapeCombineShape (dpy, temp, ShapeBounding, 0, frameTop (c), - MYWINDOW_XWINDOW (c->sides[SIDE_LEFT]), ShapeBounding, - ShapeUnion); - XShapeCombineShape (dpy, temp, ShapeBounding, - frameWidth (c) - frameRight (c), frameTop (c), - MYWINDOW_XWINDOW (c->sides[SIDE_RIGHT]), ShapeBounding, - ShapeUnion); - } - XShapeCombineShape (dpy, temp, ShapeBounding, - params.corners[CORNER_TOP_LEFT][ACTIVE].width, 0, - MYWINDOW_XWINDOW (c->title), ShapeBounding, ShapeUnion); - XShapeCombineShape (dpy, temp, ShapeBounding, - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width, - frameHeight (c) - frameBottom (c), - MYWINDOW_XWINDOW (c->sides[SIDE_BOTTOM]), ShapeBounding, - ShapeUnion); - XShapeCombineShape (dpy, temp, ShapeBounding, 0, - frameHeight (c) - - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height, - MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), ShapeBounding, - ShapeUnion); - XShapeCombineShape (dpy, temp, ShapeBounding, - frameWidth (c) - - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width, - frameHeight (c) - - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height, - MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), ShapeBounding, - ShapeUnion); - XShapeCombineShape (dpy, temp, ShapeBounding, 0, 0, - MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), ShapeBounding, - ShapeUnion); - XShapeCombineShape (dpy, temp, ShapeBounding, - frameWidth (c) - params.corners[CORNER_TOP_RIGHT][ACTIVE].width, - 0, MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), ShapeBounding, - ShapeUnion); - - for (i = 0; i < BUTTON_COUNT; i++) - { - char b = getLetterFromButton (i, c); - if ((b) && strchr (params.button_layout, b)) - { - XShapeCombineShape (dpy, temp, ShapeBounding, button_x[i], - (frameTop (c) - params.buttons[i][ACTIVE].height) / 2, - MYWINDOW_XWINDOW (c->buttons[i]), ShapeBounding, - ShapeUnion); - } - } + XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->title), ShapeBounding, 0, + 0, pm_cache->pm_title[state].mask, ShapeSet); + if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) + { + XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->sides[SIDE_LEFT]), + ShapeBounding, 0, 0, + pm_cache->pm_sides[SIDE_LEFT][state].mask, ShapeSet); + XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->sides[SIDE_RIGHT]), + ShapeBounding, 0, 0, + pm_cache->pm_sides[SIDE_RIGHT][state].mask, ShapeSet); + } + XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->sides[SIDE_BOTTOM]), + ShapeBounding, 0, 0, pm_cache->pm_sides[SIDE_BOTTOM][state].mask, + ShapeSet); + XShapeCombineMask (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), ShapeBounding, + 0, 0, params.corners[CORNER_BOTTOM_LEFT][state].mask, ShapeSet); + XShapeCombineMask (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), ShapeBounding, + 0, 0, params.corners[CORNER_BOTTOM_RIGHT][state].mask, ShapeSet); + XShapeCombineMask (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), ShapeBounding, 0, + 0, params.corners[CORNER_TOP_LEFT][state].mask, ShapeSet); + XShapeCombineMask (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), ShapeBounding, 0, + 0, params.corners[CORNER_TOP_RIGHT][state].mask, ShapeSet); + + for (i = 0; i < BUTTON_COUNT; i++) + { + my_pixmap = + frameGetPixmap (c, i, c->button_pressed[i] ? PRESSED : state); + XShapeCombineMask (dpy, MYWINDOW_XWINDOW (c->buttons[i]), + ShapeBounding, 0, 0, my_pixmap->mask, ShapeSet); + } + + if (params.corners[CORNER_TOP_LEFT][ACTIVE].height > + frameHeight (c) - frameBottom (c) + 1) + { + rect.x = 0; + rect.y = frameHeight (c) - frameBottom (c) + 1; + rect.width = params.corners[CORNER_TOP_LEFT][ACTIVE].width; + rect.height = + params.corners[CORNER_TOP_LEFT][ACTIVE].height - + (frameHeight (c) - frameBottom (c) + 1); + XShapeCombineRectangles (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), ShapeBounding, + 0, 0, &rect, 1, ShapeSubtract, 0); + } + if (params.corners[CORNER_TOP_RIGHT][ACTIVE].height > + frameHeight (c) - frameBottom (c) + 1) + { + rect.x = 0; + rect.y = frameHeight (c) - frameBottom (c) + 1; + rect.width = params.corners[CORNER_TOP_RIGHT][ACTIVE].width; + rect.height = + params.corners[CORNER_TOP_RIGHT][ACTIVE].height - + (frameHeight (c) - frameBottom (c) + 1); + XShapeCombineRectangles (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), + ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, 0); + } + if (params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height > + frameHeight (c) - frameTop (c) + 1) + { + rect.x = 0; + rect.y = 0; + rect.width = params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width; + rect.height = + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height - + (frameHeight (c) - frameTop (c) + 1); + XShapeCombineRectangles (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), + ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, 0); + } + if (params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height > + frameHeight (c) - frameTop (c) + 1) + { + rect.x = 0; + rect.y = 0; + rect.width = params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width; + rect.height = + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height - + (frameHeight (c) - frameTop (c) + 1); + XShapeCombineRectangles (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), + ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, 0); + } + + if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) + { + XShapeCombineShape (dpy, temp, ShapeBounding, 0, frameTop (c), + MYWINDOW_XWINDOW (c->sides[SIDE_LEFT]), ShapeBounding, + ShapeUnion); + XShapeCombineShape (dpy, temp, ShapeBounding, + frameWidth (c) - frameRight (c), frameTop (c), + MYWINDOW_XWINDOW (c->sides[SIDE_RIGHT]), ShapeBounding, + ShapeUnion); + } + XShapeCombineShape (dpy, temp, ShapeBounding, + params.corners[CORNER_TOP_LEFT][ACTIVE].width, 0, + MYWINDOW_XWINDOW (c->title), ShapeBounding, ShapeUnion); + XShapeCombineShape (dpy, temp, ShapeBounding, + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width, + frameHeight (c) - frameBottom (c), + MYWINDOW_XWINDOW (c->sides[SIDE_BOTTOM]), ShapeBounding, + ShapeUnion); + XShapeCombineShape (dpy, temp, ShapeBounding, 0, + frameHeight (c) - + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height, + MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), ShapeBounding, + ShapeUnion); + XShapeCombineShape (dpy, temp, ShapeBounding, + frameWidth (c) - + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width, + frameHeight (c) - + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height, + MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), ShapeBounding, + ShapeUnion); + XShapeCombineShape (dpy, temp, ShapeBounding, 0, 0, + MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), ShapeBounding, + ShapeUnion); + XShapeCombineShape (dpy, temp, ShapeBounding, + frameWidth (c) - params.corners[CORNER_TOP_RIGHT][ACTIVE].width, + 0, MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), ShapeBounding, + ShapeUnion); + + for (i = 0; i < BUTTON_COUNT; i++) + { + char b = getLetterFromButton (i, c); + if ((b) && strchr (params.button_layout, b)) + { + XShapeCombineShape (dpy, temp, ShapeBounding, button_x[i], + (frameTop (c) - params.buttons[i][ACTIVE].height) / 2, + MYWINDOW_XWINDOW (c->buttons[i]), ShapeBounding, + ShapeUnion); + } + } } XShapeCombineShape (dpy, c->frame, ShapeBounding, 0, 0, temp, - ShapeBounding, ShapeSet); + ShapeBounding, ShapeSet); XDestroyWindow (dpy, temp); } @@ -698,295 +701,295 @@ frameDraw (Client * c, gboolean invalidate_cache, gboolean force_shape_update) if (c != clientGetFocus ()) { - TRACE ("\"%s\" is not the active window", c->name); - state = INACTIVE; + TRACE ("\"%s\" is not the active window", c->name); + state = INACTIVE; } if ((state == INACTIVE) && ((c->draw_active) || (c->first_map))) { - requires_clearing = TRUE; - c->draw_active = FALSE; + requires_clearing = TRUE; + c->draw_active = FALSE; } else if ((state == ACTIVE) && (!(c->draw_active) || (c->first_map))) { - requires_clearing = TRUE; - c->draw_active = TRUE; + requires_clearing = TRUE; + c->draw_active = TRUE; } /* Flag clearance */ if (c->first_map) { - c->first_map = FALSE; + c->first_map = FALSE; } if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_HAS_BORDER, - CLIENT_FLAG_FULLSCREEN)) - { - /* Cache mgmt */ - if (invalidate_cache) - { - clientClearPixmapCache (c); - requires_clearing = TRUE; - } - else - { - if (c->pm_cache.previous_width != c->width) - { - myPixmapFree (dpy, &c->pm_cache.pm_title[ACTIVE]); - myPixmapFree (dpy, &c->pm_cache.pm_title[INACTIVE]); - myPixmapFree (dpy, - &c->pm_cache.pm_sides[SIDE_BOTTOM][ACTIVE]); - myPixmapFree (dpy, - &c->pm_cache.pm_sides[SIDE_BOTTOM][INACTIVE]); - c->pm_cache.previous_width = c->width; - requires_clearing = TRUE; - } - if (c->pm_cache.previous_height != c->height) - { - myPixmapFree (dpy, &c->pm_cache.pm_sides[SIDE_LEFT][ACTIVE]); - myPixmapFree (dpy, - &c->pm_cache.pm_sides[SIDE_LEFT][INACTIVE]); - myPixmapFree (dpy, &c->pm_cache.pm_sides[SIDE_RIGHT][ACTIVE]); - myPixmapFree (dpy, - &c->pm_cache.pm_sides[SIDE_RIGHT][INACTIVE]); - c->pm_cache.previous_height = c->height; - requires_clearing = TRUE; - } - } - - /* First, hide the buttons that we don't have... */ - for (i = 0; i < BUTTON_COUNT; i++) - { - char b = getLetterFromButton (i, c); - if ((!b) || !strchr (params.button_layout, b)) - { - myWindowHide (&c->buttons[i]); - } - } - - /* Then, show the ones that we do have on right... */ - x = frameLeft (c) + params.button_offset; - for (i = 0; i < strlen (params.button_layout); i++) - { - button = getButtonFromLetter (params.button_layout[i], c); - if (button == TITLE_SEPARATOR) - { - break; - } - else if (button >= 0) - { - my_pixmap = - frameGetPixmap (c, button, - c->button_pressed[button] ? PRESSED : state); - if (my_pixmap->pixmap) - { - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->buttons[button]), - my_pixmap->pixmap); - } - myWindowShow (&c->buttons[button], x, - (frameTop (c) - - params.buttons[button][ACTIVE].height) / 2, - params.buttons[button][ACTIVE].width, - params.buttons[button][ACTIVE].height, TRUE); - button_x[button] = x; - x = x + params.buttons[button][ACTIVE].width + - params.button_spacing; - } - } - left = x - params.button_spacing; - - /* and those that we do have on left... */ - x = frameWidth (c) - frameRight (c) + params.button_spacing - - params.button_offset; - for (j = strlen (params.button_layout) - 1; j >= i; j--) - { - button = getButtonFromLetter (params.button_layout[j], c); - if (button == TITLE_SEPARATOR) - { - break; - } - else if (button >= 0) - { - my_pixmap = - frameGetPixmap (c, button, - c->button_pressed[button] ? PRESSED : state); - if (my_pixmap->pixmap) - { - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->buttons[button]), - my_pixmap->pixmap); - } - x = x - params.buttons[button][ACTIVE].width - - params.button_spacing; - myWindowShow (&c->buttons[button], x, - (frameTop (c) - - params.buttons[button][ACTIVE].height) / 2, - params.buttons[button][ACTIVE].width, - params.buttons[button][ACTIVE].height, TRUE); - button_x[button] = x; - } - } - right = x; - - top_width = - frameWidth (c) - params.corners[CORNER_TOP_LEFT][ACTIVE].width - - params.corners[CORNER_TOP_RIGHT][ACTIVE].width; - bottom_width = - frameWidth (c) - - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width - - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width; - left_height = - frameHeight (c) - frameTop (c) - - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height; - right_height = - frameHeight (c) - frameTop (c) - - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height; - - if (c->pm_cache.pm_title[state].pixmap == None) - { - frameCreateTitlePixmap (c, state, left, right, - &c->pm_cache.pm_title[state]); - requires_clearing = TRUE; - } - - if (c->pm_cache.pm_sides[SIDE_LEFT][state].pixmap == None) - { - myPixmapCreate (dpy, &c->pm_cache.pm_sides[SIDE_LEFT][state], - frameLeft (c), left_height); - requires_clearing = TRUE; - } - fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_LEFT][state].pixmap, - params.sides[SIDE_LEFT][state].pixmap, 0, 0, frameLeft (c), - left_height); - fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_LEFT][state].mask, - params.sides[SIDE_LEFT][state].mask, 0, 0, frameLeft (c), - left_height); - - if (c->pm_cache.pm_sides[SIDE_RIGHT][state].pixmap == None) - { - myPixmapCreate (dpy, &c->pm_cache.pm_sides[SIDE_RIGHT][state], - frameRight (c), right_height); - requires_clearing = TRUE; - } - fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_RIGHT][state].pixmap, - params.sides[SIDE_RIGHT][state].pixmap, 0, 0, frameRight (c), - right_height); - fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_RIGHT][state].mask, - params.sides[SIDE_RIGHT][state].mask, 0, 0, frameRight (c), - right_height); - - if (c->pm_cache.pm_sides[SIDE_BOTTOM][state].pixmap == None) - { - myPixmapCreate (dpy, &c->pm_cache.pm_sides[SIDE_BOTTOM][state], - bottom_width, frameBottom (c)); - requires_clearing = TRUE; - } - fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_BOTTOM][state].pixmap, - params.sides[SIDE_BOTTOM][state].pixmap, 0, 0, bottom_width, - frameBottom (c)); - fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_BOTTOM][state].mask, - params.sides[SIDE_BOTTOM][state].mask, 0, 0, bottom_width, - frameBottom (c)); - - XSetWindowBackgroundPixmap (dpy, MYWINDOW_XWINDOW (c->title), - c->pm_cache.pm_title[state].pixmap); - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->sides[SIDE_LEFT]), - c->pm_cache.pm_sides[SIDE_LEFT][state].pixmap); - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->sides[SIDE_RIGHT]), - c->pm_cache.pm_sides[SIDE_RIGHT][state].pixmap); - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->sides[SIDE_BOTTOM]), - c->pm_cache.pm_sides[SIDE_BOTTOM][state].pixmap); - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), - params.corners[CORNER_TOP_LEFT][state].pixmap); - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), - params.corners[CORNER_TOP_RIGHT][state].pixmap); - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), - params.corners[CORNER_BOTTOM_LEFT][state].pixmap); - XSetWindowBackgroundPixmap (dpy, - MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), - params.corners[CORNER_BOTTOM_RIGHT][state].pixmap); - - if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) - { - myWindowHide (&c->sides[SIDE_LEFT]); - myWindowHide (&c->sides[SIDE_RIGHT]); - } - else - { - myWindowShow (&c->sides[SIDE_LEFT], 0, frameTop (c), - frameLeft (c), left_height, requires_clearing); - myWindowShow (&c->sides[SIDE_RIGHT], - frameWidth (c) - frameRight (c), frameTop (c), frameRight (c), - right_height, requires_clearing); - } - - myWindowShow (&c->title, - params.corners[CORNER_TOP_LEFT][ACTIVE].width, 0, top_width, - frameTop (c), requires_clearing); - myWindowShow (&c->sides[SIDE_BOTTOM], - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width, - frameHeight (c) - frameBottom (c), bottom_width, frameBottom (c), - requires_clearing); - - myWindowShow (&c->corners[CORNER_TOP_LEFT], 0, 0, - params.corners[CORNER_TOP_LEFT][ACTIVE].width, - params.corners[CORNER_TOP_LEFT][ACTIVE].height, - requires_clearing); - myWindowShow (&c->corners[CORNER_TOP_RIGHT], - frameWidth (c) - params.corners[CORNER_TOP_RIGHT][ACTIVE].width, - 0, params.corners[CORNER_TOP_RIGHT][ACTIVE].width, - params.corners[CORNER_TOP_RIGHT][ACTIVE].height, - requires_clearing); - myWindowShow (&c->corners[CORNER_BOTTOM_LEFT], 0, - frameHeight (c) - - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height, - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width, - params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height, - requires_clearing); - myWindowShow (&c->corners[CORNER_BOTTOM_RIGHT], - frameWidth (c) - - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width, - frameHeight (c) - - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height, - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width, - params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height, - requires_clearing); - - if (requires_clearing | force_shape_update) - { - frameSetShape (c, state, &c->pm_cache, button_x); - } + CLIENT_FLAG_FULLSCREEN)) + { + /* Cache mgmt */ + if (invalidate_cache) + { + clientClearPixmapCache (c); + requires_clearing = TRUE; + } + else + { + if (c->pm_cache.previous_width != c->width) + { + myPixmapFree (dpy, &c->pm_cache.pm_title[ACTIVE]); + myPixmapFree (dpy, &c->pm_cache.pm_title[INACTIVE]); + myPixmapFree (dpy, + &c->pm_cache.pm_sides[SIDE_BOTTOM][ACTIVE]); + myPixmapFree (dpy, + &c->pm_cache.pm_sides[SIDE_BOTTOM][INACTIVE]); + c->pm_cache.previous_width = c->width; + requires_clearing = TRUE; + } + if (c->pm_cache.previous_height != c->height) + { + myPixmapFree (dpy, &c->pm_cache.pm_sides[SIDE_LEFT][ACTIVE]); + myPixmapFree (dpy, + &c->pm_cache.pm_sides[SIDE_LEFT][INACTIVE]); + myPixmapFree (dpy, &c->pm_cache.pm_sides[SIDE_RIGHT][ACTIVE]); + myPixmapFree (dpy, + &c->pm_cache.pm_sides[SIDE_RIGHT][INACTIVE]); + c->pm_cache.previous_height = c->height; + requires_clearing = TRUE; + } + } + + /* First, hide the buttons that we don't have... */ + for (i = 0; i < BUTTON_COUNT; i++) + { + char b = getLetterFromButton (i, c); + if ((!b) || !strchr (params.button_layout, b)) + { + myWindowHide (&c->buttons[i]); + } + } + + /* Then, show the ones that we do have on right... */ + x = frameLeft (c) + params.button_offset; + for (i = 0; i < strlen (params.button_layout); i++) + { + button = getButtonFromLetter (params.button_layout[i], c); + if (button == TITLE_SEPARATOR) + { + break; + } + else if (button >= 0) + { + my_pixmap = + frameGetPixmap (c, button, + c->button_pressed[button] ? PRESSED : state); + if (my_pixmap->pixmap) + { + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->buttons[button]), + my_pixmap->pixmap); + } + myWindowShow (&c->buttons[button], x, + (frameTop (c) - + params.buttons[button][ACTIVE].height) / 2, + params.buttons[button][ACTIVE].width, + params.buttons[button][ACTIVE].height, TRUE); + button_x[button] = x; + x = x + params.buttons[button][ACTIVE].width + + params.button_spacing; + } + } + left = x - params.button_spacing; + + /* and those that we do have on left... */ + x = frameWidth (c) - frameRight (c) + params.button_spacing - + params.button_offset; + for (j = strlen (params.button_layout) - 1; j >= i; j--) + { + button = getButtonFromLetter (params.button_layout[j], c); + if (button == TITLE_SEPARATOR) + { + break; + } + else if (button >= 0) + { + my_pixmap = + frameGetPixmap (c, button, + c->button_pressed[button] ? PRESSED : state); + if (my_pixmap->pixmap) + { + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->buttons[button]), + my_pixmap->pixmap); + } + x = x - params.buttons[button][ACTIVE].width - + params.button_spacing; + myWindowShow (&c->buttons[button], x, + (frameTop (c) - + params.buttons[button][ACTIVE].height) / 2, + params.buttons[button][ACTIVE].width, + params.buttons[button][ACTIVE].height, TRUE); + button_x[button] = x; + } + } + right = x; + + top_width = + frameWidth (c) - params.corners[CORNER_TOP_LEFT][ACTIVE].width - + params.corners[CORNER_TOP_RIGHT][ACTIVE].width; + bottom_width = + frameWidth (c) - + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width - + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width; + left_height = + frameHeight (c) - frameTop (c) - + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height; + right_height = + frameHeight (c) - frameTop (c) - + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height; + + if (c->pm_cache.pm_title[state].pixmap == None) + { + frameCreateTitlePixmap (c, state, left, right, + &c->pm_cache.pm_title[state]); + requires_clearing = TRUE; + } + + if (c->pm_cache.pm_sides[SIDE_LEFT][state].pixmap == None) + { + myPixmapCreate (dpy, &c->pm_cache.pm_sides[SIDE_LEFT][state], + frameLeft (c), left_height); + requires_clearing = TRUE; + } + fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_LEFT][state].pixmap, + params.sides[SIDE_LEFT][state].pixmap, 0, 0, frameLeft (c), + left_height); + fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_LEFT][state].mask, + params.sides[SIDE_LEFT][state].mask, 0, 0, frameLeft (c), + left_height); + + if (c->pm_cache.pm_sides[SIDE_RIGHT][state].pixmap == None) + { + myPixmapCreate (dpy, &c->pm_cache.pm_sides[SIDE_RIGHT][state], + frameRight (c), right_height); + requires_clearing = TRUE; + } + fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_RIGHT][state].pixmap, + params.sides[SIDE_RIGHT][state].pixmap, 0, 0, frameRight (c), + right_height); + fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_RIGHT][state].mask, + params.sides[SIDE_RIGHT][state].mask, 0, 0, frameRight (c), + right_height); + + if (c->pm_cache.pm_sides[SIDE_BOTTOM][state].pixmap == None) + { + myPixmapCreate (dpy, &c->pm_cache.pm_sides[SIDE_BOTTOM][state], + bottom_width, frameBottom (c)); + requires_clearing = TRUE; + } + fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_BOTTOM][state].pixmap, + params.sides[SIDE_BOTTOM][state].pixmap, 0, 0, bottom_width, + frameBottom (c)); + fillRectangle (dpy, c->pm_cache.pm_sides[SIDE_BOTTOM][state].mask, + params.sides[SIDE_BOTTOM][state].mask, 0, 0, bottom_width, + frameBottom (c)); + + XSetWindowBackgroundPixmap (dpy, MYWINDOW_XWINDOW (c->title), + c->pm_cache.pm_title[state].pixmap); + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->sides[SIDE_LEFT]), + c->pm_cache.pm_sides[SIDE_LEFT][state].pixmap); + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->sides[SIDE_RIGHT]), + c->pm_cache.pm_sides[SIDE_RIGHT][state].pixmap); + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->sides[SIDE_BOTTOM]), + c->pm_cache.pm_sides[SIDE_BOTTOM][state].pixmap); + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_TOP_LEFT]), + params.corners[CORNER_TOP_LEFT][state].pixmap); + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_TOP_RIGHT]), + params.corners[CORNER_TOP_RIGHT][state].pixmap); + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_LEFT]), + params.corners[CORNER_BOTTOM_LEFT][state].pixmap); + XSetWindowBackgroundPixmap (dpy, + MYWINDOW_XWINDOW (c->corners[CORNER_BOTTOM_RIGHT]), + params.corners[CORNER_BOTTOM_RIGHT][state].pixmap); + + if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) + { + myWindowHide (&c->sides[SIDE_LEFT]); + myWindowHide (&c->sides[SIDE_RIGHT]); + } + else + { + myWindowShow (&c->sides[SIDE_LEFT], 0, frameTop (c), + frameLeft (c), left_height, requires_clearing); + myWindowShow (&c->sides[SIDE_RIGHT], + frameWidth (c) - frameRight (c), frameTop (c), frameRight (c), + right_height, requires_clearing); + } + + myWindowShow (&c->title, + params.corners[CORNER_TOP_LEFT][ACTIVE].width, 0, top_width, + frameTop (c), requires_clearing); + myWindowShow (&c->sides[SIDE_BOTTOM], + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width, + frameHeight (c) - frameBottom (c), bottom_width, frameBottom (c), + requires_clearing); + + myWindowShow (&c->corners[CORNER_TOP_LEFT], 0, 0, + params.corners[CORNER_TOP_LEFT][ACTIVE].width, + params.corners[CORNER_TOP_LEFT][ACTIVE].height, + requires_clearing); + myWindowShow (&c->corners[CORNER_TOP_RIGHT], + frameWidth (c) - params.corners[CORNER_TOP_RIGHT][ACTIVE].width, + 0, params.corners[CORNER_TOP_RIGHT][ACTIVE].width, + params.corners[CORNER_TOP_RIGHT][ACTIVE].height, + requires_clearing); + myWindowShow (&c->corners[CORNER_BOTTOM_LEFT], 0, + frameHeight (c) - + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height, + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].width, + params.corners[CORNER_BOTTOM_LEFT][ACTIVE].height, + requires_clearing); + myWindowShow (&c->corners[CORNER_BOTTOM_RIGHT], + frameWidth (c) - + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width, + frameHeight (c) - + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height, + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].width, + params.corners[CORNER_BOTTOM_RIGHT][ACTIVE].height, + requires_clearing); + + if (requires_clearing | force_shape_update) + { + frameSetShape (c, state, &c->pm_cache, button_x); + } } else { - myWindowHide (&c->title); - for (i = 0; i < 3; i++) - { - if (MYWINDOW_XWINDOW (c->sides[i])) - { - myWindowHide (&c->sides[i]); - } - } - for (i = 0; i < 4; i++) - { - if (MYWINDOW_XWINDOW (c->corners[i])) - { - myWindowHide (&c->corners[i]); - } - } - for (i = 0; i < BUTTON_COUNT; i++) - { - if (MYWINDOW_XWINDOW (c->buttons[i])) - { - myWindowHide (&c->buttons[i]); - } - } - frameSetShape (c, 0, NULL, 0); + myWindowHide (&c->title); + for (i = 0; i < 3; i++) + { + if (MYWINDOW_XWINDOW (c->sides[i])) + { + myWindowHide (&c->sides[i]); + } + } + for (i = 0; i < 4; i++) + { + if (MYWINDOW_XWINDOW (c->corners[i])) + { + myWindowHide (&c->corners[i]); + } + } + for (i = 0; i < BUTTON_COUNT; i++) + { + if (MYWINDOW_XWINDOW (c->buttons[i])) + { + myWindowHide (&c->buttons[i]); + } + } + frameSetShape (c, 0, NULL, 0); } } diff --git a/src/frame.h b/src/frame.h index aa5579095..7a64a62f9 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/hints.c b/src/hints.c index ba950504b..516f561ab 100644 --- a/src/hints.c +++ b/src/hints.c @@ -23,27 +23,21 @@ #include #endif -#ifdef GDK_MULTIHEAD_SAFE -#undef GDK_MULTIHEAD_SAFE -#endif - -#include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include #include "main.h" #include "hints.h" @@ -652,10 +646,10 @@ setNetWorkarea (Display * dpy, int screen, int nb_workspaces, int * m) *ptr++ = (unsigned long) m[LEFT]; *ptr++ = (unsigned long) m[TOP]; *ptr++ = (unsigned long) - (MyDisplayFullWidth (dpy, screen) - + (gdk_screen_get_width (gscr) - (m[LEFT] + m[RIGHT])); *ptr++ = (unsigned long) - (MyDisplayFullHeight (dpy, screen) - + (gdk_screen_get_height (gscr) - (m[TOP] + m[BOTTOM])); } XChangeProperty (dpy, RootWindow (dpy, screen), net_workarea, XA_CARDINAL, @@ -668,8 +662,8 @@ initNetDesktopParams (Display * dpy, int screen, int workspace) { unsigned long data[2]; TRACE ("entering initNetDesktopParams"); - data[0] = MyDisplayFullWidth (dpy, screen); - data[1] = MyDisplayFullHeight (dpy, screen); + data[0] = gdk_screen_get_width (gscr); + data[1] = gdk_screen_get_height (gscr); XChangeProperty (dpy, RootWindow (dpy, screen), net_desktop_geometry, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) data, 2); data[0] = 0; diff --git a/src/hints.h b/src/hints.h index d25ca4286..5ad466fc0 100644 --- a/src/hints.h +++ b/src/hints.h @@ -1,21 +1,21 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - Metacity - (c) 2001 Havoc Pennington - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + Metacity - (c) 2001 Havoc Pennington + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/keyboard.c b/src/keyboard.c index 6ef749d8a..1e809eec6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ @@ -23,11 +23,11 @@ #endif #include -#include +#include #include #include #include -#include +#include #include "keyboard.h" unsigned int KeyMask; @@ -58,48 +58,48 @@ parseKeyString (Display * dpy, MyKey * key, char *str) if (!g_ascii_strcasecmp (str, "none")) { - return; + return; } k = strrchr (str, '+'); if (k) { - /* There is a modifier */ - gchar *tmp; - - tmp = g_ascii_strdown ((gchar *) str, -1); - - key->keycode = XKeysymToKeycode (dpy, XStringToKeysym (++k)); - if (strstr (tmp, "shift")) - { - key->modifier = key->modifier | ShiftMask; - } - if (strstr (tmp, "control")) - { - key->modifier = key->modifier | ControlMask; - } - if (strstr (tmp, "alt") || strstr (tmp, "mod1")) - { - key->modifier = key->modifier | AltMask; - } - if (strstr (tmp, "meta") || strstr (tmp, "mod2")) - { - key->modifier = key->modifier | MetaMask; - } - if (strstr (tmp, "hyper")) - { - key->modifier = key->modifier | HyperMask; - } - if (strstr (tmp, "super")) - { - key->modifier = key->modifier | SuperMask; - } - g_free (tmp); + /* There is a modifier */ + gchar *tmp; + + tmp = g_ascii_strdown ((gchar *) str, -1); + + key->keycode = XKeysymToKeycode (dpy, XStringToKeysym (++k)); + if (strstr (tmp, "shift")) + { + key->modifier = key->modifier | ShiftMask; + } + if (strstr (tmp, "control")) + { + key->modifier = key->modifier | ControlMask; + } + if (strstr (tmp, "alt") || strstr (tmp, "mod1")) + { + key->modifier = key->modifier | AltMask; + } + if (strstr (tmp, "meta") || strstr (tmp, "mod2")) + { + key->modifier = key->modifier | MetaMask; + } + if (strstr (tmp, "hyper")) + { + key->modifier = key->modifier | HyperMask; + } + if (strstr (tmp, "super")) + { + key->modifier = key->modifier | SuperMask; + } + g_free (tmp); } else { - key->keycode = XKeysymToKeycode (dpy, XStringToKeysym (str)); - key->modifier = 0; + key->keycode = XKeysymToKeycode (dpy, XStringToKeysym (str)); + key->modifier = 0; } } @@ -110,35 +110,35 @@ grabKey (Display * dpy, MyKey * key, Window w) if (key->keycode) { - if (key->modifier == 0) - { - XGrabKey (dpy, key->keycode, AnyModifier, w, FALSE, - GrabModeAsync, GrabModeAsync); - } - else - { - /* Here we grab all combinations of well known modifiers */ - XGrabKey (dpy, key->keycode, key->modifier, w, FALSE, - GrabModeAsync, GrabModeAsync); - XGrabKey (dpy, key->keycode, key->modifier | ScrollLockMask, w, - FALSE, GrabModeAsync, GrabModeAsync); - XGrabKey (dpy, key->keycode, key->modifier | NumLockMask, w, - FALSE, GrabModeAsync, GrabModeAsync); - XGrabKey (dpy, key->keycode, key->modifier | CapsLockMask, w, - FALSE, GrabModeAsync, GrabModeAsync); - XGrabKey (dpy, key->keycode, - key->modifier | ScrollLockMask | NumLockMask, w, FALSE, - GrabModeAsync, GrabModeAsync); - XGrabKey (dpy, key->keycode, - key->modifier | ScrollLockMask | CapsLockMask, w, FALSE, - GrabModeAsync, GrabModeAsync); - XGrabKey (dpy, key->keycode, - key->modifier | CapsLockMask | NumLockMask, w, FALSE, - GrabModeAsync, GrabModeAsync); - XGrabKey (dpy, key->keycode, - key->modifier | ScrollLockMask | CapsLockMask | NumLockMask, - w, FALSE, GrabModeAsync, GrabModeAsync); - } + if (key->modifier == 0) + { + XGrabKey (dpy, key->keycode, AnyModifier, w, FALSE, + GrabModeAsync, GrabModeAsync); + } + else + { + /* Here we grab all combinations of well known modifiers */ + XGrabKey (dpy, key->keycode, key->modifier, w, FALSE, + GrabModeAsync, GrabModeAsync); + XGrabKey (dpy, key->keycode, key->modifier | ScrollLockMask, w, + FALSE, GrabModeAsync, GrabModeAsync); + XGrabKey (dpy, key->keycode, key->modifier | NumLockMask, w, + FALSE, GrabModeAsync, GrabModeAsync); + XGrabKey (dpy, key->keycode, key->modifier | CapsLockMask, w, + FALSE, GrabModeAsync, GrabModeAsync); + XGrabKey (dpy, key->keycode, + key->modifier | ScrollLockMask | NumLockMask, w, FALSE, + GrabModeAsync, GrabModeAsync); + XGrabKey (dpy, key->keycode, + key->modifier | ScrollLockMask | CapsLockMask, w, FALSE, + GrabModeAsync, GrabModeAsync); + XGrabKey (dpy, key->keycode, + key->modifier | CapsLockMask | NumLockMask, w, FALSE, + GrabModeAsync, GrabModeAsync); + XGrabKey (dpy, key->keycode, + key->modifier | ScrollLockMask | CapsLockMask | NumLockMask, + w, FALSE, GrabModeAsync, GrabModeAsync); + } } } @@ -157,45 +157,45 @@ grabButton (Display * dpy, int button, int modifier, Window w) if (modifier == AnyModifier) { - XGrabButton (dpy, button, AnyModifier, w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); + XGrabButton (dpy, button, AnyModifier, w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); } else { - /* Here we grab all combinations of well known modifiers */ - XGrabButton (dpy, button, modifier, - w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); - XGrabButton (dpy, button, modifier | ScrollLockMask, - w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); - XGrabButton (dpy, button, modifier | NumLockMask, - w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); - XGrabButton (dpy, button, modifier | CapsLockMask, w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); - XGrabButton (dpy, button, modifier | ScrollLockMask | NumLockMask, - w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); - XGrabButton (dpy, button, modifier | ScrollLockMask | CapsLockMask, - w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); - XGrabButton (dpy, button, modifier | CapsLockMask | NumLockMask, - w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); - XGrabButton (dpy, button, - modifier | ScrollLockMask | CapsLockMask | NumLockMask, - w, FALSE, - ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, - None, None); + /* Here we grab all combinations of well known modifiers */ + XGrabButton (dpy, button, modifier, + w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); + XGrabButton (dpy, button, modifier | ScrollLockMask, + w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); + XGrabButton (dpy, button, modifier | NumLockMask, + w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); + XGrabButton (dpy, button, modifier | CapsLockMask, w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); + XGrabButton (dpy, button, modifier | ScrollLockMask | NumLockMask, + w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); + XGrabButton (dpy, button, modifier | ScrollLockMask | CapsLockMask, + w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); + XGrabButton (dpy, button, modifier | CapsLockMask | NumLockMask, + w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); + XGrabButton (dpy, button, + modifier | ScrollLockMask | CapsLockMask | NumLockMask, + w, FALSE, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, + None, None); } } @@ -208,19 +208,19 @@ ungrabButton (Display * dpy, int button, int modifier, Window w) if (modifier == AnyModifier) { - XUngrabButton (dpy, button, AnyModifier, w); + XUngrabButton (dpy, button, AnyModifier, w); } else { - /* Here we ungrab all combinations of well known modifiers */ - XUngrabButton (dpy, button, modifier, w); - XUngrabButton (dpy, button, modifier | ScrollLockMask, w); - XUngrabButton (dpy, button, modifier | NumLockMask, w); - XUngrabButton (dpy, button, modifier | CapsLockMask, w); - XUngrabButton (dpy, button, modifier | ScrollLockMask | NumLockMask, w); - XUngrabButton (dpy, button, modifier | ScrollLockMask | CapsLockMask, w); - XUngrabButton (dpy, button, modifier | CapsLockMask | NumLockMask, w); - XUngrabButton (dpy, button, modifier | ScrollLockMask | CapsLockMask | NumLockMask, w); + /* Here we ungrab all combinations of well known modifiers */ + XUngrabButton (dpy, button, modifier, w); + XUngrabButton (dpy, button, modifier | ScrollLockMask, w); + XUngrabButton (dpy, button, modifier | NumLockMask, w); + XUngrabButton (dpy, button, modifier | CapsLockMask, w); + XUngrabButton (dpy, button, modifier | ScrollLockMask | NumLockMask, w); + XUngrabButton (dpy, button, modifier | ScrollLockMask | CapsLockMask, w); + XUngrabButton (dpy, button, modifier | CapsLockMask | NumLockMask, w); + XUngrabButton (dpy, button, modifier | ScrollLockMask | CapsLockMask | NumLockMask, w); } } @@ -231,116 +231,116 @@ initModifiers (Display * dpy) int m, k; AltMask = MetaMask = NumLockMask = ScrollLockMask = CapsLockMask = - SuperMask = HyperMask = 0; + SuperMask = HyperMask = 0; if (xmk) { - KeyCode *c = xmk->modifiermap; - KeyCode numLockKeyCode; - KeyCode scrollLockKeyCode; - KeyCode capsLockKeyCode; - KeyCode altKeyCode; - KeyCode metaKeyCode; - KeyCode superKeyCode; - KeyCode hyperKeyCode; - - numLockKeyCode = XKeysymToKeycode (dpy, XK_Num_Lock); - scrollLockKeyCode = XKeysymToKeycode (dpy, XK_Scroll_Lock); - capsLockKeyCode = XKeysymToKeycode (dpy, XK_Caps_Lock); - altKeyCode = XKeysymToKeycode (dpy, XK_Alt_L); - metaKeyCode = XKeysymToKeycode (dpy, XK_Meta_L); - superKeyCode = XKeysymToKeycode (dpy, XK_Super_L); - hyperKeyCode = XKeysymToKeycode (dpy, XK_Hyper_L); - - if (!altKeyCode) - { - altKeyCode = XKeysymToKeycode (dpy, XK_Alt_R); - } - if (!metaKeyCode) - { - metaKeyCode = XKeysymToKeycode (dpy, XK_Meta_R); - } - if (!superKeyCode) - { - superKeyCode = XKeysymToKeycode (dpy, XK_Super_R); - } - if (!hyperKeyCode) - { - hyperKeyCode = XKeysymToKeycode (dpy, XK_Hyper_R); - } - - - for (m = 0; m < 8; m++) - { - for (k = 0; k < xmk->max_keypermod; k++, c++) - { - if (*c == NoSymbol) - { - continue; - } - if (*c == numLockKeyCode) - { - NumLockMask = (1 << m); - } - if (*c == scrollLockKeyCode) - { - ScrollLockMask = (1 << m); - } - if (*c == capsLockKeyCode) - { - CapsLockMask = (1 << m); - } - if (*c == altKeyCode) - { - AltMask = (1 << m); - } - if (*c == metaKeyCode) - { - MetaMask = (1 << m); - } - if (*c == superKeyCode) - { - SuperMask = (1 << m); - } - if (*c == hyperKeyCode) - { - HyperMask = (1 << m); - } - } - } - XFreeModifiermap (xmk); + KeyCode *c = xmk->modifiermap; + KeyCode numLockKeyCode; + KeyCode scrollLockKeyCode; + KeyCode capsLockKeyCode; + KeyCode altKeyCode; + KeyCode metaKeyCode; + KeyCode superKeyCode; + KeyCode hyperKeyCode; + + numLockKeyCode = XKeysymToKeycode (dpy, XK_Num_Lock); + scrollLockKeyCode = XKeysymToKeycode (dpy, XK_Scroll_Lock); + capsLockKeyCode = XKeysymToKeycode (dpy, XK_Caps_Lock); + altKeyCode = XKeysymToKeycode (dpy, XK_Alt_L); + metaKeyCode = XKeysymToKeycode (dpy, XK_Meta_L); + superKeyCode = XKeysymToKeycode (dpy, XK_Super_L); + hyperKeyCode = XKeysymToKeycode (dpy, XK_Hyper_L); + + if (!altKeyCode) + { + altKeyCode = XKeysymToKeycode (dpy, XK_Alt_R); + } + if (!metaKeyCode) + { + metaKeyCode = XKeysymToKeycode (dpy, XK_Meta_R); + } + if (!superKeyCode) + { + superKeyCode = XKeysymToKeycode (dpy, XK_Super_R); + } + if (!hyperKeyCode) + { + hyperKeyCode = XKeysymToKeycode (dpy, XK_Hyper_R); + } + + + for (m = 0; m < 8; m++) + { + for (k = 0; k < xmk->max_keypermod; k++, c++) + { + if (*c == NoSymbol) + { + continue; + } + if (*c == numLockKeyCode) + { + NumLockMask = (1 << m); + } + if (*c == scrollLockKeyCode) + { + ScrollLockMask = (1 << m); + } + if (*c == capsLockKeyCode) + { + CapsLockMask = (1 << m); + } + if (*c == altKeyCode) + { + AltMask = (1 << m); + } + if (*c == metaKeyCode) + { + MetaMask = (1 << m); + } + if (*c == superKeyCode) + { + SuperMask = (1 << m); + } + if (*c == hyperKeyCode) + { + HyperMask = (1 << m); + } + } + } + XFreeModifiermap (xmk); } if (MetaMask == AltMask) { - MetaMask = 0; + MetaMask = 0; } if ((AltMask != 0) && (MetaMask == Mod1Mask)) { - MetaMask = AltMask; - AltMask = Mod1Mask; + MetaMask = AltMask; + AltMask = Mod1Mask; } if ((AltMask == 0) && (MetaMask != 0)) { - if (MetaMask != Mod1Mask) - { - AltMask = Mod1Mask; - } - else - { - AltMask = MetaMask; - MetaMask = 0; - } + if (MetaMask != Mod1Mask) + { + AltMask = Mod1Mask; + } + else + { + AltMask = MetaMask; + MetaMask = 0; + } } if (AltMask == 0) { - AltMask = Mod1Mask; + AltMask = Mod1Mask; } KeyMask = - ControlMask | ShiftMask | AltMask | MetaMask | SuperMask | HyperMask; + ControlMask | ShiftMask | AltMask | MetaMask | SuperMask | HyperMask; ButtonMask = - Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask; + Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask; ButtonKeyMask = KeyMask | ButtonMask; } diff --git a/src/keyboard.h b/src/keyboard.h index 5d4b0d75d..2d3efcca2 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/main.c b/src/main.c index d455be8a6..2340d15f8 100644 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,16 @@ #include #endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -33,16 +43,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "main.h" #include "events.h" #include "frame.h" @@ -68,6 +68,8 @@ char *progname; Display *dpy; +GdkScreen *gscr; +GdkDisplay *gdisplay; Window root, gnome_win, systray, sidewalk[2]; Colormap cmap; Screen *xscreen; @@ -242,6 +244,7 @@ initialize (int argc, char **argv) struct sigaction act; int dummy; long ws; + GdkWindow *groot; TRACE ("entering initialize"); @@ -263,18 +266,25 @@ initialize (int argc, char **argv) gtk_init (&argc, &argv); gdk_rgb_init(); - gtk_widget_push_visual(gdk_rgb_get_visual ()); - gtk_widget_push_colormap(gdk_rgb_get_cmap ()); + gscr = gdk_screen_get_default (); + if (!gscr) + { + g_error (_("Cannot get default screen\n")); + } + gdisplay = gdk_screen_get_display (gscr); + gtk_widget_push_visual(gdk_screen_get_rgb_visual (gscr)); + gtk_widget_push_colormap(gdk_screen_get_rgb_colormap (gscr)); + dpy = gdk_x11_display_get_xdisplay (gdisplay); + xscreen = gdk_x11_screen_get_xscreen (gscr); + groot = gdk_screen_get_root_window (gscr); + root = (Window) gdk_x11_drawable_get_xid (groot); + screen = gdk_screen_get_number (gscr); + cmap = GDK_COLORMAP_XCOLORMAP(gdk_screen_get_rgb_colormap (gscr)); DBG ("xfwm4 starting, using GTK+-%d.%d.%d", gtk_major_version, gtk_minor_version, gtk_micro_version); - dpy = GDK_DISPLAY (); - root = GDK_ROOT_WINDOW (); - xscreen = DefaultScreenOfDisplay(dpy); - screen = XDefaultScreen (dpy); depth = DefaultDepth (dpy, screen); - cmap = GDK_COLORMAP_XCOLORMAP(gdk_rgb_get_cmap ()); sn_init_display (dpy, screen); workspace = 0; @@ -296,11 +306,11 @@ initialize (int argc, char **argv) /* Create the side windows to detect edge movement */ sidewalk[0] = setTmpEventWin (0, 0, - 1, MyDisplayFullHeight (dpy, screen), + 1, gdk_screen_get_height (gscr), LeaveWindowMask | PointerMotionMask); - sidewalk[1] = setTmpEventWin (MyDisplayFullWidth (dpy, screen) - 1, 0, - 1, MyDisplayFullHeight (dpy, screen), + sidewalk[1] = setTmpEventWin (gdk_screen_get_width (gscr) - 1, 0, + 1, gdk_screen_get_height (gscr), LeaveWindowMask | PointerMotionMask); margins[TOP] = gnome_margins[TOP] = 0; diff --git a/src/main.h b/src/main.h index 00f9cc64f..d8cce0956 100644 --- a/src/main.h +++ b/src/main.h @@ -57,6 +57,8 @@ extern char *progname; extern Display *dpy; +extern GdkScreen *gscr; +extern GdkDisplay *gdisplay; extern Window root, gnome_win, systray, sidewalk[2]; extern Screen *xscreen; extern int screen; diff --git a/src/menu.c b/src/menu.c index b1d8e17dc..6cb036f63 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - Metacity - (c) 2001 Havoc Pennington - xfwm4 - (c) 2002-2003 Olivier Fourdan + Metacity - (c) 2001 Havoc Pennington + xfwm4 - (c) 2002-2003 Olivier Fourdan */ @@ -22,15 +22,11 @@ #include #endif -#ifdef GDK_MULTIHEAD_SAFE -#undef GDK_MULTIHEAD_SAFE -#endif - +#include #include #include #include #include -#include #include #include #include @@ -69,18 +65,18 @@ menu_filter (XEvent * xevent, gpointer data) { switch (xevent->type) { - case KeyPress: - case KeyRelease: - case ButtonPress: - case ButtonRelease: - case MotionNotify: - case EnterNotify: - case LeaveNotify: - return XEV_FILTER_STOP; - break; - default: - return XEV_FILTER_CONTINUE; - break; + case KeyPress: + case KeyRelease: + case ButtonPress: + case ButtonRelease: + case MotionNotify: + case EnterNotify: + case LeaveNotify: + return XEV_FILTER_STOP; + break; + default: + return XEV_FILTER_CONTINUE; + break; } return XEV_FILTER_STOP; } @@ -99,21 +95,21 @@ popup_position_func (GtkMenu * menu, gint * x, gint * y, gboolean * push_in, if (pos->x >= 0) { - *x = pos->x; - *x = CLAMP (*x, 0, MAX (0, gdk_screen_width () - req.width)); + *x = pos->x; + *x = CLAMP (*x, 0, MAX (0, gdk_screen_width () - req.width)); } else { - *x = (gdk_screen_width () - req.width) / 2; + *x = (gdk_screen_width () - req.width) / 2; } if (pos->x >= 0) { - *y = pos->y; - *y = CLAMP (*y, 0, MAX (0, gdk_screen_height () - req.height)); + *y = pos->y; + *y = CLAMP (*y, 0, MAX (0, gdk_screen_height () - req.height)); } else { - *y = (gdk_screen_height () - req.height) / 2; + *y = (gdk_screen_height () - req.height) / 2; } g_free (user_data); } @@ -133,7 +129,7 @@ activate_cb (GtkWidget * menuitem, gpointer data) TRACE ("deactivating menu_filter"); popEventFilter (); (*md->menu->func) (md->menu, md->op, md->client_xwindow, md->menu->data, - md->data); + md->data); return (FALSE); } @@ -165,39 +161,39 @@ menu_workspace (Menu * menu, MenuOp insensitive, gint ws, gint nws, gchar *wsn, for (i = 0; i < nws; i++) { - if (ptr && *ptr) - { - name = g_strdup_printf (_("Workspace %i (%s)"), i + 1, ptr); - if (ptr - wsn + 1 < wsnl) - { - ptr += strlen (ptr) + 1; - } - else - { - ptr = NULL; - } - } - else - { - name = g_strdup_printf (_("Workspace %i"), i + 1); - } - mi = gtk_check_menu_item_new_with_label (name); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), (i == ws)); - gtk_widget_show (mi); - if (insensitive & MENU_OP_WORKSPACES) - { - gtk_widget_set_sensitive (mi, FALSE); - } - g_free (name); - - md = g_new (MenuData, 1); - md->menu = menu; - md->op = MENU_OP_WORKSPACES; - md->client_xwindow = None; - md->data = GINT_TO_POINTER (i); - menu_item_connect (mi, md); - - gtk_menu_shell_append (GTK_MENU_SHELL (menu_widget), mi); + if (ptr && *ptr) + { + name = g_strdup_printf (_("Workspace %i (%s)"), i + 1, ptr); + if (ptr - wsn + 1 < wsnl) + { + ptr += strlen (ptr) + 1; + } + else + { + ptr = NULL; + } + } + else + { + name = g_strdup_printf (_("Workspace %i"), i + 1); + } + mi = gtk_check_menu_item_new_with_label (name); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), (i == ws)); + gtk_widget_show (mi); + if (insensitive & MENU_OP_WORKSPACES) + { + gtk_widget_set_sensitive (mi, FALSE); + } + g_free (name); + + md = g_new (MenuData, 1); + md->menu = menu; + md->op = MENU_OP_WORKSPACES; + md->client_xwindow = None; + md->data = GINT_TO_POINTER (i); + menu_item_connect (mi, md); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu_widget), mi); } return (menu_widget); @@ -221,68 +217,68 @@ menu_default (MenuOp ops, MenuOp insensitive, MenuFunc func, gint ws, i = 0; while (i < (int) (sizeof (menuitems) / sizeof (MenuItem))) { - if ((ops & menuitems[i].op) || (menuitems[i].op == MENU_OP_SEPARATOR)) - { - GtkWidget *mi; - GtkWidget *image; - GtkWidget *ws_menu; - MenuData *md; - const gchar *label; - - label = _(menuitems[i].label); - ws_menu = NULL; - switch (menuitems[i].op) - { - case MENU_OP_SEPARATOR: - mi = gtk_separator_menu_item_new (); - break; - case MENU_OP_WORKSPACES: - mi = gtk_menu_item_new_with_mnemonic (label); - if (insensitive & menuitems[i].op) - { - gtk_widget_set_sensitive (mi, FALSE); - } - ws_menu = menu_workspace (menu, insensitive, ws, nws, wsn, wsnl); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), ws_menu); - - md = g_new (MenuData, 1); - md->menu = menu; - md->op = menuitems[i].op; - md->client_xwindow = None; - md->data = NULL; - break; - default: - if (menuitems[i].image_name) - { - mi = gtk_image_menu_item_new_with_mnemonic (label); - image = - gtk_image_new_from_stock (menuitems[i].image_name, - GTK_ICON_SIZE_MENU); - gtk_widget_show (image); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM - (mi), image); - - } - else - { - mi = gtk_menu_item_new_with_mnemonic (label); - } - if (insensitive & menuitems[i].op) - { - gtk_widget_set_sensitive (mi, FALSE); - } - md = g_new (MenuData, 1); - md->menu = menu; - md->op = menuitems[i].op; - md->client_xwindow = None; - md->data = NULL; - menu_item_connect (mi, md); - break; - } - gtk_menu_shell_append (GTK_MENU_SHELL (menu->menu), mi); - gtk_widget_show (mi); - } - ++i; + if ((ops & menuitems[i].op) || (menuitems[i].op == MENU_OP_SEPARATOR)) + { + GtkWidget *mi; + GtkWidget *image; + GtkWidget *ws_menu; + MenuData *md; + const gchar *label; + + label = _(menuitems[i].label); + ws_menu = NULL; + switch (menuitems[i].op) + { + case MENU_OP_SEPARATOR: + mi = gtk_separator_menu_item_new (); + break; + case MENU_OP_WORKSPACES: + mi = gtk_menu_item_new_with_mnemonic (label); + if (insensitive & menuitems[i].op) + { + gtk_widget_set_sensitive (mi, FALSE); + } + ws_menu = menu_workspace (menu, insensitive, ws, nws, wsn, wsnl); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), ws_menu); + + md = g_new (MenuData, 1); + md->menu = menu; + md->op = menuitems[i].op; + md->client_xwindow = None; + md->data = NULL; + break; + default: + if (menuitems[i].image_name) + { + mi = gtk_image_menu_item_new_with_mnemonic (label); + image = + gtk_image_new_from_stock (menuitems[i].image_name, + GTK_ICON_SIZE_MENU); + gtk_widget_show (image); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM + (mi), image); + + } + else + { + mi = gtk_menu_item_new_with_mnemonic (label); + } + if (insensitive & menuitems[i].op) + { + gtk_widget_set_sensitive (mi, FALSE); + } + md = g_new (MenuData, 1); + md->menu = menu; + md->op = menuitems[i].op; + md->client_xwindow = None; + md->data = NULL; + menu_item_connect (mi, md); + break; + } + gtk_menu_shell_append (GTK_MENU_SHELL (menu->menu), mi); + gtk_widget_show (mi); + } + ++i; } menu_connect (menu); @@ -296,7 +292,7 @@ menu_connect (Menu * menu) g_return_val_if_fail (menu != NULL, NULL); g_return_val_if_fail (GTK_IS_MENU (menu->menu), NULL); g_signal_connect (GTK_OBJECT (menu->menu), "selection_done", - GTK_SIGNAL_FUNC (menu_closed), menu); + GTK_SIGNAL_FUNC (menu_closed), menu); return (menu); } @@ -306,8 +302,8 @@ closure_notify (gpointer data, GClosure * closure) TRACE ("entering closure_notify"); if (data) { - TRACE ("freeing data"); - g_free (data); + TRACE ("freeing data"); + g_free (data); } } @@ -318,8 +314,8 @@ menu_item_connect (GtkWidget * item, MenuData * item_data) g_return_val_if_fail (item != NULL, NULL); g_return_val_if_fail (GTK_IS_MENU_ITEM (item), NULL); g_signal_connect_closure (GTK_OBJECT (item), "activate", - g_cclosure_new (GTK_SIGNAL_FUNC (activate_cb), item_data, - (GClosureNotify) closure_notify), FALSE); + g_cclosure_new (GTK_SIGNAL_FUNC (activate_cb), item_data, + (GClosureNotify) closure_notify), FALSE); return (item); } @@ -336,10 +332,10 @@ menu_check_and_close (void) TRACE ("entering menu_check_or_close"); if (menu_open) { - TRACE ("menu open, emitting deactivate signal"); - g_signal_emit_by_name (GTK_OBJECT (menu_open), "deactivate"); - menu_open = NULL; - return (TRUE); + TRACE ("menu open, emitting deactivate signal"); + g_signal_emit_by_name (GTK_OBJECT (menu_open), "deactivate"); + menu_open = NULL; + return (TRUE); } return (FALSE); } @@ -348,9 +344,9 @@ static gboolean grab_available (guint32 timestamp) { GdkEventMask mask = - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | - GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | - GDK_POINTER_MOTION_MASK; + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | + GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | + GDK_POINTER_MOTION_MASK; GdkGrabStatus g1; GdkGrabStatus g2; gboolean grab_failed = FALSE; @@ -359,32 +355,32 @@ grab_available (guint32 timestamp) TRACE ("entering grab_available"); g1 = gdk_pointer_grab (getGdkEventWindow (), TRUE, mask, NULL, NULL, - timestamp); + timestamp); g2 = gdk_keyboard_grab (getGdkEventWindow (), TRUE, timestamp); while ((i++ < 100) && (grab_failed = ((g1 != GDK_GRAB_SUCCESS) - || (g2 != GDK_GRAB_SUCCESS)))) + || (g2 != GDK_GRAB_SUCCESS)))) { - TRACE ("grab not available yet, waiting... (%i)", i); - g_usleep (100); - if (g1 != GDK_GRAB_SUCCESS) - { - g1 = gdk_pointer_grab (getGdkEventWindow (), TRUE, mask, NULL, - NULL, timestamp); - } - if (g2 != GDK_GRAB_SUCCESS) - { - g2 = gdk_keyboard_grab (getGdkEventWindow (), TRUE, timestamp); - } + TRACE ("grab not available yet, waiting... (%i)", i); + g_usleep (100); + if (g1 != GDK_GRAB_SUCCESS) + { + g1 = gdk_pointer_grab (getGdkEventWindow (), TRUE, mask, NULL, + NULL, timestamp); + } + if (g2 != GDK_GRAB_SUCCESS) + { + g2 = gdk_keyboard_grab (getGdkEventWindow (), TRUE, timestamp); + } } if (g1 == GDK_GRAB_SUCCESS) { - gdk_pointer_ungrab (timestamp); + gdk_pointer_ungrab (timestamp); } if (g2 == GDK_GRAB_SUCCESS) { - gdk_keyboard_ungrab (timestamp); + gdk_keyboard_ungrab (timestamp); } return (!grab_failed); @@ -407,28 +403,28 @@ menu_popup (Menu * menu, int root_x, int root_y, int button, if (!menu_check_and_close ()) { - if (!grab_available (timestamp)) - { - g_free (pt); - TRACE ("Cannot get grab on pointer/keyboard, cancel."); - return FALSE; - } - TRACE ("opening new menu"); - menu_open = menu->menu; - pushEventFilter (menu_filter, NULL); - gtk_menu_popup (GTK_MENU (menu->menu), NULL, NULL, - popup_position_func, pt, 0, timestamp); - - if (!GTK_MENU_SHELL (GTK_MENU (menu->menu))->have_xgrab) - { - gdk_beep (); - g_message (_("%s: GtkMenu failed to grab the pointer\n"), - g_get_prgname ()); - gtk_menu_popdown (GTK_MENU (menu->menu)); - menu_open = NULL; - popEventFilter (); - return FALSE; - } + if (!grab_available (timestamp)) + { + g_free (pt); + TRACE ("Cannot get grab on pointer/keyboard, cancel."); + return FALSE; + } + TRACE ("opening new menu"); + menu_open = menu->menu; + pushEventFilter (menu_filter, NULL); + gtk_menu_popup (GTK_MENU (menu->menu), NULL, NULL, + popup_position_func, pt, 0, timestamp); + + if (!GTK_MENU_SHELL (GTK_MENU (menu->menu))->have_xgrab) + { + gdk_beep (); + g_message (_("%s: GtkMenu failed to grab the pointer\n"), + g_get_prgname ()); + gtk_menu_popdown (GTK_MENU (menu->menu)); + menu_open = NULL; + popEventFilter (); + return FALSE; + } } return TRUE; } diff --git a/src/menu.h b/src/menu.h index d59d03bc1..967d733b8 100644 --- a/src/menu.h +++ b/src/menu.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - Metacity - (c) 2001 Havoc Pennington - xfwm4 - (c) 2002-2003 Olivier Fourdan + Metacity - (c) 2001 Havoc Pennington + xfwm4 - (c) 2002-2003 Olivier Fourdan */ @@ -58,7 +58,7 @@ typedef struct _MenuItem MenuItem; typedef struct _MenuData MenuData; typedef void (*MenuFunc) (Menu * menu, MenuOp op, Window client_xwindow, - gpointer menu_data, gpointer item_data); + gpointer menu_data, gpointer item_data); struct _MenuItem { @@ -85,13 +85,13 @@ struct _Menu }; Menu *menu_default (MenuOp ops, MenuOp insensitive, MenuFunc func, - gint ws, gint nws, gchar *wsn, gint wsnl, gpointer data); + gint ws, gint nws, gchar *wsn, gint wsnl, gpointer data); Menu *menu_connect (Menu * menu); GtkWidget *menu_item_connect (GtkWidget * item, MenuData * item_data); gboolean menu_is_opened (void); gboolean menu_check_and_close (void); gboolean menu_popup (Menu * menu, int root_x, int root_y, int button, - guint32 timestamp); + guint32 timestamp); void menu_free (Menu * menu); #endif /* INC_MENU_H */ diff --git a/src/misc.c b/src/misc.c index 772067904..0586edc22 100644 --- a/src/misc.c +++ b/src/misc.c @@ -22,17 +22,13 @@ #include #endif -#ifdef GDK_MULTIHEAD_SAFE -#undef GDK_MULTIHEAD_SAFE -#endif - +#include +#include +#include #include #include #include #include -#include -#include -#include #include #include #include @@ -205,19 +201,19 @@ placeSidewalks(gboolean activate) { XMoveResizeWindow(dpy, sidewalk[0], 0, 0, - 1, MyDisplayFullHeight (dpy, screen)); + 1, gdk_screen_get_height (gscr)); XMoveResizeWindow(dpy, sidewalk[1], - MyDisplayFullWidth (dpy, screen) - 1, 0, - 1, MyDisplayFullHeight (dpy, screen)); + gdk_screen_get_width (gscr) - 1, 0, + 1, gdk_screen_get_height (gscr)); } else { /* Place the windows off screen */ XMoveResizeWindow(dpy, sidewalk[0], -1, 0, - 1, MyDisplayFullHeight (dpy, screen)); + 1, gdk_screen_get_height (gscr)); XMoveResizeWindow(dpy, sidewalk[1], - MyDisplayFullWidth (dpy, screen), 0, - 1, MyDisplayFullHeight (dpy, screen)); + gdk_screen_get_width (gscr), 0, + 1, gdk_screen_get_height (gscr)); } } diff --git a/src/misc.h b/src/misc.h index 09808c2f3..504844357 100644 --- a/src/misc.h +++ b/src/misc.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/mypixmap.c b/src/mypixmap.c index e49bc4864..4f52a827a 100644 --- a/src/mypixmap.c +++ b/src/mypixmap.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ @@ -24,11 +24,12 @@ #include #include +#include +#include +#include #include #include #include -#include -#include #include "mypixmap.h" #include "main.h" @@ -49,8 +50,8 @@ myPixmapCompose (MyPixmap * pm, gchar * dir, gchar * file) if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { - g_free (filename); - return FALSE; + g_free (filename); + return FALSE; } alpha = gdk_pixbuf_new_from_file (filename, &error); g_free (filename); @@ -63,22 +64,22 @@ myPixmapCompose (MyPixmap * pm, gchar * dir, gchar * file) if (!gdk_pixbuf_get_has_alpha (alpha)) { g_object_unref (alpha); - return FALSE; + return FALSE; } destw = gdk_pixmap_foreign_new (pm->pixmap); if (!destw) { DBG ("Cannot get pixmap"); g_object_unref (alpha); - return FALSE; + return FALSE; } src = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE (destw), gdk_rgb_get_cmap (), - 0, 0, 0, 0, pm->width, pm->height); + 0, 0, 0, 0, pm->width, pm->height); gdk_pixbuf_composite (alpha, src, 0, 0, pm->width, pm->height, - 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); + 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); gdk_draw_pixbuf (GDK_DRAWABLE (destw), NULL, src, 0, 0, 0, 0, - pm->width, pm->height, GDK_RGB_DITHER_NONE, 0, 0); + pm->width, pm->height, GDK_RGB_DITHER_NONE, 0, 0); g_object_unref (alpha); g_object_unref (src); g_object_unref (destw); @@ -113,14 +114,14 @@ myPixmapLoad (Display * dpy, MyPixmap * pm, gchar * dir, gchar * file, attr.valuemask = XpmCloseness | XpmColormap | XpmSize; if (n > 0 && cs) { - attr.valuemask = attr.valuemask | XpmColorSymbols; + attr.valuemask = attr.valuemask | XpmColorSymbols; } if (XpmReadFileToPixmap (dpy, XDefaultRootWindow (dpy), filename, - &pm->pixmap, &pm->mask, &attr)) + &pm->pixmap, &pm->mask, &attr)) { - TRACE ("%s not found", filename); - g_free (filename); - return FALSE; + TRACE ("%s not found", filename); + g_free (filename); + return FALSE; } pm->width = attr.width; pm->height = attr.height; @@ -139,14 +140,14 @@ myPixmapCreate (Display * dpy, MyPixmap * pm, gint width, gint height) TRACE ("entering myPixmapCreate, width=%i, height=%i", width, height); if ((width < 1) || (height < 1)) { - myPixmapInit (pm); + myPixmapInit (pm); } else { - pm->pixmap = XCreatePixmap (dpy, root, width, height, depth); - pm->mask = XCreatePixmap (dpy, pm->pixmap, width, height, 1); - pm->width = width; - pm->height = height; + pm->pixmap = XCreatePixmap (dpy, root, width, height, depth); + pm->mask = XCreatePixmap (dpy, pm->pixmap, width, height, 1); + pm->width = width; + pm->height = height; } } @@ -166,12 +167,12 @@ myPixmapFree (Display * dpy, MyPixmap * pm) if (pm->pixmap != None) { - XFreePixmap (dpy, pm->pixmap); - pm->pixmap = None; + XFreePixmap (dpy, pm->pixmap); + pm->pixmap = None; } if (pm->mask != None) { - XFreePixmap (dpy, pm->mask); - pm->mask = None; + XFreePixmap (dpy, pm->mask); + pm->mask = None; } } diff --git a/src/mypixmap.h b/src/mypixmap.h index 771faaf11..defe5f41e 100644 --- a/src/mypixmap.h +++ b/src/mypixmap.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/mywindow.c b/src/mywindow.c index 80463803f..d58c2de87 100644 --- a/src/mywindow.c +++ b/src/mywindow.c @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2003 Olivier Fourdan + xfwm4 - (c) 2003 Olivier Fourdan */ @@ -23,11 +23,11 @@ #include #include -#include #include #include #include #include +#include #include "mywindow.h" #include "main.h" @@ -40,7 +40,7 @@ myWindowCreate (Display * dpy, Window parent, myWindow * win, Cursor cursor) TRACE ("Created XID 0x%lx", win->window); if (cursor != None) { - XDefineCursor (dpy, win->window, cursor); + XDefineCursor (dpy, win->window, cursor); } win->map = FALSE; win->dpy = dpy; @@ -57,8 +57,8 @@ myWindowDelete (myWindow * win) if (win->window != None) { - XDestroyWindow (win->dpy, win->window); - win->window = None; + XDestroyWindow (win->dpy, win->window); + win->window = None; } win->map = FALSE; } @@ -71,49 +71,49 @@ myWindowShow (myWindow * win, int x, int y, int width, int height, if (!(win->window)) { - return; + return; } if ((width < 1) || (height < 1)) { - myWindowHide (win); - return; + myWindowHide (win); + return; } if (!(win->map)) { - XMapWindow (win->dpy, win->window); - win->map = TRUE; + XMapWindow (win->dpy, win->window); + win->map = TRUE; } TRACE ("Showing XID 0x%lx", win->window); if (((x != win->x) || (y != win->y)) && ((width != win->w) - || (height != win->h))) + || (height != win->h))) { - XMoveResizeWindow (win->dpy, win->window, x, y, (unsigned int) width, - (unsigned int) height); - win->x = x; - win->y = y; - win->w = width; - win->h = height; + XMoveResizeWindow (win->dpy, win->window, x, y, (unsigned int) width, + (unsigned int) height); + win->x = x; + win->y = y; + win->w = width; + win->h = height; } else if ((x != win->x) || (y != win->y)) { - XMoveWindow (win->dpy, win->window, x, y); - if (refresh) - { - XClearWindow (win->dpy, win->window); - } - win->x = x; - win->y = y; + XMoveWindow (win->dpy, win->window, x, y); + if (refresh) + { + XClearWindow (win->dpy, win->window); + } + win->x = x; + win->y = y; } else if ((width != win->w) || (height != win->h)) { - XResizeWindow (win->dpy, win->window, (unsigned int) width, - (unsigned int) height); - win->w = width; - win->h = height; + XResizeWindow (win->dpy, win->window, (unsigned int) width, + (unsigned int) height); + win->w = width; + win->h = height; } else if (refresh) { - XClearWindow (win->dpy, win->window); + XClearWindow (win->dpy, win->window); } } @@ -124,7 +124,7 @@ myWindowHide (myWindow * win) if (win->map) { - XUnmapWindow (win->dpy, win->window); - win->map = FALSE; + XUnmapWindow (win->dpy, win->window); + win->map = FALSE; } } diff --git a/src/mywindow.h b/src/mywindow.h index 6baa7a3d3..21e7271c7 100644 --- a/src/mywindow.h +++ b/src/mywindow.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/netwm.c b/src/netwm.c index d2f64d86f..99b3e4ec7 100644 --- a/src/netwm.c +++ b/src/netwm.c @@ -504,21 +504,26 @@ clientUpdateFullscreenState (Client * c) if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) { + GdkRectangle rect; + gint monitor_nbr; int cx, cy; cx = frameX (c) + (frameWidth (c) / 2); cy = frameY (c) + (frameHeight (c) / 2); + monitor_nbr = gdk_screen_get_monitor_at_point (gscr, cx, cy); + gdk_screen_get_monitor_geometry (gscr, monitor_nbr, &rect); + c->fullscreen_old_x = c->x; c->fullscreen_old_y = c->y; c->fullscreen_old_width = c->width; c->fullscreen_old_height = c->height; c->fullscreen_old_layer = c->win_layer; - wc.x = MyDisplayX (cx, cy); - wc.y = MyDisplayY (cx, cy); - wc.width = MyDisplayWidth (dpy, screen, cx, cy); - wc.height = MyDisplayHeight (dpy, screen, cx, cy); + wc.x = rect.x; + wc.y = rect.y; + wc.width = rect.width; + wc.height = rect.height; layer = WIN_LAYER_ABOVE_DOCK; } else @@ -778,18 +783,18 @@ clientGetNetStruts (Client * c) { c->struts[i] = (int) struts[i]; } - for (i = 4; i < 12; i++) - { + for (i = 4; i < 12; i++) + { c->struts[i] = 0; - } - /* Fill(in values as for partial struts */ + } + /* Fill(in values as for partial struts */ c->struts[TOP_START_X] = c->struts[BOTTOM_START_X] = 0; c->struts[TOP_END_X] = c->struts[BOTTOM_END_X] = - MyDisplayFullWidth (dpy, screen); + gdk_screen_get_width (gscr); c->struts[LEFT_START_Y] = c->struts[RIGHT_START_Y] = 0; c->struts[LEFT_END_Y] = c->struts[RIGHT_END_Y] = - MyDisplayFullHeight (dpy, screen); - + gdk_screen_get_height (gscr); + XFree (struts); workspaceUpdateArea (margins, gnome_margins); } diff --git a/src/netwm.h b/src/netwm.h index 0548c5a4c..67f5f8d50 100644 --- a/src/netwm.h +++ b/src/netwm.h @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2002-2004 Olivier Fourdan + xfwm4 - (c) 2002-2004 Olivier Fourdan */ diff --git a/src/parserc.c b/src/parserc.c index c905014a0..10a7a91f8 100644 --- a/src/parserc.c +++ b/src/parserc.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ @@ -23,11 +23,12 @@ #endif #include -#include #include #include #include #include +#include + #include "parserc.h" #include "settings.h" @@ -48,11 +49,11 @@ parseRc (const gchar * file, const gchar * dir, Settings rc[]) if (dir) { - filename = g_build_filename (dir, G_DIR_SEPARATOR_S, file, NULL); + filename = g_build_filename (dir, G_DIR_SEPARATOR_S, file, NULL); } else { - filename = g_strdup (file); + filename = g_strdup (file); } fp = fopen (filename, "r"); @@ -60,16 +61,16 @@ parseRc (const gchar * file, const gchar * dir, Settings rc[]) if (!fp) { - return FALSE; + return FALSE; } while (fgets (buf, sizeof (buf), fp)) { - lvalue = strtok (buf, "="); - rvalue = strtok (NULL, "\n"); - if ((lvalue) && (rvalue)) - { - setValue (lvalue, rvalue, rc); - } + lvalue = strtok (buf, "="); + rvalue = strtok (NULL, "\n"); + if ((lvalue) && (rvalue)) + { + setValue (lvalue, rvalue, rc); + } } fclose (fp); return TRUE; @@ -85,11 +86,11 @@ checkRc (Settings rc[]) for (i = 0; rc[i].option; i++) { - if (rc[i].required && !rc[i].value) - { - fprintf (stderr, "missing value for option %s\n", rc[i].option); - rval = FALSE; - } + if (rc[i].required && !rc[i].value) + { + fprintf (stderr, "missing value for option %s\n", rc[i].option); + rval = FALSE; + } } return rval; } @@ -105,10 +106,10 @@ getValue (const gchar * option, Settings rc[]) for (i = 0; rc[i].option; i++) { - if (!g_ascii_strcasecmp (option, rc[i].option)) - { - return rc[i].value; - } + if (!g_ascii_strcasecmp (option, rc[i].option)) + { + return rc[i].value; + } } return NULL; } @@ -125,19 +126,19 @@ setValue (const gchar * lvalue, const gchar * rvalue, Settings rc[]) for (i = 0; rc[i].option; i++) { - if (!g_ascii_strcasecmp (lvalue, rc[i].option)) - { - if (rvalue) - { - if (rc[i].value) - { - g_free (rc[i].value); - } - rc[i].value = g_strdup (rvalue); - TRACE ("%s=%s", rc[i].option, rc[i].value); - return TRUE; - } - } + if (!g_ascii_strcasecmp (lvalue, rc[i].option)) + { + if (rvalue) + { + if (rc[i].value) + { + g_free (rc[i].value); + } + rc[i].value = g_strdup (rvalue); + TRACE ("%s=%s", rc[i].option, rc[i].value); + return TRUE; + } + } } return FALSE; } @@ -166,111 +167,111 @@ getThemeDir (const gchar * theme, const gchar * file) { if (!theme) { - return g_build_filename (DATADIR, G_DIR_SEPARATOR_S, "themes", - G_DIR_SEPARATOR_S, DEFAULT_THEME, NULL); + return g_build_filename (DATADIR, G_DIR_SEPARATOR_S, "themes", + G_DIR_SEPARATOR_S, DEFAULT_THEME, NULL); } else if (g_path_is_absolute (theme)) { - if (g_file_test (theme, G_FILE_TEST_IS_DIR)) - { - return g_strdup (theme); - } - else - { - return g_build_filename (DATADIR, G_DIR_SEPARATOR_S, "themes", - G_DIR_SEPARATOR_S, DEFAULT_THEME, NULL); - } + if (g_file_test (theme, G_FILE_TEST_IS_DIR)) + { + return g_strdup (theme); + } + else + { + return g_build_filename (DATADIR, G_DIR_SEPARATOR_S, "themes", + G_DIR_SEPARATOR_S, DEFAULT_THEME, NULL); + } } else { - /* First try, $HOME/.themes//xfwm4/ */ - - gchar *test_dir = g_build_filename (g_get_home_dir (), - G_DIR_SEPARATOR_S, ".themes", - G_DIR_SEPARATOR_S, theme, - G_DIR_SEPARATOR_S, "xfwm4", - NULL); - - gchar *test_file = g_build_filename (test_dir, - G_DIR_SEPARATOR_S, file, - NULL); + /* First try, $HOME/.themes//xfwm4/ */ + + gchar *test_dir = g_build_filename (g_get_home_dir (), + G_DIR_SEPARATOR_S, ".themes", + G_DIR_SEPARATOR_S, theme, + G_DIR_SEPARATOR_S, "xfwm4", + NULL); + + gchar *test_file = g_build_filename (test_dir, + G_DIR_SEPARATOR_S, file, + NULL); - if (g_file_test (test_file, G_FILE_TEST_IS_REGULAR)) - { - g_free (test_file); - return test_dir; - } + if (g_file_test (test_file, G_FILE_TEST_IS_REGULAR)) + { + g_free (test_file); + return test_dir; + } #if 0 - /* Second try, $HOME/.themes/xfwm4// */ - g_free (test_file); - g_free (test_dir); - - test_dir = g_build_filename (g_get_home_dir (), - G_DIR_SEPARATOR_S, ".themes", - G_DIR_SEPARATOR_S, "xfwm4", - G_DIR_SEPARATOR_S, theme, - NULL); - - test_file = g_build_filename (test_dir, - G_DIR_SEPARATOR_S, file, - NULL); + /* Second try, $HOME/.themes/xfwm4// */ + g_free (test_file); + g_free (test_dir); + + test_dir = g_build_filename (g_get_home_dir (), + G_DIR_SEPARATOR_S, ".themes", + G_DIR_SEPARATOR_S, "xfwm4", + G_DIR_SEPARATOR_S, theme, + NULL); + + test_file = g_build_filename (test_dir, + G_DIR_SEPARATOR_S, file, + NULL); - if (g_file_test (test_file, G_FILE_TEST_IS_REGULAR)) - { - g_free (test_file); - return test_dir; - } + if (g_file_test (test_file, G_FILE_TEST_IS_REGULAR)) + { + g_free (test_file); + return test_dir; + } #endif - /* Third try, /usr/share/themes//xfwm4/ */ - g_free (test_file); - g_free (test_dir); - - test_dir = g_build_filename (DATADIR, - G_DIR_SEPARATOR_S, "themes", - G_DIR_SEPARATOR_S, theme, - G_DIR_SEPARATOR_S, "xfwm4", - NULL); - - test_file = g_build_filename (test_dir, - G_DIR_SEPARATOR_S, file, - NULL); + /* Third try, /usr/share/themes//xfwm4/ */ + g_free (test_file); + g_free (test_dir); + + test_dir = g_build_filename (DATADIR, + G_DIR_SEPARATOR_S, "themes", + G_DIR_SEPARATOR_S, theme, + G_DIR_SEPARATOR_S, "xfwm4", + NULL); + + test_file = g_build_filename (test_dir, + G_DIR_SEPARATOR_S, file, + NULL); - if (g_file_test (test_file, G_FILE_TEST_IS_REGULAR)) - { - g_free (test_file); - return test_dir; - } + if (g_file_test (test_file, G_FILE_TEST_IS_REGULAR)) + { + g_free (test_file); + return test_dir; + } #if 0 - /* Fourth try, /usr/share/themes/xfwm4// */ - g_free (test_file); - g_free (test_dir); - - test_dir = g_build_filename (DATADIR, - G_DIR_SEPARATOR_S, "themes", - G_DIR_SEPARATOR_S, theme, - NULL); - - test_file = g_build_filename (test_dir, - G_DIR_SEPARATOR_S, file, - NULL); + /* Fourth try, /usr/share/themes/xfwm4// */ + g_free (test_file); + g_free (test_dir); + + test_dir = g_build_filename (DATADIR, + G_DIR_SEPARATOR_S, "themes", + G_DIR_SEPARATOR_S, theme, + NULL); + + test_file = g_build_filename (test_dir, + G_DIR_SEPARATOR_S, file, + NULL); - if (g_file_test (test_file, G_FILE_TEST_IS_REGULAR)) - { - g_free (test_file); - return test_dir; - } + if (g_file_test (test_file, G_FILE_TEST_IS_REGULAR)) + { + g_free (test_file); + return test_dir; + } #endif - - /* Pfew, really can't find that theme nowhere! */ - g_free (test_file); - g_free (test_dir); + + /* Pfew, really can't find that theme nowhere! */ + g_free (test_file); + g_free (test_dir); } return g_build_filename (DATADIR, G_DIR_SEPARATOR_S, "themes", - G_DIR_SEPARATOR_S, DEFAULT_THEME, NULL); + G_DIR_SEPARATOR_S, DEFAULT_THEME, NULL); } void @@ -282,10 +283,10 @@ freeRc (Settings rc[]) for (i = 0; rc[i].option; i++) { - if (rc[i].value) - { - g_free (rc[i].value); - rc[i].value = NULL; - } + if (rc[i].value) + { + g_free (rc[i].value); + rc[i].value = NULL; + } } } diff --git a/src/parserc.h b/src/parserc.h index 0f948cffe..c0f742533 100644 --- a/src/parserc.h +++ b/src/parserc.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/placement.c b/src/placement.c index 40ef86b24..639004c72 100644 --- a/src/placement.c +++ b/src/placement.c @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2002-2004 Olivier Fourdan + xfwm4 - (c) 2002-2004 Olivier Fourdan */ @@ -38,7 +38,7 @@ static unsigned long overlapX (int x0, int x1, int tx0, int tx1); static unsigned long overlapY (int y0, int y1, int ty0, int ty1); static unsigned long overlap (int x0, int y0, int x1, int y1, - int tx0, int ty0, int tx1, int ty1); + int tx0, int ty0, int tx1, int ty1); static unsigned long clientStrutAreaOverlap (int x, int y, int w, int h, Client * c) @@ -47,23 +47,23 @@ clientStrutAreaOverlap (int x, int y, int w, int h, Client * c) if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE)) { - sigma = overlap (x, y, x + w, y + h, - 0, c->struts[LEFT_START_Y], - c->struts[LEFT], - c->struts[LEFT_END_Y]) - + overlap (x, y, x + w, y + h, - MyDisplayFullWidth (dpy, screen) - c->struts[RIGHT], - c->struts[RIGHT_START_Y], - MyDisplayFullWidth (dpy, screen), c->struts[RIGHT_END_Y]) - + overlap (x, y, x + w, y + h, - c->struts[TOP_START_X], 0, - c->struts[TOP_END_X], - c->struts[TOP]) - + overlap (x, y, x + w, y + h, - c->struts[BOTTOM_START_X], - MyDisplayFullHeight (dpy, screen) - c->struts[BOTTOM], - c->struts[BOTTOM_END_X], - MyDisplayFullHeight (dpy, screen)); + sigma = overlap (x, y, x + w, y + h, + 0, c->struts[LEFT_START_Y], + c->struts[LEFT], + c->struts[LEFT_END_Y]) + + overlap (x, y, x + w, y + h, + gdk_screen_get_width (gscr) - c->struts[RIGHT], + c->struts[RIGHT_START_Y], + gdk_screen_get_width (gscr), c->struts[RIGHT_END_Y]) + + overlap (x, y, x + w, y + h, + c->struts[TOP_START_X], 0, + c->struts[TOP_END_X], + c->struts[TOP]) + + overlap (x, y, x + w, y + h, + c->struts[BOTTOM_START_X], + gdk_screen_get_height (gscr) - c->struts[BOTTOM], + c->struts[BOTTOM_END_X], + gdk_screen_get_height (gscr)); } return sigma; } @@ -75,15 +75,15 @@ overlapX (int x0, int x1, int tx0, int tx1) { if (tx0 > x0) { - x0 = tx0; + x0 = tx0; } if (tx1 < x1) { - x1 = tx1; + x1 = tx1; } if (x1 <= x0) { - return 0; + return 0; } return (x1 - x0); } @@ -93,15 +93,15 @@ overlapY (int y0, int y1, int ty0, int ty1) { if (ty0 > y0) { - y0 = ty0; + y0 = ty0; } if (ty1 < y1) { - y1 = ty1; + y1 = ty1; } if (y1 <= y0) { - return 0; + return 0; } return (y1 - y0); } @@ -126,44 +126,44 @@ clientMaxSpace (int *x, int *y, int *w, int *h) for (c2 = clients, i = 0; i < client_count; c2 = c2->next, i++) { - if (FLAG_TEST_ALL (c2->flags, CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE)) - { - /* Left */ - if (overlap (*x, *y, *x + *w, *y + *h, - 0, c2->struts[LEFT_START_Y], c2->struts[LEFT], c2->struts[LEFT_END_Y])) - { - delta = c2->struts[LEFT] - *x; - *x = *x + delta; - *w = *w - delta; - } - - /* Right */ - if (overlap (*x, *y, *x + *w, *y + *h, - MyDisplayFullWidth (dpy, screen) - c2->struts[RIGHT], c2->struts[RIGHT_START_Y], - MyDisplayFullWidth (dpy, screen), c2->struts[RIGHT_END_Y])) - { - delta = (*x + *w) - MyDisplayFullWidth (dpy, screen) + c2->struts[RIGHT]; - *w = *w - delta; - } - - /* Top */ - if (overlap (*x, *y, *x + *w, *y + *h, - c2->struts[TOP_START_X], 0, c2->struts[TOP_END_X], c2->struts[TOP])) - { - delta = c2->struts[TOP] - *y; - *y = *y + delta; - *h = *h - delta; - } - - /* Bottom */ - if (overlap (*x, *y, *x + *w, *y + *h, - c2->struts[BOTTOM_START_X], MyDisplayFullHeight (dpy, screen) - c2->struts[BOTTOM], - c2->struts[BOTTOM_END_X], MyDisplayFullHeight (dpy, screen))) - { - delta = (*y + *h) - MyDisplayFullHeight (dpy, screen) + c2->struts[BOTTOM]; - *h = *h - delta; - } - } + if (FLAG_TEST_ALL (c2->flags, CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE)) + { + /* Left */ + if (overlap (*x, *y, *x + *w, *y + *h, + 0, c2->struts[LEFT_START_Y], c2->struts[LEFT], c2->struts[LEFT_END_Y])) + { + delta = c2->struts[LEFT] - *x; + *x = *x + delta; + *w = *w - delta; + } + + /* Right */ + if (overlap (*x, *y, *x + *w, *y + *h, + gdk_screen_get_width (gscr) - c2->struts[RIGHT], c2->struts[RIGHT_START_Y], + gdk_screen_get_width (gscr), c2->struts[RIGHT_END_Y])) + { + delta = (*x + *w) - gdk_screen_get_width (gscr) + c2->struts[RIGHT]; + *w = *w - delta; + } + + /* Top */ + if (overlap (*x, *y, *x + *w, *y + *h, + c2->struts[TOP_START_X], 0, c2->struts[TOP_END_X], c2->struts[TOP])) + { + delta = c2->struts[TOP] - *y; + *y = *y + delta; + *h = *h - delta; + } + + /* Bottom */ + if (overlap (*x, *y, *x + *w, *y + *h, + c2->struts[BOTTOM_START_X], gdk_screen_get_height (gscr) - c2->struts[BOTTOM], + c2->struts[BOTTOM_END_X], gdk_screen_get_height (gscr))) + { + delta = (*y + *h) - gdk_screen_get_height (gscr) + c2->struts[BOTTOM]; + *h = *h - delta; + } + } } } @@ -181,10 +181,10 @@ clientCkeckTitle (Client * c) /* Struts and other partial struts */ for (c2 = clients, i = 0; i < client_count; c2 = c2->next, i++) { - if ((c2 != c) && clientStrutAreaOverlap(frame_x, frame_y, frame_width, frame_top, c2)) - { + if ((c2 != c) && clientStrutAreaOverlap(frame_x, frame_y, frame_width, frame_top, c2)) + { return FALSE; - } + } } return TRUE; } @@ -198,10 +198,12 @@ clientConstrainPos (Client * c, gboolean show_full) Client *c2; int i, cx, cy, disp_x, disp_y, disp_max_x, disp_max_y; int frame_x, frame_y, frame_height, frame_width, frame_top, frame_left; + GdkRectangle rect; + gint monitor_nbr; g_return_if_fail (c != NULL); TRACE ("entering clientConstrainPos %s", - show_full ? "(with show full)" : "(w/out show full)"); + show_full ? "(with show full)" : "(w/out show full)"); TRACE ("client \"%s\" (0x%lx)", c->name, c->window); /* We use a bunch of local vars to reduce the overhead of calling other functions all the time */ @@ -215,115 +217,118 @@ clientConstrainPos (Client * c, gboolean show_full) cx = frame_x + (frame_width / 2); cy = frame_y + (frame_height / 2); - disp_x = MyDisplayX (cx, cy); - disp_y = MyDisplayY (cx, cy); - disp_max_x = MyDisplayMaxX (dpy, screen, cx, cy); - disp_max_y = MyDisplayMaxY (dpy, screen, cx, cy); + monitor_nbr = gdk_screen_get_monitor_at_point (gscr, cx, cy); + gdk_screen_get_monitor_geometry (gscr, monitor_nbr, &rect); + + disp_x = rect.x; + disp_y = rect.y; + disp_max_x = rect.x + rect.width; + disp_max_y = rect.y + rect.height; if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) { - TRACE ("ignoring constrained for client \"%s\" (0x%lx)", c->name, - c->window); - return; + TRACE ("ignoring constrained for client \"%s\" (0x%lx)", c->name, + c->window); + return; } if (show_full) { - if (frame_x + frame_width > disp_max_x) - { - c->x = disp_max_x - frame_width + frame_left; - } - if (frame_x < disp_x) - { - c->x = disp_x + frame_left; - } - if (frame_y + frame_height > disp_max_y) - { - c->y = disp_max_y - frame_height + frame_top; - } - if (frame_y < disp_y) - { - c->y = disp_y + frame_top; - } + if (frame_x + frame_width > disp_max_x) + { + c->x = disp_max_x - frame_width + frame_left; + } + if (frame_x < disp_x) + { + c->x = disp_x + frame_left; + } + if (frame_y + frame_height > disp_max_y) + { + c->y = disp_max_y - frame_height + frame_top; + } + if (frame_y < disp_y) + { + c->y = disp_y + frame_top; + } } else { - if (frame_x + CLIENT_MIN_VISIBLE > disp_max_x) - { - c->x = disp_max_x - CLIENT_MIN_VISIBLE + frame_left; - frame_x = frameX (c); - } - if (frame_x + frame_width < disp_x + CLIENT_MIN_VISIBLE) - { - c->x = disp_x + CLIENT_MIN_VISIBLE - frame_width + frame_left; - frame_x = frameX (c); - } - if (frame_y + CLIENT_MIN_VISIBLE > disp_max_y) - { - c->y = disp_max_y - CLIENT_MIN_VISIBLE + frame_top; - frame_y = frameY (c); - } - if ((frame_y < disp_y) && (frame_y > disp_y - frame_top)) - { - c->y = disp_y + frame_top; - frame_y = frameY (c); - } - if (frame_y + frame_height < disp_y + CLIENT_MIN_VISIBLE) - { - c->y = disp_y + CLIENT_MIN_VISIBLE - frame_height + frame_top; - frame_y = frameY (c); - } + if (frame_x + CLIENT_MIN_VISIBLE > disp_max_x) + { + c->x = disp_max_x - CLIENT_MIN_VISIBLE + frame_left; + frame_x = frameX (c); + } + if (frame_x + frame_width < disp_x + CLIENT_MIN_VISIBLE) + { + c->x = disp_x + CLIENT_MIN_VISIBLE - frame_width + frame_left; + frame_x = frameX (c); + } + if (frame_y + CLIENT_MIN_VISIBLE > disp_max_y) + { + c->y = disp_max_y - CLIENT_MIN_VISIBLE + frame_top; + frame_y = frameY (c); + } + if ((frame_y < disp_y) && (frame_y > disp_y - frame_top)) + { + c->y = disp_y + frame_top; + frame_y = frameY (c); + } + if (frame_y + frame_height < disp_y + CLIENT_MIN_VISIBLE) + { + c->y = disp_y + CLIENT_MIN_VISIBLE - frame_height + frame_top; + frame_y = frameY (c); + } } /* Struts and other partial struts */ for (c2 = clients, i = 0; i < client_count; c2 = c2->next, i++) { - if (FLAG_TEST_ALL (c2->flags, CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE) && (c2 != c)) - { - /* Left */ - if (overlapY (frame_y, frame_y + frame_height, c2->struts[LEFT_START_Y], c2->struts[LEFT_END_Y])) - { - if (frame_x + frame_width < c2->struts[LEFT] + CLIENT_MIN_VISIBLE) - { - c->x = c2->struts[LEFT] + CLIENT_MIN_VISIBLE - frame_width + frame_left; - frame_x = frameX (c); - } - } - - /* Right */ - if (overlapY (frame_y, frame_y + frame_height, c2->struts[RIGHT_START_Y], c2->struts[RIGHT_END_Y])) - { - if (frame_x > MyDisplayFullWidth (dpy, screen) - c2->struts[RIGHT] - CLIENT_MIN_VISIBLE) - { - c->x = MyDisplayFullWidth (dpy, screen) - c2->struts[RIGHT] - CLIENT_MIN_VISIBLE + frame_left; - frame_x = frameX (c); - } - } - - /* Top */ - if (overlapX (frame_x, frame_x + frame_width, c2->struts[TOP_START_X], c2->struts[TOP_END_X])) - { - if (overlapY (frame_y, frame_y + frame_top, 0, c2->struts[TOP])) - { - c->y = c2->struts[TOP] + frame_top; - frame_y = frameY (c); - } - if (frame_y + frame_height < c2->struts[TOP] + CLIENT_MIN_VISIBLE) - { - c->y = c2->struts[TOP] + CLIENT_MIN_VISIBLE - frame_height + frame_top; - frame_y = frameY (c); - } - } - - /* Bottom */ - if (overlapX (frame_x, frame_x + frame_width, c2->struts[BOTTOM_START_X], c2->struts[BOTTOM_END_X])) - { - if (frame_y > MyDisplayFullHeight (dpy, screen) - c2->struts[BOTTOM] - CLIENT_MIN_VISIBLE) - { - c->y = MyDisplayFullHeight (dpy, screen) - c2->struts[BOTTOM] - CLIENT_MIN_VISIBLE + frame_top; - frame_y = frameY (c); - } - } - } + if (FLAG_TEST_ALL (c2->flags, CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE) && (c2 != c)) + { + /* Left */ + if (overlapY (frame_y, frame_y + frame_height, c2->struts[LEFT_START_Y], c2->struts[LEFT_END_Y])) + { + if (frame_x + frame_width < c2->struts[LEFT] + CLIENT_MIN_VISIBLE) + { + c->x = c2->struts[LEFT] + CLIENT_MIN_VISIBLE - frame_width + frame_left; + frame_x = frameX (c); + } + } + + /* Right */ + if (overlapY (frame_y, frame_y + frame_height, c2->struts[RIGHT_START_Y], c2->struts[RIGHT_END_Y])) + { + if (frame_x > gdk_screen_get_width (gscr) - c2->struts[RIGHT] - CLIENT_MIN_VISIBLE) + { + c->x = gdk_screen_get_width (gscr) - c2->struts[RIGHT] - CLIENT_MIN_VISIBLE + frame_left; + frame_x = frameX (c); + } + } + + /* Top */ + if (overlapX (frame_x, frame_x + frame_width, c2->struts[TOP_START_X], c2->struts[TOP_END_X])) + { + if (overlapY (frame_y, frame_y + frame_top, 0, c2->struts[TOP])) + { + c->y = c2->struts[TOP] + frame_top; + frame_y = frameY (c); + } + if (frame_y + frame_height < c2->struts[TOP] + CLIENT_MIN_VISIBLE) + { + c->y = c2->struts[TOP] + CLIENT_MIN_VISIBLE - frame_height + frame_top; + frame_y = frameY (c); + } + } + + /* Bottom */ + if (overlapX (frame_x, frame_x + frame_width, c2->struts[BOTTOM_START_X], c2->struts[BOTTOM_END_X])) + { + if (frame_y > gdk_screen_get_height (gscr) - c2->struts[BOTTOM] - CLIENT_MIN_VISIBLE) + { + c->y = gdk_screen_get_height (gscr) - c2->struts[BOTTOM] - CLIENT_MIN_VISIBLE + frame_top; + frame_y = frameY (c); + } + } + } } } @@ -344,27 +349,29 @@ clientKeepVisible (Client * c) cx = frameX (c) + (frameWidth (c) / 2); cy = frameY (c) + (frameHeight (c) / 2); - + /* Translate coodinates to center on physical screen */ - diff_x = abs (c->size->x - ((MyDisplayFullWidth (dpy, screen) - c->width) / 2)); - diff_y = abs (c->size->y - ((MyDisplayFullHeight (dpy, screen) - c->height) / 2)); + diff_x = abs (c->size->x - ((gdk_screen_get_width (gscr) - c->width) / 2)); + diff_y = abs (c->size->y - ((gdk_screen_get_height (gscr) - c->height) / 2)); if (((use_xinerama) && (diff_x < 25) && (diff_y < 25)) || - ((frameX (c) == 0) && (frameY (c) == 0) && (c->type & (WINDOW_TYPE_DIALOG)) && !clientIsTransient (c))) + ((frameX (c) == 0) && (frameY (c) == 0) && (c->type & (WINDOW_TYPE_DIALOG)) && !clientIsTransient (c))) { - /* We consider that the windows is centered on screen, - * Thus, will move it so its center on the current - * physical screen - */ - getMouseXY (root, &cx, &cy); - - c->x = - MyDisplayX (cx, cy) + (MyDisplayWidth (dpy, screen, cx, - cy) - c->width) / 2; - c->y = - MyDisplayY (cx, cy) + (MyDisplayHeight (dpy, screen, cx, - cy) - c->height) / 2; + GdkRectangle rect; + gint monitor_nbr; + + /* We consider that the windows is centered on screen, + * Thus, will move it so its center on the current + * physical screen + */ + getMouseXY (root, &cx, &cy); + + monitor_nbr = gdk_screen_get_monitor_at_point (gscr, cx, cy); + gdk_screen_get_monitor_geometry (gscr, monitor_nbr, &rect); + + c->x = rect.x + (rect.width - c->width) / 2; + c->y = rect.y + (rect.height - c->height) / 2; } clientConstrainPos (c, TRUE); } @@ -380,6 +387,8 @@ clientInitPosition (Client * c) int full_x, full_y, full_w, full_h; unsigned long best_overlaps = 0; gboolean first = TRUE; + GdkRectangle rect; + gint monitor_nbr; g_return_if_fail (c != NULL); TRACE ("entering clientInitPosition"); @@ -387,34 +396,33 @@ clientInitPosition (Client * c) clientGravitate (c, APPLY); if ((c->size->flags & (PPosition | USPosition)) || - (c->type & (WINDOW_TYPE_DONT_PLACE)) || - ((c->type & (WINDOW_TYPE_DIALOG)) && !clientIsTransient (c))) + (c->type & (WINDOW_TYPE_DONT_PLACE)) || + ((c->type & (WINDOW_TYPE_DIALOG)) && !clientIsTransient (c))) { - if (CONSTRAINED_WINDOW (c)) - { - clientKeepVisible (c); - } - return; + if (CONSTRAINED_WINDOW (c)) + { + clientKeepVisible (c); + } + return; } if (clientIsTransient (c) && (c2 = clientGetTransient (c))) { - /* Center transient relative to their parent window */ - c->x = c2->x + (c2->width - c->width) / 2; - c->y = c2->y + (c2->height - c->height) / 2; - if (CONSTRAINED_WINDOW (c)) - { - clientKeepVisible (c); - } - return; + /* Center transient relative to their parent window */ + c->x = c2->x + (c2->width - c->width) / 2; + c->y = c2->y + (c2->height - c->height) / 2; + if (CONSTRAINED_WINDOW (c)) + { + clientKeepVisible (c); + } + return; } getMouseXY (root, &msx, &msy); - left = (isLeftMostHead (dpy, screen, msx, msy) ? params.xfwm_margins[LEFT] : 0); - right = (isRightMostHead (dpy, screen, msx, msy) ? params.xfwm_margins[RIGHT] : 0); - top = (isTopMostHead (dpy, screen, msx, msy) ? params.xfwm_margins[TOP] : 0); - bottom = (isBottomMostHead (dpy, screen, msx, msy) ? params.xfwm_margins[BOTTOM] : 0); + monitor_nbr = gdk_screen_get_monitor_at_point (gscr, msx, msy); + gdk_screen_get_monitor_geometry (gscr, monitor_nbr, &rect); + frame_x = frameX (c); frame_y = frameY (c); frame_height = frameHeight (c); @@ -422,10 +430,13 @@ clientInitPosition (Client * c) frame_left = frameLeft(c); frame_top = frameTop (c); - full_x = MyDisplayX (msx, msy); - full_y = MyDisplayY (msx, msy); - full_w = MyDisplayWidth (dpy, screen, msx, msy); - full_h = MyDisplayHeight (dpy, screen, msx, msy); + full_x = MAX (params.xfwm_margins[LEFT], rect.x); + full_y = MAX (params.xfwm_margins[TOP], rect.y); + full_w = MIN (gdk_screen_get_width (gscr) - params.xfwm_margins[RIGHT], + full_x + rect.width) - full_x; + full_h = MIN (gdk_screen_get_height (gscr) - params.xfwm_margins[BOTTOM], + full_y + rect.height) - full_y; + /* Adjust size to the widest size available, not covering struts */ clientMaxSpace (&full_x, &full_y, &full_w, &full_h); @@ -435,51 +446,51 @@ clientInitPosition (Client * c) best_y = full_y + frameTop (c); for (test_y = full_y + frameTop (c); test_y <= ymax; - test_y += 8) + test_y += 8) { - for (test_x = full_x + frameLeft (c) + left; - test_x <= xmax; test_x += 8) - { - unsigned long count_overlaps = 0; - TRACE ("analyzing %i clients", client_count); - for (c2 = clients, i = 0; i < client_count; c2 = c2->next, i++) - { - if ((c2 != c) && (c2->type != WINDOW_DESKTOP) - && (c->win_workspace == c2->win_workspace) - && FLAG_TEST (c2->flags, CLIENT_FLAG_VISIBLE)) - { - count_overlaps += overlap (test_x - frame_left, - test_y - frame_top, - test_x - frame_left + frame_width, - test_y - frame_top + frame_height, - frameX (c2), - frameY (c2), - frameX (c2) + frameWidth (c2), - frameY (c2) + frameHeight (c2)); - } - } + for (test_x = full_x + frameLeft (c) + left; + test_x <= xmax; test_x += 8) + { + unsigned long count_overlaps = 0; + TRACE ("analyzing %i clients", client_count); + for (c2 = clients, i = 0; i < client_count; c2 = c2->next, i++) + { + if ((c2 != c) && (c2->type != WINDOW_DESKTOP) + && (c->win_workspace == c2->win_workspace) + && FLAG_TEST (c2->flags, CLIENT_FLAG_VISIBLE)) + { + count_overlaps += overlap (test_x - frame_left, + test_y - frame_top, + test_x - frame_left + frame_width, + test_y - frame_top + frame_height, + frameX (c2), + frameY (c2), + frameX (c2) + frameWidth (c2), + frameY (c2) + frameHeight (c2)); + } + } TRACE ("overlaps so far is %u", (unsigned int) count_overlaps); - if (count_overlaps == 0) - { - TRACE ("overlaps is 0 so it's the best we can get"); - c->x = test_x; - c->y = test_y; - return; - } - else if ((count_overlaps < best_overlaps) || (first)) - { + if (count_overlaps == 0) + { + TRACE ("overlaps is 0 so it's the best we can get"); + c->x = test_x; + c->y = test_y; + return; + } + else if ((count_overlaps < best_overlaps) || (first)) + { TRACE ("overlaps %u is better than the best we have %u", (unsigned int) count_overlaps, (unsigned int) best_overlaps); - best_x = test_x; - best_y = test_y; - best_overlaps = count_overlaps; - } - if (first) - { - first = FALSE; - } - } + best_x = test_x; + best_y = test_y; + best_overlaps = count_overlaps; + } + if (first) + { + first = FALSE; + } + } } c->x = best_x; c->y = best_y; diff --git a/src/poswin.c b/src/poswin.c index 51111f834..8bf119a34 100644 --- a/src/poswin.c +++ b/src/poswin.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2004 Olivier Fourdan - based on a patch from Joshua Blanton + xfwm4 - (c) 2004 Olivier Fourdan + based on a patch from Joshua Blanton */ #ifdef HAVE_CONFIG_H @@ -28,6 +28,7 @@ #include #include #include + #include "client.h" #include "frame.h" #include "poswin.h" @@ -90,11 +91,11 @@ poswinSetPosition (Poswin * poswin, Client *c) py = y + (frameHeight (c) - ph) / 2; if (GTK_WIDGET_REALIZED (poswin->window)) { - gdk_window_move_resize (poswin->window->window, px, py, pw, ph); + gdk_window_move_resize (poswin->window->window, px, py, pw, ph); } else { - gtk_window_move (GTK_WINDOW (poswin->window), px, py); + gtk_window_move (GTK_WINDOW (poswin->window), px, py); } } diff --git a/src/poswin.h b/src/poswin.h index d85fc398c..19e6093ce 100644 --- a/src/poswin.h +++ b/src/poswin.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2004 Olivier Fourdan - based on a patch from Joshua Blanton + xfwm4 - (c) 2004 Olivier Fourdan + based on a patch from Joshua Blanton */ #ifdef HAVE_CONFIG_H diff --git a/src/session.c b/src/session.c index 3e8004dcf..c8e4cf505 100644 --- a/src/session.c +++ b/src/session.c @@ -19,6 +19,10 @@ #include #endif +#include +#include +#include +#include #include #include #include @@ -27,10 +31,6 @@ #include #include #include -#include -#include -#include -#include #include "session.h" #include "main.h" @@ -73,7 +73,7 @@ my_free_string_list (gchar ** list, gint n) if (!list || !n) { - return; /* silently... :) */ + return; /* silently... :) */ } i = 0; @@ -81,10 +81,10 @@ my_free_string_list (gchar ** list, gint n) while ((i < n) && (s)) { - g_free (*s); - *s = NULL; - s++; - i++; + g_free (*s); + *s = NULL; + s++; + i++; } } @@ -108,15 +108,15 @@ escape_quote (gchar * s) idx1 = s; while (*idx1) { - if (*(idx1++) == '"') - { - nbquotes++; - } + if (*(idx1++) == '"') + { + nbquotes++; + } } /* If there is no quote in the string, return it */ if (!nbquotes) { - return (g_strdup (s)); + return (g_strdup (s)); } /* Or else, allocate memory for the new string */ @@ -126,16 +126,16 @@ escape_quote (gchar * s) idx2 = ns; while (*idx1) { - if (*idx1 == '"') - { - *(idx2++) = '\\'; - *(idx2++) = '"'; - } - else - { - *(idx2++) = *idx1; - } - idx1++; + if (*idx1 == '"') + { + *(idx2++) = '\\'; + *(idx2++) = '"'; + } + else + { + *(idx2++) = *idx1; + } + idx1++; } /* Add null char */ *idx2 = '\0'; @@ -164,24 +164,24 @@ unescape_quote (gchar * s) idx2 = ns; while (*idx1) { - if (*idx1 == '\\') - { - *(idx2++) = *idx1; - backslash = TRUE; - } - else if ((*idx1 == '"') && backslash) - { - /* Move backward to override the "\" */ - *(--idx2) = *idx1; - idx2++; - backslash = FALSE; - } - else - { - *(idx2++) = *idx1; - backslash = FALSE; - } - idx1++; + if (*idx1 == '\\') + { + *(idx2++) = *idx1; + backslash = TRUE; + } + else if ((*idx1 == '"') && backslash) + { + /* Move backward to override the "\" */ + *(--idx2) = *idx1; + idx2++; + backslash = FALSE; + } + else + { + *(idx2++) = *idx1; + backslash = FALSE; + } + idx1++; } *idx2 = '\0'; return ns; @@ -202,38 +202,38 @@ getsubstring (gchar * s, gint * length) end = skip = s; while ((*skip == ' ') || (*skip == '\t')) { - end = ++skip; - (*length)++; + end = ++skip; + (*length)++; } if (*skip == '"') { - pbrk = '"'; - end = ++skip; - (*length)++; + pbrk = '"'; + end = ++skip; + (*length)++; } else { - pbrk = ' '; + pbrk = ' '; } finished = FALSE; while ((!finished) && (*end)) { - if (*end == '\\') - { - backslash = TRUE; - } - else if ((*end == pbrk) && backslash) - { - backslash = FALSE; - } - else if (*end == pbrk) - { - finished = TRUE; - } - end++; - lg++; - (*length)++; + if (*end == '\\') + { + backslash = TRUE; + } + else if ((*end == pbrk) && backslash) + { + backslash = FALSE; + } + else if (*end == pbrk) + { + finished = TRUE; + } + end++; + lg++; + (*length)++; } ns = g_new (gchar, lg + 1); /* Skip pbrk character */ @@ -242,7 +242,7 @@ getsubstring (gchar * s, gint * length) idx2 = ns; do { - *(idx2++) = *idx1; + *(idx2++) = *idx1; } while (++idx1 < end); *idx2 = '\0'; @@ -264,86 +264,86 @@ sessionSaveWindowStates (gchar * filename) if ((f = fopen (filename, "w"))) { - for (c = clients, client_idx = 0; client_idx < client_count; - c = c->next, client_idx++) - { - if (c->client_leader != None) - { - getWindowRole (dpy, c->client_leader, &window_role); - } - else - { - window_role = NULL; - } - - fprintf (f, "[CLIENT] 0x%lx\n", c->window); - - getClientID (dpy, c->window, &client_id); - if (client_id) - { - fprintf (f, " [CLIENT_ID] %s\n", client_id); - XFree (client_id); - client_id = NULL; - } - - if (c->client_leader) - { - fprintf (f, " [CLIENT_LEADER] 0x%lx\n", c->client_leader); - } - - if (window_role) - { - fprintf (f, " [WINDOW_ROLE] %s\n", window_role); - XFree (window_role); - window_role = NULL; - } - - if (c->class.res_class) - { - fprintf (f, " [RES_NAME] %s\n", c->class.res_name); - } - - if (c->class.res_name) - { - fprintf (f, " [RES_CLASS] %s\n", c->class.res_class); - } - - if (c->name) - { - fprintf (f, " [WM_NAME] %s\n", c->name); - } - - wm_command_count = 0; - getWindowCommand (dpy, c->window, &wm_command, &wm_command_count); - if ((wm_command_count > 0) && (wm_command)) - { - gint j; - fprintf (f, " [WM_COMMAND] (%i)", wm_command_count); - for (j = 0; j < wm_command_count; j++) - { - gchar *escaped_string; - escaped_string = escape_quote (wm_command[j]); - fprintf (f, " \"%s\"", escaped_string); - g_free (escaped_string); - } - fprintf (f, "\n"); - XFreeStringList (wm_command); - wm_command = NULL; - wm_command_count = 0; - } - - fprintf (f, " [GEOMETRY] (%i,%i,%i,%i)\n", c->x, c->y, c->width, - c->height); - fprintf (f, " [GEOMETRY-MAXIMIZED] (%i,%i,%i,%i)\n", c->old_x, - c->old_y, c->old_width, c->old_height); - fprintf (f, " [DESK] %i\n", c->win_workspace); - fprintf (f, " [FLAGS] 0x%lx\n", FLAG_TEST (c->flags, - CLIENT_FLAG_STICKY | CLIENT_FLAG_HIDDEN | - CLIENT_FLAG_SHADED | CLIENT_FLAG_MAXIMIZED | - CLIENT_FLAG_NAME_CHANGED)); - } - fclose (f); - return TRUE; + for (c = clients, client_idx = 0; client_idx < client_count; + c = c->next, client_idx++) + { + if (c->client_leader != None) + { + getWindowRole (dpy, c->client_leader, &window_role); + } + else + { + window_role = NULL; + } + + fprintf (f, "[CLIENT] 0x%lx\n", c->window); + + getClientID (dpy, c->window, &client_id); + if (client_id) + { + fprintf (f, " [CLIENT_ID] %s\n", client_id); + XFree (client_id); + client_id = NULL; + } + + if (c->client_leader) + { + fprintf (f, " [CLIENT_LEADER] 0x%lx\n", c->client_leader); + } + + if (window_role) + { + fprintf (f, " [WINDOW_ROLE] %s\n", window_role); + XFree (window_role); + window_role = NULL; + } + + if (c->class.res_class) + { + fprintf (f, " [RES_NAME] %s\n", c->class.res_name); + } + + if (c->class.res_name) + { + fprintf (f, " [RES_CLASS] %s\n", c->class.res_class); + } + + if (c->name) + { + fprintf (f, " [WM_NAME] %s\n", c->name); + } + + wm_command_count = 0; + getWindowCommand (dpy, c->window, &wm_command, &wm_command_count); + if ((wm_command_count > 0) && (wm_command)) + { + gint j; + fprintf (f, " [WM_COMMAND] (%i)", wm_command_count); + for (j = 0; j < wm_command_count; j++) + { + gchar *escaped_string; + escaped_string = escape_quote (wm_command[j]); + fprintf (f, " \"%s\"", escaped_string); + g_free (escaped_string); + } + fprintf (f, "\n"); + XFreeStringList (wm_command); + wm_command = NULL; + wm_command_count = 0; + } + + fprintf (f, " [GEOMETRY] (%i,%i,%i,%i)\n", c->x, c->y, c->width, + c->height); + fprintf (f, " [GEOMETRY-MAXIMIZED] (%i,%i,%i,%i)\n", c->old_x, + c->old_y, c->old_width, c->old_height); + fprintf (f, " [DESK] %i\n", c->win_workspace); + fprintf (f, " [FLAGS] 0x%lx\n", FLAG_TEST (c->flags, + CLIENT_FLAG_STICKY | CLIENT_FLAG_HIDDEN | + CLIENT_FLAG_SHADED | CLIENT_FLAG_MAXIMIZED | + CLIENT_FLAG_NAME_CHANGED)); + } + fclose (f); + return TRUE; } return FALSE; } @@ -359,109 +359,109 @@ sessionLoadWindowStates (gchar * filename) g_return_val_if_fail (filename != NULL, FALSE); if ((f = fopen (filename, "r"))) { - while (fgets (s, sizeof (s), f)) - { - sscanf (s, "%4000s", s1); - if (!strcmp (s1, "[CLIENT]")) - { - sscanf (s, "%*s 0x%lx", &w); - num_match++; - matches = g_realloc (matches, sizeof (Match) * num_match); - matches[num_match - 1].win = w; - matches[num_match - 1].client_id = NULL; - matches[num_match - 1].res_name = NULL; - matches[num_match - 1].res_class = NULL; - matches[num_match - 1].window_role = NULL; - matches[num_match - 1].wm_name = NULL; - matches[num_match - 1].wm_command_count = 0; - matches[num_match - 1].wm_command = NULL; - matches[num_match - 1].x = 0; - matches[num_match - 1].y = 0; - matches[num_match - 1].width = 100; - matches[num_match - 1].height = 100; - matches[num_match - 1].old_x = matches[num_match - 1].x; - matches[num_match - 1].old_y = matches[num_match - 1].y; - matches[num_match - 1].old_width = - matches[num_match - 1].width; - matches[num_match - 1].old_height = - matches[num_match - 1].height; - matches[num_match - 1].desktop = 0; - matches[num_match - 1].used = FALSE; - matches[num_match - 1].flags = 0; - } - else if (!strcmp (s1, "[GEOMETRY]")) - { - sscanf (s, "%*s (%i,%i,%i,%i)", &matches[num_match - 1].x, - &matches[num_match - 1].y, &matches[num_match - 1].width, - &matches[num_match - 1].height); - } - else if (!strcmp (s1, "[GEOMETRY-MAXIMIZED]")) - { - sscanf (s, "%*s (%i,%i,%i,%i)", &matches[num_match - 1].old_x, - &matches[num_match - 1].old_y, - &matches[num_match - 1].old_width, - &matches[num_match - 1].old_height); - } - else if (!strcmp (s1, "[DESK]")) - { - sscanf (s, "%*s %i", &matches[num_match - 1].desktop); - } - else if (!strcmp (s1, "[CLIENT_LEADER]")) - { - sscanf (s, "%*s 0x%lx", - &matches[num_match - 1].client_leader); - } - else if (!strcmp (s1, "[FLAGS]")) - { - sscanf (s, "%*s 0x%lx", &matches[num_match - 1].flags); - } - else if (!strcmp (s1, "[CLIENT_ID]")) - { - sscanf (s, "%*s %[^\n]", s1); - matches[num_match - 1].client_id = strdup (s1); - } - else if (!strcmp (s1, "[WINDOW_ROLE]")) - { - sscanf (s, "%*s %[^\n]", s1); - matches[num_match - 1].window_role = strdup (s1); - } - else if (!strcmp (s1, "[RES_NAME]")) - { - sscanf (s, "%*s %[^\n]", s1); - matches[num_match - 1].res_name = strdup (s1); - } - else if (!strcmp (s1, "[RES_CLASS]")) - { - sscanf (s, "%*s %[^\n]", s1); - matches[num_match - 1].res_class = strdup (s1); - } - else if (!strcmp (s1, "[WM_NAME]")) - { - sscanf (s, "%*s %[^\n]", s1); - matches[num_match - 1].wm_name = strdup (s1); - } - else if (!strcmp (s1, "[WM_COMMAND]")) - { - sscanf (s, "%*s (%i)%n", - &matches[num_match - 1].wm_command_count, &pos); - matches[num_match - 1].wm_command = - g_new (gchar *, - matches[num_match - 1].wm_command_count + 1); - for (i = 0; i < matches[num_match - 1].wm_command_count; i++) - { - gchar *substring; - substring = getsubstring (s + pos, &pos1); - pos += pos1; - matches[num_match - 1].wm_command[i] = - unescape_quote (substring); - g_free (substring); - } - matches[num_match - 1].wm_command[matches[num_match - - 1].wm_command_count] = NULL; - } - } - fclose (f); - return TRUE; + while (fgets (s, sizeof (s), f)) + { + sscanf (s, "%4000s", s1); + if (!strcmp (s1, "[CLIENT]")) + { + sscanf (s, "%*s 0x%lx", &w); + num_match++; + matches = g_realloc (matches, sizeof (Match) * num_match); + matches[num_match - 1].win = w; + matches[num_match - 1].client_id = NULL; + matches[num_match - 1].res_name = NULL; + matches[num_match - 1].res_class = NULL; + matches[num_match - 1].window_role = NULL; + matches[num_match - 1].wm_name = NULL; + matches[num_match - 1].wm_command_count = 0; + matches[num_match - 1].wm_command = NULL; + matches[num_match - 1].x = 0; + matches[num_match - 1].y = 0; + matches[num_match - 1].width = 100; + matches[num_match - 1].height = 100; + matches[num_match - 1].old_x = matches[num_match - 1].x; + matches[num_match - 1].old_y = matches[num_match - 1].y; + matches[num_match - 1].old_width = + matches[num_match - 1].width; + matches[num_match - 1].old_height = + matches[num_match - 1].height; + matches[num_match - 1].desktop = 0; + matches[num_match - 1].used = FALSE; + matches[num_match - 1].flags = 0; + } + else if (!strcmp (s1, "[GEOMETRY]")) + { + sscanf (s, "%*s (%i,%i,%i,%i)", &matches[num_match - 1].x, + &matches[num_match - 1].y, &matches[num_match - 1].width, + &matches[num_match - 1].height); + } + else if (!strcmp (s1, "[GEOMETRY-MAXIMIZED]")) + { + sscanf (s, "%*s (%i,%i,%i,%i)", &matches[num_match - 1].old_x, + &matches[num_match - 1].old_y, + &matches[num_match - 1].old_width, + &matches[num_match - 1].old_height); + } + else if (!strcmp (s1, "[DESK]")) + { + sscanf (s, "%*s %i", &matches[num_match - 1].desktop); + } + else if (!strcmp (s1, "[CLIENT_LEADER]")) + { + sscanf (s, "%*s 0x%lx", + &matches[num_match - 1].client_leader); + } + else if (!strcmp (s1, "[FLAGS]")) + { + sscanf (s, "%*s 0x%lx", &matches[num_match - 1].flags); + } + else if (!strcmp (s1, "[CLIENT_ID]")) + { + sscanf (s, "%*s %[^\n]", s1); + matches[num_match - 1].client_id = strdup (s1); + } + else if (!strcmp (s1, "[WINDOW_ROLE]")) + { + sscanf (s, "%*s %[^\n]", s1); + matches[num_match - 1].window_role = strdup (s1); + } + else if (!strcmp (s1, "[RES_NAME]")) + { + sscanf (s, "%*s %[^\n]", s1); + matches[num_match - 1].res_name = strdup (s1); + } + else if (!strcmp (s1, "[RES_CLASS]")) + { + sscanf (s, "%*s %[^\n]", s1); + matches[num_match - 1].res_class = strdup (s1); + } + else if (!strcmp (s1, "[WM_NAME]")) + { + sscanf (s, "%*s %[^\n]", s1); + matches[num_match - 1].wm_name = strdup (s1); + } + else if (!strcmp (s1, "[WM_COMMAND]")) + { + sscanf (s, "%*s (%i)%n", + &matches[num_match - 1].wm_command_count, &pos); + matches[num_match - 1].wm_command = + g_new (gchar *, + matches[num_match - 1].wm_command_count + 1); + for (i = 0; i < matches[num_match - 1].wm_command_count; i++) + { + gchar *substring; + substring = getsubstring (s + pos, &pos1); + pos += pos1; + matches[num_match - 1].wm_command[i] = + unescape_quote (substring); + g_free (substring); + } + matches[num_match - 1].wm_command[matches[num_match - + 1].wm_command_count] = NULL; + } + } + fclose (f); + return TRUE; } return FALSE; } @@ -472,45 +472,45 @@ sessionFreeWindowStates (void) int i; for (i = 0; i < num_match; i++) { - if (matches[i].client_id) - { - free (matches[i].client_id); - matches[i].client_id = NULL; - } - if (matches[i].res_name) - { - free (matches[i].res_name); - matches[i].res_name = NULL; - } - if (matches[i].res_class) - { - free (matches[i].res_class); - matches[i].res_class = NULL; - } - if (matches[i].window_role) - { - free (matches[i].window_role); - matches[i].window_role = NULL; - } - if (matches[i].wm_name) - { - free (matches[i].wm_name); - matches[i].wm_name = NULL; - } - if ((matches[i].wm_command_count) && (matches[i].wm_command)) - { - my_free_string_list (matches[i].wm_command, - matches[i].wm_command_count); - g_free (matches[i].wm_command); - matches[i].wm_command_count = 0; - matches[i].wm_command = NULL; - } + if (matches[i].client_id) + { + free (matches[i].client_id); + matches[i].client_id = NULL; + } + if (matches[i].res_name) + { + free (matches[i].res_name); + matches[i].res_name = NULL; + } + if (matches[i].res_class) + { + free (matches[i].res_class); + matches[i].res_class = NULL; + } + if (matches[i].window_role) + { + free (matches[i].window_role); + matches[i].window_role = NULL; + } + if (matches[i].wm_name) + { + free (matches[i].wm_name); + matches[i].wm_name = NULL; + } + if ((matches[i].wm_command_count) && (matches[i].wm_command)) + { + my_free_string_list (matches[i].wm_command, + matches[i].wm_command_count); + g_free (matches[i].wm_command); + matches[i].wm_command_count = 0; + matches[i].wm_command = NULL; + } } if (matches) { - g_free (matches); - matches = NULL; - num_match = 0; + g_free (matches); + matches = NULL; + num_match = 0; } } @@ -534,96 +534,96 @@ matchWin (Client * c, Match * m) getClientID (dpy, c->window, &client_id); if (xstreq (client_id, m->client_id)) { - /* client_id's match */ - if (c->client_leader != None) - { - getWindowRole (dpy, c->client_leader, &window_role); - } - else - { - window_role = NULL; - } - if ((window_role) || (m->window_role)) - { - /* We have or had a window role, base decision on it */ - found = xstreq (window_role, m->window_role); - } - else - { - /* Compare res_class, res_name and WM_NAME, unless the - * WM_NAME has changed - */ - if (xstreq (c->class.res_name, m->res_name) - && (FLAG_TEST (c->flags, CLIENT_FLAG_NAME_CHANGED) - || (m->flags & CLIENT_FLAG_NAME_CHANGED) - || xstreq (c->name, m->wm_name))) - { - if (client_id) - { - /* If we have a client_id, we don't compare - WM_COMMAND, since it will be different. */ - found = TRUE; - - } - else - { - /* for non-SM-aware clients we also compare WM_COMMAND */ - wm_command_count = 0; - getWindowCommand (dpy, c->window, &wm_command, - &wm_command_count); - if (wm_command_count == m->wm_command_count) - { - for (i = 0; i < wm_command_count; i++) - { - if (strcmp (wm_command[i], m->wm_command[i]) != 0) - break; - } - - if ((i == wm_command_count) && (wm_command_count)) - { - found = TRUE; - } - } /* if (wm_command_count ==... */ - /* We have to deal with a now-SM-aware client, it means that it won't probably - * restore its state in a proper manner. - * Thus, we also mark all other instances of this application as used, to avoid - * dummy side effects in case we found a matching entry. - */ - if (found) - { - for (i = 0; i < num_match; i++) - { - if (!(matches[i].used) && !(&matches[i] == m) - && (m->client_leader) - && (matches[i].client_leader == - m->client_leader)) - { - matches[i].used = TRUE; - } - } - } - } - } - } + /* client_id's match */ + if (c->client_leader != None) + { + getWindowRole (dpy, c->client_leader, &window_role); + } + else + { + window_role = NULL; + } + if ((window_role) || (m->window_role)) + { + /* We have or had a window role, base decision on it */ + found = xstreq (window_role, m->window_role); + } + else + { + /* Compare res_class, res_name and WM_NAME, unless the + * WM_NAME has changed + */ + if (xstreq (c->class.res_name, m->res_name) + && (FLAG_TEST (c->flags, CLIENT_FLAG_NAME_CHANGED) + || (m->flags & CLIENT_FLAG_NAME_CHANGED) + || xstreq (c->name, m->wm_name))) + { + if (client_id) + { + /* If we have a client_id, we don't compare + WM_COMMAND, since it will be different. */ + found = TRUE; + + } + else + { + /* for non-SM-aware clients we also compare WM_COMMAND */ + wm_command_count = 0; + getWindowCommand (dpy, c->window, &wm_command, + &wm_command_count); + if (wm_command_count == m->wm_command_count) + { + for (i = 0; i < wm_command_count; i++) + { + if (strcmp (wm_command[i], m->wm_command[i]) != 0) + break; + } + + if ((i == wm_command_count) && (wm_command_count)) + { + found = TRUE; + } + } /* if (wm_command_count ==... */ + /* We have to deal with a now-SM-aware client, it means that it won't probably + * restore its state in a proper manner. + * Thus, we also mark all other instances of this application as used, to avoid + * dummy side effects in case we found a matching entry. + */ + if (found) + { + for (i = 0; i < num_match; i++) + { + if (!(matches[i].used) && !(&matches[i] == m) + && (m->client_leader) + && (matches[i].client_leader == + m->client_leader)) + { + matches[i].used = TRUE; + } + } + } + } + } + } } if (client_id) { - XFree (client_id); - client_id = NULL; + XFree (client_id); + client_id = NULL; } if (window_role) { - XFree (window_role); - window_role = NULL; + XFree (window_role); + window_role = NULL; } if ((wm_command_count > 0) && (wm_command)) { - XFreeStringList (wm_command); - wm_command = NULL; - wm_command_count = 0; + XFreeStringList (wm_command); + wm_command = NULL; + wm_command_count = 0; } return found; @@ -637,25 +637,25 @@ sessionMatchWinToSM (Client * c) g_return_val_if_fail (c != NULL, FALSE); for (i = 0; i < num_match; i++) { - if (!matches[i].used && matchWin (c, &matches[i])) - { - matches[i].used = TRUE; - c->x = matches[i].x; - c->y = matches[i].y; - c->width = matches[i].width; - c->height = matches[i].height; - c->old_x = matches[i].old_x; - c->old_y = matches[i].old_y; - c->old_width = matches[i].old_width; - c->old_height = matches[i].old_height; - c->win_workspace = matches[i].desktop; - FLAG_SET (c->flags, - matches[i]. - flags & (CLIENT_FLAG_STICKY | CLIENT_FLAG_SHADED | - CLIENT_FLAG_MAXIMIZED | CLIENT_FLAG_HIDDEN)); - FLAG_SET (c->flags, CLIENT_FLAG_WORKSPACE_SET); - return TRUE; - } + if (!matches[i].used && matchWin (c, &matches[i])) + { + matches[i].used = TRUE; + c->x = matches[i].x; + c->y = matches[i].y; + c->width = matches[i].width; + c->height = matches[i].height; + c->old_x = matches[i].old_x; + c->old_y = matches[i].old_y; + c->old_width = matches[i].old_width; + c->old_height = matches[i].old_height; + c->win_workspace = matches[i].desktop; + FLAG_SET (c->flags, + matches[i]. + flags & (CLIENT_FLAG_STICKY | CLIENT_FLAG_SHADED | + CLIENT_FLAG_MAXIMIZED | CLIENT_FLAG_HIDDEN)); + FLAG_SET (c->flags, CLIENT_FLAG_WORKSPACE_SET); + return TRUE; + } } return FALSE; } diff --git a/src/session.h b/src/session.h index cd2a548df..5b841c2b5 100644 --- a/src/session.h +++ b/src/session.h @@ -12,7 +12,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - xfwm4 - (c) 2003 Olivier Fourdan + xfwm4 - (c) 2003 Olivier Fourdan */ diff --git a/src/settings.c b/src/settings.c index b9535cfb3..1fe7b26fc 100644 --- a/src/settings.c +++ b/src/settings.c @@ -1,30 +1,26 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ #ifdef HAVE_CONFIG_H #include #endif -#ifdef GDK_MULTIHEAD_SAFE -#undef GDK_MULTIHEAD_SAFE -#endif - #include #include #include @@ -63,40 +59,40 @@ set_settings_margin (int idx, int value) switch (idx) { - case LEFT: - case RIGHT: - if (value < 0) - { - val = 0; - } - else if (value > MyDisplayFullWidth (dpy, screen) / 4) - { - val = MyDisplayFullWidth (dpy, screen) / 4; - } - else - { - val = value; - } - params.xfwm_margins[idx] = val; - break; - case TOP: - case BOTTOM: - if (value < 0) - { - val = 0; - } - else if (value > MyDisplayFullHeight (dpy, screen) / 4) - { - val = MyDisplayFullHeight (dpy, screen) / 4; - } - else - { - val = value; - } - params.xfwm_margins[idx] = val; - break; - default: - break; + case LEFT: + case RIGHT: + if (value < 0) + { + val = 0; + } + else if (value > gdk_screen_get_width (gscr) / 4) + { + val = gdk_screen_get_width (gscr) / 4; + } + else + { + val = value; + } + params.xfwm_margins[idx] = val; + break; + case TOP: + case BOTTOM: + if (value < 0) + { + val = 0; + } + else if (value > gdk_screen_get_height (gscr) / 4) + { + val = gdk_screen_get_height (gscr) / 4; + } + else + { + val = value; + } + params.xfwm_margins[idx] = val; + break; + default: + break; } } @@ -106,167 +102,167 @@ notify_cb (const char *name, const char *channel_name, McsAction action, { if (!g_ascii_strcasecmp (CHANNEL1, channel_name)) { - switch (action) - { - case MCS_ACTION_NEW: - /* The following is to reduce initial startup time and reloads */ - if (!mcs_initted) - { - return; - } - case MCS_ACTION_CHANGED: - if (setting->type == MCS_TYPE_INT) - { - if (!strcmp (name, "Xfwm/ClickToFocus")) - { - params.click_to_focus = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/FocusNewWindow")) - { - params.focus_new = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/FocusRaise")) - { - params.raise_on_focus = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/RaiseDelay")) - { - params.raise_delay = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/RaiseOnClick")) - { - params.raise_on_click = setting->data.v_int; - clientPassGrabButton1 (NULL); - } - else if (!strcmp (name, "Xfwm/SnapToBorder")) - { - params.snap_to_border = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/SnapToWindows")) - { - params.snap_to_windows = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/SnapWidth")) - { - params.snap_width = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/WrapWorkspaces")) - { - params.wrap_workspaces = setting->data.v_int; - placeSidewalks (params.wrap_workspaces); - } - else if (!strcmp (name, "Xfwm/WrapWindows")) - { - params.wrap_windows = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/WrapResistance")) - { - params.wrap_resistance = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/BoxMove")) - { - params.box_move = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/BoxResize")) - { - params.box_resize = setting->data.v_int; - } - } - else if (setting->type == MCS_TYPE_STRING) - { - if (!strcmp (name, "Xfwm/DblClickAction")) - { - reloadSettings (NO_UPDATE_FLAG); - } - else if (!strcmp (name, "Xfwm/KeyThemeName")) - { - reloadSettings (UPDATE_KEYGRABS); - } - else if (!strcmp (name, "Xfwm/ThemeName")) - { - reloadSettings (UPDATE_GRAVITY | UPDATE_CACHE); - } - else if (!strcmp (name, "Xfwm/ButtonLayout")) - { - reloadSettings (UPDATE_FRAME | UPDATE_CACHE); - } - if (!strcmp (name, "Xfwm/TitleAlign")) - { - reloadSettings (UPDATE_FRAME | UPDATE_CACHE); - } - if (!strcmp (name, "Xfwm/TitleFont")) - { - reloadSettings (UPDATE_FRAME | UPDATE_CACHE); - } - } - break; - case MCS_ACTION_DELETED: - default: - break; - } + switch (action) + { + case MCS_ACTION_NEW: + /* The following is to reduce initial startup time and reloads */ + if (!mcs_initted) + { + return; + } + case MCS_ACTION_CHANGED: + if (setting->type == MCS_TYPE_INT) + { + if (!strcmp (name, "Xfwm/ClickToFocus")) + { + params.click_to_focus = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/FocusNewWindow")) + { + params.focus_new = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/FocusRaise")) + { + params.raise_on_focus = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/RaiseDelay")) + { + params.raise_delay = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/RaiseOnClick")) + { + params.raise_on_click = setting->data.v_int; + clientPassGrabButton1 (NULL); + } + else if (!strcmp (name, "Xfwm/SnapToBorder")) + { + params.snap_to_border = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/SnapToWindows")) + { + params.snap_to_windows = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/SnapWidth")) + { + params.snap_width = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/WrapWorkspaces")) + { + params.wrap_workspaces = setting->data.v_int; + placeSidewalks (params.wrap_workspaces); + } + else if (!strcmp (name, "Xfwm/WrapWindows")) + { + params.wrap_windows = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/WrapResistance")) + { + params.wrap_resistance = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/BoxMove")) + { + params.box_move = setting->data.v_int; + } + else if (!strcmp (name, "Xfwm/BoxResize")) + { + params.box_resize = setting->data.v_int; + } + } + else if (setting->type == MCS_TYPE_STRING) + { + if (!strcmp (name, "Xfwm/DblClickAction")) + { + reloadSettings (NO_UPDATE_FLAG); + } + else if (!strcmp (name, "Xfwm/KeyThemeName")) + { + reloadSettings (UPDATE_KEYGRABS); + } + else if (!strcmp (name, "Xfwm/ThemeName")) + { + reloadSettings (UPDATE_GRAVITY | UPDATE_CACHE); + } + else if (!strcmp (name, "Xfwm/ButtonLayout")) + { + reloadSettings (UPDATE_FRAME | UPDATE_CACHE); + } + if (!strcmp (name, "Xfwm/TitleAlign")) + { + reloadSettings (UPDATE_FRAME | UPDATE_CACHE); + } + if (!strcmp (name, "Xfwm/TitleFont")) + { + reloadSettings (UPDATE_FRAME | UPDATE_CACHE); + } + } + break; + case MCS_ACTION_DELETED: + default: + break; + } } else if (!g_ascii_strcasecmp (CHANNEL2, channel_name)) { - switch (action) - { - case MCS_ACTION_NEW: - /* The following is to reduce initial startup time and reloads */ - if (!mcs_initted) - { - return; - } - case MCS_ACTION_CHANGED: - if (setting->type == MCS_TYPE_INT) - { - if (!strcmp (name, "Xfwm/LeftMargin")) - { - set_settings_margin (LEFT, - setting->data.v_int); - } - else if (!strcmp (name, "Xfwm/RightMargin")) - { - set_settings_margin (RIGHT, - setting->data.v_int); - } - else if (!strcmp (name, "Xfwm/BottomMargin")) - { - set_settings_margin (BOTTOM, - setting->data.v_int); - } - else if (!strcmp (name, "Xfwm/TopMargin")) - { - set_settings_margin (TOP, setting->data.v_int); - } - } - break; - case MCS_ACTION_DELETED: - default: - break; - } + switch (action) + { + case MCS_ACTION_NEW: + /* The following is to reduce initial startup time and reloads */ + if (!mcs_initted) + { + return; + } + case MCS_ACTION_CHANGED: + if (setting->type == MCS_TYPE_INT) + { + if (!strcmp (name, "Xfwm/LeftMargin")) + { + set_settings_margin (LEFT, + setting->data.v_int); + } + else if (!strcmp (name, "Xfwm/RightMargin")) + { + set_settings_margin (RIGHT, + setting->data.v_int); + } + else if (!strcmp (name, "Xfwm/BottomMargin")) + { + set_settings_margin (BOTTOM, + setting->data.v_int); + } + else if (!strcmp (name, "Xfwm/TopMargin")) + { + set_settings_margin (TOP, setting->data.v_int); + } + } + break; + case MCS_ACTION_DELETED: + default: + break; + } } else if (!g_ascii_strcasecmp (CHANNEL3, channel_name)) { - switch (action) - { - case MCS_ACTION_NEW: - /* The following is to reduce initial startup time and reloads */ - if (!mcs_initted) - { - return; - } - case MCS_ACTION_CHANGED: - if (setting->type == MCS_TYPE_INT) - { - if (!strcmp (name, "Xfwm/WorkspaceCount")) - { - workspaceSetCount(setting->data.v_int); - } - } - break; - case MCS_ACTION_DELETED: - default: - break; - } + switch (action) + { + case MCS_ACTION_NEW: + /* The following is to reduce initial startup time and reloads */ + if (!mcs_initted) + { + return; + } + case MCS_ACTION_CHANGED: + if (setting->type == MCS_TYPE_INT) + { + if (!strcmp (name, "Xfwm/WorkspaceCount")) + { + workspaceSetCount(setting->data.v_int); + } + } + break; + case MCS_ACTION_DELETED: + default: + break; + } } } @@ -274,9 +270,9 @@ static GdkFilterReturn client_event_filter (GdkXEvent * xevent, GdkEvent * event, gpointer data) { if (mcs_client_process_event (client, (XEvent *) xevent)) - return GDK_FILTER_REMOVE; + return GDK_FILTER_REMOVE; else - return GDK_FILTER_CONTINUE; + return GDK_FILTER_CONTINUE; } static void @@ -288,21 +284,21 @@ watch_cb (Window window, Bool is_start, long mask, void *cb_data) if (is_start) { - if (!gdkwin) - { - gdkwin = gdk_window_foreign_new (window); - } - else - { - g_object_ref (gdkwin); - } - gdk_window_add_filter (gdkwin, client_event_filter, cb_data); + if (!gdkwin) + { + gdkwin = gdk_window_foreign_new (window); + } + else + { + g_object_ref (gdkwin); + } + gdk_window_add_filter (gdkwin, client_event_filter, cb_data); } else { - g_assert (gdkwin); - gdk_window_remove_filter (gdkwin, client_event_filter, cb_data); - g_object_unref (gdkwin); + g_assert (gdkwin); + gdk_window_remove_filter (gdkwin, client_event_filter, cb_data); + g_object_unref (gdkwin); } } @@ -315,15 +311,15 @@ loadRcData (Settings rc[]) if (!parseRc ("defaults", PACKAGE_DATADIR, rc)) { - g_warning (_("%s: Missing defaults file"), progname); - exit (1); + g_warning (_("%s: Missing defaults file"), progname); + exit (1); } keythemevalue = getValue ("keytheme", rc); if (keythemevalue) { - keytheme = getThemeDir (keythemevalue, KEYTHEMERC); - parseRc (KEYTHEMERC, keytheme, rc); - g_free (keytheme); + keytheme = getThemeDir (keythemevalue, KEYTHEMERC); + parseRc (KEYTHEMERC, keytheme, rc); + g_free (keytheme); } parseRc ("xfwm4rc", homedir, rc); } @@ -334,151 +330,151 @@ loadMcsData (Settings rc[]) McsSetting *setting; if (client) { - if (mcs_client_get_setting (client, "Xfwm/ClickToFocus", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("click_to_focus", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/FocusNewWindow", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("focus_new", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/FocusRaise", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("raise_on_focus", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/RaiseDelay", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("raise_delay", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/RaiseOnClick", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("raise_on_click", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/SnapToBorder", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("snap_to_border", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/SnapToWindows", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("snap_to_windows", setting->data.v_int, - rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/SnapWidth", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("snap_width", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/WrapWorkspaces", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("wrap_workspaces", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/WrapWindows", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("wrap_windows", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/WrapResistance", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("wrap_resistance", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/BoxMove", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("box_move", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/BoxResize", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("box_resize", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/DblClickAction", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("double_click_action", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/ThemeName", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("theme", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/KeyThemeName", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("keytheme", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/ButtonLayout", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("button_layout", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/TitleAlign", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("title_alignment", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/TitleFont", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("title_font", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/LeftMargin", CHANNEL2, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("margin_left", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/RightMargin", CHANNEL2, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("margin_right", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/BottomMargin", CHANNEL2, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("margin_bottom", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/TopMargin", CHANNEL2, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("margin_top", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (client, "Xfwm/WorkspaceCount", CHANNEL3, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("workspace_count", setting->data.v_int, rc); - mcs_setting_free (setting); - } + if (mcs_client_get_setting (client, "Xfwm/ClickToFocus", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("click_to_focus", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/FocusNewWindow", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("focus_new", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/FocusRaise", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("raise_on_focus", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/RaiseDelay", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("raise_delay", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/RaiseOnClick", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("raise_on_click", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/SnapToBorder", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("snap_to_border", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/SnapToWindows", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("snap_to_windows", setting->data.v_int, + rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/SnapWidth", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("snap_width", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/WrapWorkspaces", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("wrap_workspaces", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/WrapWindows", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("wrap_windows", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/WrapResistance", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("wrap_resistance", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/BoxMove", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("box_move", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/BoxResize", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setBooleanValueFromInt ("box_resize", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/DblClickAction", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setValue ("double_click_action", setting->data.v_string, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/ThemeName", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setValue ("theme", setting->data.v_string, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/KeyThemeName", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setValue ("keytheme", setting->data.v_string, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/ButtonLayout", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setValue ("button_layout", setting->data.v_string, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/TitleAlign", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setValue ("title_alignment", setting->data.v_string, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/TitleFont", CHANNEL1, + &setting) == MCS_SUCCESS) + { + setValue ("title_font", setting->data.v_string, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/LeftMargin", CHANNEL2, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("margin_left", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/RightMargin", CHANNEL2, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("margin_right", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/BottomMargin", CHANNEL2, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("margin_bottom", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/TopMargin", CHANNEL2, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("margin_top", setting->data.v_int, rc); + mcs_setting_free (setting); + } + if (mcs_client_get_setting (client, "Xfwm/WorkspaceCount", CHANNEL3, + &setting) == MCS_SUCCESS) + { + setIntValueFromInt ("workspace_count", setting->data.v_int, rc); + mcs_setting_free (setting); + } } } @@ -518,240 +514,240 @@ loadTheme (Settings rc[]) for (i = 0; i < 20; i++) { - colsym[i].name = rc[i].option; - colsym[i].value = rc[i].value; + colsym[i].name = rc[i].option; + colsym[i].value = rc[i].value; } if (params.title_colors[ACTIVE].allocated) { - gdk_colormap_free_colors (gdk_rgb_get_cmap (), - ¶ms.title_colors[ACTIVE].col, 1); - params.title_colors[ACTIVE].allocated = FALSE; + gdk_colormap_free_colors (gdk_screen_get_rgb_colormap (gscr), + ¶ms.title_colors[ACTIVE].col, 1); + params.title_colors[ACTIVE].allocated = FALSE; } if (gdk_color_parse (rc[0].value, ¶ms.title_colors[ACTIVE].col)) { - if (gdk_colormap_alloc_color (gdk_rgb_get_cmap (), - ¶ms.title_colors[ACTIVE].col, FALSE, FALSE)) - { - params.title_colors[ACTIVE].allocated = TRUE; - if (params.title_colors[ACTIVE].gc) - { - g_object_unref (G_OBJECT (params.title_colors[ACTIVE].gc)); - } - params.title_colors[ACTIVE].gc = - gdk_gc_new (getDefaultGdkWindow ()); - gdk_gc_copy (params.title_colors[ACTIVE].gc, get_style_gc (widget, - "text", "selected")); - gdk_gc_set_foreground (params.title_colors[ACTIVE].gc, - ¶ms.title_colors[ACTIVE].col); - } - else - { - gdk_beep (); - g_message (_("%s: Cannot allocate active color %s\n"), - g_get_prgname (), rc[0].value); - } + if (gdk_colormap_alloc_color (gdk_screen_get_rgb_colormap (gscr), + ¶ms.title_colors[ACTIVE].col, FALSE, FALSE)) + { + params.title_colors[ACTIVE].allocated = TRUE; + if (params.title_colors[ACTIVE].gc) + { + g_object_unref (G_OBJECT (params.title_colors[ACTIVE].gc)); + } + params.title_colors[ACTIVE].gc = + gdk_gc_new (getDefaultGdkWindow ()); + gdk_gc_copy (params.title_colors[ACTIVE].gc, get_style_gc (widget, + "text", "selected")); + gdk_gc_set_foreground (params.title_colors[ACTIVE].gc, + ¶ms.title_colors[ACTIVE].col); + } + else + { + gdk_beep (); + g_message (_("%s: Cannot allocate active color %s\n"), + g_get_prgname (), rc[0].value); + } } else { - gdk_beep (); - g_message (_("%s: Cannot parse active color %s\n"), g_get_prgname (), - rc[0].value); + gdk_beep (); + g_message (_("%s: Cannot parse active color %s\n"), g_get_prgname (), + rc[0].value); } if (params.black_gc) { - g_object_unref (G_OBJECT (params.black_gc)); + g_object_unref (G_OBJECT (params.black_gc)); } params.black_gc = widget->style->black_gc; g_object_ref (G_OBJECT (widget->style->black_gc)); if (params.white_gc) { - g_object_unref (G_OBJECT (params.white_gc)); + g_object_unref (G_OBJECT (params.white_gc)); } params.white_gc = widget->style->white_gc; g_object_ref (G_OBJECT (widget->style->white_gc)); if (params.title_colors[INACTIVE].allocated) { - gdk_colormap_free_colors (gdk_rgb_get_cmap (), - ¶ms.title_colors[INACTIVE].col, 1); - params.title_colors[INACTIVE].allocated = FALSE; + gdk_colormap_free_colors (gdk_screen_get_rgb_colormap (gscr), + ¶ms.title_colors[INACTIVE].col, 1); + params.title_colors[INACTIVE].allocated = FALSE; } if (gdk_color_parse (rc[1].value, ¶ms.title_colors[INACTIVE].col)) { - if (gdk_colormap_alloc_color (gdk_rgb_get_cmap (), - ¶ms.title_colors[INACTIVE].col, FALSE, FALSE)) - { - params.title_colors[INACTIVE].allocated = TRUE; - if (params.title_colors[INACTIVE].gc) - { - g_object_unref (G_OBJECT (params.title_colors[INACTIVE].gc)); - } - params.title_colors[INACTIVE].gc = - gdk_gc_new (getDefaultGdkWindow ()); - gdk_gc_copy (params.title_colors[INACTIVE].gc, - get_style_gc (widget, "text", "normal")); - gdk_gc_set_foreground (params.title_colors[INACTIVE].gc, - ¶ms.title_colors[INACTIVE].col); - } - else - { - gdk_beep (); - g_message (_("%s: Cannot allocate inactive color %s\n"), - g_get_prgname (), rc[1].value); - } + if (gdk_colormap_alloc_color (gdk_screen_get_rgb_colormap (gscr), + ¶ms.title_colors[INACTIVE].col, FALSE, FALSE)) + { + params.title_colors[INACTIVE].allocated = TRUE; + if (params.title_colors[INACTIVE].gc) + { + g_object_unref (G_OBJECT (params.title_colors[INACTIVE].gc)); + } + params.title_colors[INACTIVE].gc = + gdk_gc_new (getDefaultGdkWindow ()); + gdk_gc_copy (params.title_colors[INACTIVE].gc, + get_style_gc (widget, "text", "normal")); + gdk_gc_set_foreground (params.title_colors[INACTIVE].gc, + ¶ms.title_colors[INACTIVE].col); + } + else + { + gdk_beep (); + g_message (_("%s: Cannot allocate inactive color %s\n"), + g_get_prgname (), rc[1].value); + } } else { - gdk_beep (); - g_message (_("%s: Cannot parse inactive color %s\n"), - g_get_prgname (), rc[1].value); + gdk_beep (); + g_message (_("%s: Cannot parse inactive color %s\n"), + g_get_prgname (), rc[1].value); } font = getValue ("title_font", rc); if (font && strlen (font)) { - desc = pango_font_description_from_string (font); - if (desc) - { - gtk_widget_modify_font (widget, desc); - } + desc = pango_font_description_from_string (font); + if (desc) + { + gtk_widget_modify_font (widget, desc); + } } myPixmapLoad (dpy, ¶ms.sides[SIDE_LEFT][ACTIVE], theme, - "left-active", colsym, 20); + "left-active", colsym, 20); myPixmapLoad (dpy, ¶ms.sides[SIDE_LEFT][INACTIVE], theme, - "left-inactive", colsym, 20); + "left-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.sides[SIDE_RIGHT][ACTIVE], theme, - "right-active", colsym, 20); + "right-active", colsym, 20); myPixmapLoad (dpy, ¶ms.sides[SIDE_RIGHT][INACTIVE], theme, - "right-inactive", colsym, 20); + "right-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.sides[SIDE_BOTTOM][ACTIVE], theme, - "bottom-active", colsym, 20); + "bottom-active", colsym, 20); myPixmapLoad (dpy, ¶ms.sides[SIDE_BOTTOM][INACTIVE], theme, - "bottom-inactive", colsym, 20); + "bottom-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.corners[CORNER_TOP_LEFT][ACTIVE], theme, - "top-left-active", colsym, 20); + "top-left-active", colsym, 20); myPixmapLoad (dpy, ¶ms.corners[CORNER_TOP_LEFT][INACTIVE], theme, - "top-left-inactive", colsym, 20); + "top-left-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.corners[CORNER_TOP_RIGHT][ACTIVE], theme, - "top-right-active", colsym, 20); + "top-right-active", colsym, 20); myPixmapLoad (dpy, ¶ms.corners[CORNER_TOP_RIGHT][INACTIVE], theme, - "top-right-inactive", colsym, 20); + "top-right-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.corners[CORNER_BOTTOM_LEFT][ACTIVE], theme, - "bottom-left-active", colsym, 20); + "bottom-left-active", colsym, 20); myPixmapLoad (dpy, ¶ms.corners[CORNER_BOTTOM_LEFT][INACTIVE], theme, - "bottom-left-inactive", colsym, 20); + "bottom-left-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.corners[CORNER_BOTTOM_RIGHT][ACTIVE], theme, - "bottom-right-active", colsym, 20); + "bottom-right-active", colsym, 20); myPixmapLoad (dpy, ¶ms.corners[CORNER_BOTTOM_RIGHT][INACTIVE], theme, - "bottom-right-inactive", colsym, 20); + "bottom-right-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[HIDE_BUTTON][ACTIVE], theme, - "hide-active", colsym, 20); + "hide-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[HIDE_BUTTON][INACTIVE], theme, - "hide-inactive", colsym, 20); + "hide-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[HIDE_BUTTON][PRESSED], theme, - "hide-pressed", colsym, 20); + "hide-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[CLOSE_BUTTON][ACTIVE], theme, - "close-active", colsym, 20); + "close-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[CLOSE_BUTTON][INACTIVE], theme, - "close-inactive", colsym, 20); + "close-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[CLOSE_BUTTON][PRESSED], theme, - "close-pressed", colsym, 20); + "close-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MAXIMIZE_BUTTON][ACTIVE], theme, - "maximize-active", colsym, 20); + "maximize-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MAXIMIZE_BUTTON][INACTIVE], theme, - "maximize-inactive", colsym, 20); + "maximize-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MAXIMIZE_BUTTON][PRESSED], theme, - "maximize-pressed", colsym, 20); + "maximize-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[SHADE_BUTTON][ACTIVE], theme, - "shade-active", colsym, 20); + "shade-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[SHADE_BUTTON][INACTIVE], theme, - "shade-inactive", colsym, 20); + "shade-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[SHADE_BUTTON][PRESSED], theme, - "shade-pressed", colsym, 20); + "shade-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[STICK_BUTTON][ACTIVE], theme, - "stick-active", colsym, 20); + "stick-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[STICK_BUTTON][INACTIVE], theme, - "stick-inactive", colsym, 20); + "stick-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[STICK_BUTTON][PRESSED], theme, - "stick-pressed", colsym, 20); + "stick-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MENU_BUTTON][ACTIVE], theme, - "menu-active", colsym, 20); + "menu-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MENU_BUTTON][INACTIVE], theme, - "menu-inactive", colsym, 20); + "menu-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MENU_BUTTON][PRESSED], theme, - "menu-pressed", colsym, 20); + "menu-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[SHADE_BUTTON][T_ACTIVE], theme, - "shade-toggled-active", colsym, 20); + "shade-toggled-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[SHADE_BUTTON][T_INACTIVE], theme, - "shade-toggled-inactive", colsym, 20); + "shade-toggled-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[SHADE_BUTTON][T_PRESSED], theme, - "shade-toggled-pressed", colsym, 20); + "shade-toggled-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[STICK_BUTTON][T_ACTIVE], theme, - "stick-toggled-active", colsym, 20); + "stick-toggled-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[STICK_BUTTON][T_INACTIVE], theme, - "stick-toggled-inactive", colsym, 20); + "stick-toggled-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[STICK_BUTTON][T_PRESSED], theme, - "stick-toggled-pressed", colsym, 20); + "stick-toggled-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MAXIMIZE_BUTTON][T_ACTIVE], theme, - "maximize-toggled-active", colsym, 20); + "maximize-toggled-active", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MAXIMIZE_BUTTON][T_INACTIVE], theme, - "maximize-toggled-inactive", colsym, 20); + "maximize-toggled-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.buttons[MAXIMIZE_BUTTON][T_PRESSED], theme, - "maximize-toggled-pressed", colsym, 20); + "maximize-toggled-pressed", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_1][ACTIVE], theme, - "title-1-active", colsym, 20); + "title-1-active", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_1][INACTIVE], theme, - "title-1-inactive", colsym, 20); + "title-1-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_2][ACTIVE], theme, - "title-2-active", colsym, 20); + "title-2-active", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_2][INACTIVE], theme, - "title-2-inactive", colsym, 20); + "title-2-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_3][ACTIVE], theme, - "title-3-active", colsym, 20); + "title-3-active", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_3][INACTIVE], theme, - "title-3-inactive", colsym, 20); + "title-3-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_4][ACTIVE], theme, - "title-4-active", colsym, 20); + "title-4-active", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_4][INACTIVE], theme, - "title-4-inactive", colsym, 20); + "title-4-inactive", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_5][ACTIVE], theme, - "title-5-active", colsym, 20); + "title-5-active", colsym, 20); myPixmapLoad (dpy, ¶ms.title[TITLE_5][INACTIVE], theme, - "title-5-inactive", colsym, 20); + "title-5-inactive", colsym, 20); if (!g_ascii_strcasecmp ("left", getValue ("title_alignment", rc))) { - params.title_alignment = ALIGN_LEFT; + params.title_alignment = ALIGN_LEFT; } else if (!g_ascii_strcasecmp ("right", getValue ("title_alignment", rc))) { - params.title_alignment = ALIGN_RIGHT; + params.title_alignment = ALIGN_RIGHT; } else { - params.title_alignment = ALIGN_CENTER; + params.title_alignment = ALIGN_CENTER; } params.full_width_title = - !g_ascii_strcasecmp ("true", getValue ("full_width_title", rc)); + !g_ascii_strcasecmp ("true", getValue ("full_width_title", rc)); params.title_shadow[ACTIVE] = - !g_ascii_strcasecmp ("true", getValue ("title_shadow_active", rc)); + !g_ascii_strcasecmp ("true", getValue ("title_shadow_active", rc)); params.title_shadow[INACTIVE] = - !g_ascii_strcasecmp ("true", getValue ("title_shadow_inactive", rc)); + !g_ascii_strcasecmp ("true", getValue ("title_shadow_inactive", rc)); strncpy (params.button_layout, getValue ("button_layout", rc), 7); params.button_spacing = TOINT (getValue ("button_spacing", rc)); params.button_offset = TOINT (getValue ("button_offset", rc)); params.title_vertical_offset_active = - TOINT (getValue ("title_vertical_offset_active", rc)); + TOINT (getValue ("title_vertical_offset_active", rc)); params.title_vertical_offset_inactive = - TOINT (getValue ("title_vertical_offset_inactive", rc)); + TOINT (getValue ("title_vertical_offset_inactive", rc)); params.title_horizontal_offset = - TOINT (getValue ("title_horizontal_offset", rc)); + TOINT (getValue ("title_horizontal_offset", rc)); params.box_gc = createGC (cmap, "#FFFFFF", GXxor, NULL, 2, TRUE); @@ -765,19 +761,19 @@ loadShortcutCmd (Settings rc[]) for (i = 0; i < NB_KEY_SHORTCUTS; i++) { - gchar *tmp, *shortcut; - tmp = g_strdup_printf ("shortcut_%i_exec", i + 1); - if (params.shortcut_exec[i]) - { - g_free (params.shortcut_exec[i]); - params.shortcut_exec[i] = NULL; - } - shortcut = getValue (tmp, rc); - if (shortcut) - { - params.shortcut_exec[i] = g_strdup (shortcut); - } - g_free (tmp); + gchar *tmp, *shortcut; + tmp = g_strdup_printf ("shortcut_%i_exec", i + 1); + if (params.shortcut_exec[i]) + { + g_free (params.shortcut_exec[i]); + params.shortcut_exec[i] = NULL; + } + shortcut = getValue (tmp, rc); + if (shortcut) + { + params.shortcut_exec[i] = g_strdup (shortcut); + } + g_free (tmp); } } @@ -790,130 +786,130 @@ loadKeyBindings (Settings rc[]) keythemevalue = getValue ("keytheme", rc); if (keythemevalue) { - keytheme = getThemeDir (keythemevalue, KEYTHEMERC); - if (!parseRc (KEYTHEMERC, keytheme, rc)) - { - g_warning (_("%s: specified key theme \"%s\" missing, using default"), - progname, keythemevalue); - g_free (keytheme); - keytheme = getThemeDir (DEFAULT_KEYTHEME, KEYTHEMERC); - parseRc (KEYTHEMERC, keytheme, rc); - } - g_free (keytheme); - - if (!checkRc (rc)) - { - g_warning (_("%s: Missing values in defaults file"), progname); - return FALSE; - } + keytheme = getThemeDir (keythemevalue, KEYTHEMERC); + if (!parseRc (KEYTHEMERC, keytheme, rc)) + { + g_warning (_("%s: specified key theme \"%s\" missing, using default"), + progname, keythemevalue); + g_free (keytheme); + keytheme = getThemeDir (DEFAULT_KEYTHEME, KEYTHEMERC); + parseRc (KEYTHEMERC, keytheme, rc); + } + g_free (keytheme); + + if (!checkRc (rc)) + { + g_warning (_("%s: Missing values in defaults file"), progname); + return FALSE; + } } loadShortcutCmd (rc); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_UP], - getValue ("move_window_up_key", rc)); + getValue ("move_window_up_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_DOWN], - getValue ("move_window_down_key", rc)); + getValue ("move_window_down_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_LEFT], - getValue ("move_window_left_key", rc)); + getValue ("move_window_left_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_RIGHT], - getValue ("move_window_right_key", rc)); + getValue ("move_window_right_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_RESIZE_UP], - getValue ("resize_window_up_key", rc)); + getValue ("resize_window_up_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_RESIZE_DOWN], - getValue ("resize_window_down_key", rc)); + getValue ("resize_window_down_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_RESIZE_LEFT], - getValue ("resize_window_left_key", rc)); + getValue ("resize_window_left_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_RESIZE_RIGHT], - getValue ("resize_window_right_key", rc)); + getValue ("resize_window_right_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_CYCLE_WINDOWS], - getValue ("cycle_windows_key", rc)); + getValue ("cycle_windows_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_CLOSE_WINDOW], - getValue ("close_window_key", rc)); + getValue ("close_window_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_HIDE_WINDOW], - getValue ("hide_window_key", rc)); + getValue ("hide_window_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MAXIMIZE_WINDOW], - getValue ("maximize_window_key", rc)); + getValue ("maximize_window_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MAXIMIZE_VERT], - getValue ("maximize_vert_key", rc)); + getValue ("maximize_vert_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MAXIMIZE_HORIZ], - getValue ("maximize_horiz_key", rc)); + getValue ("maximize_horiz_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHADE_WINDOW], - getValue ("shade_window_key", rc)); + getValue ("shade_window_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_NEXT_WORKSPACE], - getValue ("next_workspace_key", rc)); + getValue ("next_workspace_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_PREV_WORKSPACE], - getValue ("prev_workspace_key", rc)); + getValue ("prev_workspace_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_ADD_WORKSPACE], - getValue ("add_workspace_key", rc)); + getValue ("add_workspace_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_DEL_WORKSPACE], - getValue ("del_workspace_key", rc)); + getValue ("del_workspace_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_STICK_WINDOW], - getValue ("stick_window_key", rc)); + getValue ("stick_window_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_1], - getValue ("workspace_1_key", rc)); + getValue ("workspace_1_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_2], - getValue ("workspace_2_key", rc)); + getValue ("workspace_2_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_3], - getValue ("workspace_3_key", rc)); + getValue ("workspace_3_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_4], - getValue ("workspace_4_key", rc)); + getValue ("workspace_4_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_5], - getValue ("workspace_5_key", rc)); + getValue ("workspace_5_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_6], - getValue ("workspace_6_key", rc)); + getValue ("workspace_6_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_7], - getValue ("workspace_7_key", rc)); + getValue ("workspace_7_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_8], - getValue ("workspace_8_key", rc)); + getValue ("workspace_8_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_WORKSPACE_9], - getValue ("workspace_9_key", rc)); + getValue ("workspace_9_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_NEXT_WORKSPACE], - getValue ("move_window_next_workspace_key", rc)); + getValue ("move_window_next_workspace_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_PREV_WORKSPACE], - getValue ("move_window_prev_workspace_key", rc)); + getValue ("move_window_prev_workspace_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_1], - getValue ("move_window_workspace_1_key", rc)); + getValue ("move_window_workspace_1_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_2], - getValue ("move_window_workspace_2_key", rc)); + getValue ("move_window_workspace_2_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_3], - getValue ("move_window_workspace_3_key", rc)); + getValue ("move_window_workspace_3_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_4], - getValue ("move_window_workspace_4_key", rc)); + getValue ("move_window_workspace_4_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_5], - getValue ("move_window_workspace_5_key", rc)); + getValue ("move_window_workspace_5_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_6], - getValue ("move_window_workspace_6_key", rc)); + getValue ("move_window_workspace_6_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_7], - getValue ("move_window_workspace_7_key", rc)); + getValue ("move_window_workspace_7_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_8], - getValue ("move_window_workspace_8_key", rc)); + getValue ("move_window_workspace_8_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_MOVE_WORKSPACE_9], - getValue ("move_window_workspace_9_key", rc)); + getValue ("move_window_workspace_9_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_1], - getValue ("shortcut_1_key", rc)); + getValue ("shortcut_1_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_2], - getValue ("shortcut_2_key", rc)); + getValue ("shortcut_2_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_3], - getValue ("shortcut_3_key", rc)); + getValue ("shortcut_3_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_4], - getValue ("shortcut_4_key", rc)); + getValue ("shortcut_4_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_5], - getValue ("shortcut_5_key", rc)); + getValue ("shortcut_5_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_6], - getValue ("shortcut_6_key", rc)); + getValue ("shortcut_6_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_7], - getValue ("shortcut_7_key", rc)); + getValue ("shortcut_7_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_8], - getValue ("shortcut_8_key", rc)); + getValue ("shortcut_8_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_9], - getValue ("shortcut_9_key", rc)); + getValue ("shortcut_9_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_SHORTCUT_10], - getValue ("shortcut_10_key", rc)); + getValue ("shortcut_10_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_RAISE_WINDOW], - getValue ("raise_window_key", rc)); + getValue ("raise_window_key", rc)); parseKeyString (dpy, ¶ms.keys[KEY_LOWER_WINDOW], - getValue ("lower_window_key", rc)); + getValue ("lower_window_key", rc)); ungrabKeys (dpy, gnome_win); grabKey (dpy, ¶ms.keys[KEY_CYCLE_WINDOWS], gnome_win); grabKey (dpy, ¶ms.keys[KEY_NEXT_WORKSPACE], gnome_win); @@ -947,128 +943,128 @@ gboolean loadSettings (void) { Settings rc[] = { - /* Do not chnage the order of the following parameters */ - {"active_text_color", NULL, FALSE}, - {"inactive_text_color", NULL, FALSE}, - {"active_border_color", NULL, FALSE}, - {"inactive_border_color", NULL, FALSE}, - {"active_color_1", NULL, FALSE}, - {"active_hilight_1", NULL, FALSE}, - {"active_shadow_1", NULL, FALSE}, - {"active_mid_1", NULL, FALSE}, - {"active_color_2", NULL, FALSE}, - {"active_hilight_2", NULL, FALSE}, - {"active_shadow_2", NULL, FALSE}, - {"active_mid_2", NULL, FALSE}, - {"inactive_color_1", NULL, FALSE}, - {"inactive_hilight_1", NULL, FALSE}, - {"inactive_shadow_1", NULL, FALSE}, - {"inactive_mid_1", NULL, FALSE}, - {"inactive_color_2", NULL, FALSE}, - {"inactive_hilight_2", NULL, FALSE}, - {"inactive_shadow_2", NULL, FALSE}, - {"inactive_mid_2", NULL, FALSE}, - /* You can change the order of the following parameters */ - {"box_move", NULL, TRUE}, - {"box_resize", NULL, TRUE}, - {"button_layout", NULL, TRUE}, - {"button_offset", NULL, TRUE}, - {"button_spacing", NULL, TRUE}, - {"click_to_focus", NULL, TRUE}, - {"cycle_minimum", NULL, FALSE}, - {"dbl_click_time", NULL, TRUE}, - {"double_click_action", NULL, TRUE}, - {"easy_click", NULL, FALSE}, - {"focus_hint", NULL, FALSE}, - {"focus_new", NULL, TRUE}, - {"full_width_title", NULL, TRUE}, - {"keytheme", NULL, TRUE}, - {"margin_left", NULL, FALSE}, - {"margin_right", NULL, FALSE}, - {"margin_bottom", NULL, FALSE}, - {"margin_top", NULL, FALSE}, - {"raise_delay", NULL, TRUE}, - {"raise_on_click", NULL, TRUE}, - {"raise_on_focus", NULL, TRUE}, - {"snap_to_border", NULL, TRUE}, - {"snap_to_windows", NULL, TRUE}, - {"snap_width", NULL, TRUE}, - {"theme", NULL, TRUE}, - {"title_alignment", NULL, TRUE}, - {"title_font", NULL, FALSE}, - {"title_horizontal_offset", NULL, TRUE}, - {"title_shadow_active", NULL, TRUE}, - {"title_shadow_inactive", NULL, TRUE}, - {"title_vertical_offset_active", NULL, TRUE}, - {"title_vertical_offset_inactive", NULL, TRUE}, - {"workspace_count", NULL, TRUE}, - {"wrap_windows", NULL, TRUE}, - {"wrap_workspaces", NULL, TRUE}, - {"wrap_resistance", NULL, TRUE}, - /* Keys */ - {"add_workspace_key", NULL, TRUE}, - {"close_window_key", NULL, TRUE}, - {"cycle_windows_key", NULL, TRUE}, - {"del_workspace_key", NULL, TRUE}, - {"hide_window_key", NULL, TRUE}, - {"maximize_horiz_key", NULL, TRUE}, - {"maximize_vert_key", NULL, TRUE}, - {"maximize_window_key", NULL, TRUE}, - {"move_window_down_key", NULL, TRUE}, - {"move_window_left_key", NULL, TRUE}, - {"move_window_next_workspace_key", NULL, TRUE}, - {"move_window_prev_workspace_key", NULL, TRUE}, - {"move_window_right_key", NULL, TRUE}, - {"move_window_up_key", NULL, TRUE}, - {"move_window_workspace_1_key", NULL, TRUE}, - {"move_window_workspace_2_key", NULL, TRUE}, - {"move_window_workspace_3_key", NULL, TRUE}, - {"move_window_workspace_4_key", NULL, TRUE}, - {"move_window_workspace_5_key", NULL, TRUE}, - {"move_window_workspace_6_key", NULL, TRUE}, - {"move_window_workspace_7_key", NULL, TRUE}, - {"move_window_workspace_8_key", NULL, TRUE}, - {"move_window_workspace_9_key", NULL, TRUE}, - {"next_workspace_key", NULL, TRUE}, - {"prev_workspace_key", NULL, TRUE}, - {"resize_window_down_key", NULL, TRUE}, - {"resize_window_left_key", NULL, TRUE}, - {"resize_window_right_key", NULL, TRUE}, - {"resize_window_up_key", NULL, TRUE}, - {"shade_window_key", NULL, TRUE}, - {"stick_window_key", NULL, TRUE}, - {"workspace_1_key", NULL, TRUE}, - {"workspace_2_key", NULL, TRUE}, - {"workspace_3_key", NULL, TRUE}, - {"workspace_4_key", NULL, TRUE}, - {"workspace_5_key", NULL, TRUE}, - {"workspace_6_key", NULL, TRUE}, - {"workspace_7_key", NULL, TRUE}, - {"workspace_8_key", NULL, TRUE}, - {"workspace_9_key", NULL, TRUE}, - {"shortcut_1_key", NULL, TRUE}, - {"shortcut_2_key", NULL, TRUE}, - {"shortcut_3_key", NULL, TRUE}, - {"shortcut_4_key", NULL, TRUE}, - {"shortcut_5_key", NULL, TRUE}, - {"shortcut_6_key", NULL, TRUE}, - {"shortcut_7_key", NULL, TRUE}, - {"shortcut_8_key", NULL, TRUE}, - {"shortcut_9_key", NULL, TRUE}, - {"shortcut_10_key", NULL, TRUE}, - {"shortcut_1_exec", NULL, FALSE}, - {"shortcut_2_exec", NULL, FALSE}, - {"shortcut_3_exec", NULL, FALSE}, - {"shortcut_4_exec", NULL, FALSE}, - {"shortcut_5_exec", NULL, FALSE}, - {"shortcut_6_exec", NULL, FALSE}, - {"shortcut_7_exec", NULL, FALSE}, - {"shortcut_8_exec", NULL, FALSE}, - {"shortcut_9_exec", NULL, FALSE}, - {"shortcut_10_exec", NULL, FALSE}, - {"raise_window_key", NULL, TRUE}, - {"lower_window_key", NULL, TRUE}, - {NULL, NULL, FALSE} + /* Do not chnage the order of the following parameters */ + {"active_text_color", NULL, FALSE}, + {"inactive_text_color", NULL, FALSE}, + {"active_border_color", NULL, FALSE}, + {"inactive_border_color", NULL, FALSE}, + {"active_color_1", NULL, FALSE}, + {"active_hilight_1", NULL, FALSE}, + {"active_shadow_1", NULL, FALSE}, + {"active_mid_1", NULL, FALSE}, + {"active_color_2", NULL, FALSE}, + {"active_hilight_2", NULL, FALSE}, + {"active_shadow_2", NULL, FALSE}, + {"active_mid_2", NULL, FALSE}, + {"inactive_color_1", NULL, FALSE}, + {"inactive_hilight_1", NULL, FALSE}, + {"inactive_shadow_1", NULL, FALSE}, + {"inactive_mid_1", NULL, FALSE}, + {"inactive_color_2", NULL, FALSE}, + {"inactive_hilight_2", NULL, FALSE}, + {"inactive_shadow_2", NULL, FALSE}, + {"inactive_mid_2", NULL, FALSE}, + /* You can change the order of the following parameters */ + {"box_move", NULL, TRUE}, + {"box_resize", NULL, TRUE}, + {"button_layout", NULL, TRUE}, + {"button_offset", NULL, TRUE}, + {"button_spacing", NULL, TRUE}, + {"click_to_focus", NULL, TRUE}, + {"cycle_minimum", NULL, FALSE}, + {"dbl_click_time", NULL, TRUE}, + {"double_click_action", NULL, TRUE}, + {"easy_click", NULL, FALSE}, + {"focus_hint", NULL, FALSE}, + {"focus_new", NULL, TRUE}, + {"full_width_title", NULL, TRUE}, + {"keytheme", NULL, TRUE}, + {"margin_left", NULL, FALSE}, + {"margin_right", NULL, FALSE}, + {"margin_bottom", NULL, FALSE}, + {"margin_top", NULL, FALSE}, + {"raise_delay", NULL, TRUE}, + {"raise_on_click", NULL, TRUE}, + {"raise_on_focus", NULL, TRUE}, + {"snap_to_border", NULL, TRUE}, + {"snap_to_windows", NULL, TRUE}, + {"snap_width", NULL, TRUE}, + {"theme", NULL, TRUE}, + {"title_alignment", NULL, TRUE}, + {"title_font", NULL, FALSE}, + {"title_horizontal_offset", NULL, TRUE}, + {"title_shadow_active", NULL, TRUE}, + {"title_shadow_inactive", NULL, TRUE}, + {"title_vertical_offset_active", NULL, TRUE}, + {"title_vertical_offset_inactive", NULL, TRUE}, + {"workspace_count", NULL, TRUE}, + {"wrap_windows", NULL, TRUE}, + {"wrap_workspaces", NULL, TRUE}, + {"wrap_resistance", NULL, TRUE}, + /* Keys */ + {"add_workspace_key", NULL, TRUE}, + {"close_window_key", NULL, TRUE}, + {"cycle_windows_key", NULL, TRUE}, + {"del_workspace_key", NULL, TRUE}, + {"hide_window_key", NULL, TRUE}, + {"maximize_horiz_key", NULL, TRUE}, + {"maximize_vert_key", NULL, TRUE}, + {"maximize_window_key", NULL, TRUE}, + {"move_window_down_key", NULL, TRUE}, + {"move_window_left_key", NULL, TRUE}, + {"move_window_next_workspace_key", NULL, TRUE}, + {"move_window_prev_workspace_key", NULL, TRUE}, + {"move_window_right_key", NULL, TRUE}, + {"move_window_up_key", NULL, TRUE}, + {"move_window_workspace_1_key", NULL, TRUE}, + {"move_window_workspace_2_key", NULL, TRUE}, + {"move_window_workspace_3_key", NULL, TRUE}, + {"move_window_workspace_4_key", NULL, TRUE}, + {"move_window_workspace_5_key", NULL, TRUE}, + {"move_window_workspace_6_key", NULL, TRUE}, + {"move_window_workspace_7_key", NULL, TRUE}, + {"move_window_workspace_8_key", NULL, TRUE}, + {"move_window_workspace_9_key", NULL, TRUE}, + {"next_workspace_key", NULL, TRUE}, + {"prev_workspace_key", NULL, TRUE}, + {"resize_window_down_key", NULL, TRUE}, + {"resize_window_left_key", NULL, TRUE}, + {"resize_window_right_key", NULL, TRUE}, + {"resize_window_up_key", NULL, TRUE}, + {"shade_window_key", NULL, TRUE}, + {"stick_window_key", NULL, TRUE}, + {"workspace_1_key", NULL, TRUE}, + {"workspace_2_key", NULL, TRUE}, + {"workspace_3_key", NULL, TRUE}, + {"workspace_4_key", NULL, TRUE}, + {"workspace_5_key", NULL, TRUE}, + {"workspace_6_key", NULL, TRUE}, + {"workspace_7_key", NULL, TRUE}, + {"workspace_8_key", NULL, TRUE}, + {"workspace_9_key", NULL, TRUE}, + {"shortcut_1_key", NULL, TRUE}, + {"shortcut_2_key", NULL, TRUE}, + {"shortcut_3_key", NULL, TRUE}, + {"shortcut_4_key", NULL, TRUE}, + {"shortcut_5_key", NULL, TRUE}, + {"shortcut_6_key", NULL, TRUE}, + {"shortcut_7_key", NULL, TRUE}, + {"shortcut_8_key", NULL, TRUE}, + {"shortcut_9_key", NULL, TRUE}, + {"shortcut_10_key", NULL, TRUE}, + {"shortcut_1_exec", NULL, FALSE}, + {"shortcut_2_exec", NULL, FALSE}, + {"shortcut_3_exec", NULL, FALSE}, + {"shortcut_4_exec", NULL, FALSE}, + {"shortcut_5_exec", NULL, FALSE}, + {"shortcut_6_exec", NULL, FALSE}, + {"shortcut_7_exec", NULL, FALSE}, + {"shortcut_8_exec", NULL, FALSE}, + {"shortcut_9_exec", NULL, FALSE}, + {"shortcut_10_exec", NULL, FALSE}, + {"raise_window_key", NULL, TRUE}, + {"lower_window_key", NULL, TRUE}, + {NULL, NULL, FALSE} }; GValue tmp_val = { 0, }; @@ -1080,85 +1076,85 @@ loadSettings (void) if (!loadKeyBindings (rc)) { - freeRc (rc); - return FALSE; + freeRc (rc); + return FALSE; } params.box_resize = - !g_ascii_strcasecmp ("true", getValue ("box_resize", rc)); + !g_ascii_strcasecmp ("true", getValue ("box_resize", rc)); params.box_move = !g_ascii_strcasecmp ("true", getValue ("box_move", rc)); params.click_to_focus = - !g_ascii_strcasecmp ("true", getValue ("click_to_focus", rc)); + !g_ascii_strcasecmp ("true", getValue ("click_to_focus", rc)); params.easy_click = - !g_ascii_strcasecmp ("true", getValue ("easy_click", rc)); + !g_ascii_strcasecmp ("true", getValue ("easy_click", rc)); params.cycle_minimum = - !g_ascii_strcasecmp ("true", getValue ("cycle_minimum", rc)); + !g_ascii_strcasecmp ("true", getValue ("cycle_minimum", rc)); params.focus_hint = - !g_ascii_strcasecmp ("true", getValue ("focus_hint", rc)); + !g_ascii_strcasecmp ("true", getValue ("focus_hint", rc)); params.focus_new = - !g_ascii_strcasecmp ("true", getValue ("focus_new", rc)); + !g_ascii_strcasecmp ("true", getValue ("focus_new", rc)); params.raise_on_focus = - !g_ascii_strcasecmp ("true", getValue ("raise_on_focus", rc)); + !g_ascii_strcasecmp ("true", getValue ("raise_on_focus", rc)); params.raise_delay = abs (TOINT (getValue ("raise_delay", rc))); params.raise_on_click = - !g_ascii_strcasecmp ("true", getValue ("raise_on_click", rc)); + !g_ascii_strcasecmp ("true", getValue ("raise_on_click", rc)); params.snap_to_border = - !g_ascii_strcasecmp ("true", getValue ("snap_to_border", rc)); + !g_ascii_strcasecmp ("true", getValue ("snap_to_border", rc)); params.snap_to_windows = - !g_ascii_strcasecmp ("true", getValue ("snap_to_windows", rc)); + !g_ascii_strcasecmp ("true", getValue ("snap_to_windows", rc)); params.snap_width = abs (TOINT (getValue ("snap_width", rc))); params.dbl_click_time = abs (TOINT (getValue ("dbl_click_time", rc))); set_settings_margin (LEFT, TOINT (getValue ("margin_left", rc))); set_settings_margin (RIGHT, TOINT (getValue ("margin_right", rc))); set_settings_margin (BOTTOM, TOINT (getValue ("margin_bottom", - rc))); + rc))); set_settings_margin (TOP, TOINT (getValue ("margin_top", rc))); g_value_init (&tmp_val, G_TYPE_INT); if (gdk_setting_get ("gtk-double-click-time", &tmp_val)) { - params.dbl_click_time = abs (g_value_get_int (&tmp_val)); + params.dbl_click_time = abs (g_value_get_int (&tmp_val)); } if (!g_ascii_strcasecmp ("shade", getValue ("double_click_action", rc))) { - params.double_click_action = ACTION_SHADE; + params.double_click_action = ACTION_SHADE; } else if (!g_ascii_strcasecmp ("hide", getValue ("double_click_action", - rc))) + rc))) { - params.double_click_action = ACTION_HIDE; + params.double_click_action = ACTION_HIDE; } else if (!g_ascii_strcasecmp ("maximize", getValue ("double_click_action", - rc))) + rc))) { - params.double_click_action = ACTION_MAXIMIZE; + params.double_click_action = ACTION_MAXIMIZE; } else { - params.double_click_action = ACTION_NONE; + params.double_click_action = ACTION_NONE; } if (params.workspace_count < 0) { - gint workspace_count; - workspace_count = abs (TOINT (getValue ("workspace_count", rc))); - if (workspace_count < 0) - { - workspace_count = 0; - } - g_message (_("%s: Workspace count not set, using rc value: %i"), - g_get_prgname (), workspace_count); - workspaceSetCount (workspace_count); + gint workspace_count; + workspace_count = abs (TOINT (getValue ("workspace_count", rc))); + if (workspace_count < 0) + { + workspace_count = 0; + } + g_message (_("%s: Workspace count not set, using rc value: %i"), + g_get_prgname (), workspace_count); + workspaceSetCount (workspace_count); } params.wrap_workspaces = - !g_ascii_strcasecmp ("true", getValue ("wrap_workspaces", rc)); + !g_ascii_strcasecmp ("true", getValue ("wrap_workspaces", rc)); params.wrap_windows = - !g_ascii_strcasecmp ("true", getValue ("wrap_windows", rc)); + !g_ascii_strcasecmp ("true", getValue ("wrap_windows", rc)); params.wrap_resistance = abs (TOINT (getValue ("wrap_resistance", rc))); freeRc (rc); @@ -1173,32 +1169,32 @@ unloadTheme (void) for (i = 0; i < 3; i++) { - myPixmapFree (dpy, ¶ms.sides[i][ACTIVE]); - myPixmapFree (dpy, ¶ms.sides[i][INACTIVE]); + myPixmapFree (dpy, ¶ms.sides[i][ACTIVE]); + myPixmapFree (dpy, ¶ms.sides[i][INACTIVE]); } for (i = 0; i < 4; i++) { - myPixmapFree (dpy, ¶ms.corners[i][ACTIVE]); - myPixmapFree (dpy, ¶ms.corners[i][INACTIVE]); + myPixmapFree (dpy, ¶ms.corners[i][ACTIVE]); + myPixmapFree (dpy, ¶ms.corners[i][INACTIVE]); } for (i = 0; i < BUTTON_COUNT; i++) { - myPixmapFree (dpy, ¶ms.buttons[i][ACTIVE]); - myPixmapFree (dpy, ¶ms.buttons[i][INACTIVE]); - myPixmapFree (dpy, ¶ms.buttons[i][PRESSED]); - myPixmapFree (dpy, ¶ms.buttons[i][T_ACTIVE]); - myPixmapFree (dpy, ¶ms.buttons[i][T_INACTIVE]); - myPixmapFree (dpy, ¶ms.buttons[i][T_PRESSED]); + myPixmapFree (dpy, ¶ms.buttons[i][ACTIVE]); + myPixmapFree (dpy, ¶ms.buttons[i][INACTIVE]); + myPixmapFree (dpy, ¶ms.buttons[i][PRESSED]); + myPixmapFree (dpy, ¶ms.buttons[i][T_ACTIVE]); + myPixmapFree (dpy, ¶ms.buttons[i][T_INACTIVE]); + myPixmapFree (dpy, ¶ms.buttons[i][T_PRESSED]); } for (i = 0; i < 5; i++) { - myPixmapFree (dpy, ¶ms.title[i][ACTIVE]); - myPixmapFree (dpy, ¶ms.title[i][INACTIVE]); + myPixmapFree (dpy, ¶ms.title[i][ACTIVE]); + myPixmapFree (dpy, ¶ms.title[i][INACTIVE]); } if (params.box_gc != None) { - XFreeGC (dpy, params.box_gc); - params.box_gc = None; + XFreeGC (dpy, params.box_gc); + params.box_gc = None; } } @@ -1210,11 +1206,11 @@ reloadSettings (int mask) unloadTheme (); if (!loadSettings ()) { - return FALSE; + return FALSE; } if (mask) { - clientUpdateAllFrames (mask); + clientUpdateAllFrames (mask); } return TRUE; @@ -1241,72 +1237,72 @@ initSettings (void) for (i = 0; i < NB_KEY_SHORTCUTS; i++) { - params.shortcut_exec[i] = NULL; + params.shortcut_exec[i] = NULL; } for (i = 0; i < 3; i++) { - myPixmapInit (¶ms.sides[i][ACTIVE]); - myPixmapInit (¶ms.sides[i][INACTIVE]); + myPixmapInit (¶ms.sides[i][ACTIVE]); + myPixmapInit (¶ms.sides[i][INACTIVE]); } for (i = 0; i < 4; i++) { - myPixmapInit (¶ms.corners[i][ACTIVE]); - myPixmapInit (¶ms.corners[i][INACTIVE]); + myPixmapInit (¶ms.corners[i][ACTIVE]); + myPixmapInit (¶ms.corners[i][INACTIVE]); } for (i = 0; i < BUTTON_COUNT; i++) { - myPixmapInit (¶ms.buttons[i][ACTIVE]); - myPixmapInit (¶ms.buttons[i][INACTIVE]); - myPixmapInit (¶ms.buttons[i][PRESSED]); - myPixmapInit (¶ms.buttons[i][T_ACTIVE]); - myPixmapInit (¶ms.buttons[i][T_INACTIVE]); - myPixmapInit (¶ms.buttons[i][T_PRESSED]); + myPixmapInit (¶ms.buttons[i][ACTIVE]); + myPixmapInit (¶ms.buttons[i][INACTIVE]); + myPixmapInit (¶ms.buttons[i][PRESSED]); + myPixmapInit (¶ms.buttons[i][T_ACTIVE]); + myPixmapInit (¶ms.buttons[i][T_INACTIVE]); + myPixmapInit (¶ms.buttons[i][T_PRESSED]); } for (i = 0; i < 5; i++) { - myPixmapInit (¶ms.title[i][ACTIVE]); - myPixmapInit (¶ms.title[i][INACTIVE]); + myPixmapInit (¶ms.title[i][ACTIVE]); + myPixmapInit (¶ms.title[i][INACTIVE]); } if (!mcs_client_check_manager (dpy, screen, "xfce-mcs-manager")) { - g_warning ("MCS manager not running"); + g_warning ("MCS manager not running"); } client = mcs_client_new (dpy, screen, notify_cb, watch_cb, NULL); if (client) { - mcs_client_add_channel (client, CHANNEL1); - mcs_client_add_channel (client, CHANNEL2); - mcs_client_add_channel (client, CHANNEL3); + mcs_client_add_channel (client, CHANNEL1); + mcs_client_add_channel (client, CHANNEL2); + mcs_client_add_channel (client, CHANNEL3); } else { - g_warning ("Cannot create MCS client channel"); + g_warning ("Cannot create MCS client channel"); } mcs_initted = TRUE; if (getHint (dpy, root, net_number_of_desktops, &val)) { - workspaceSetCount (val); + workspaceSetCount (val); } else if (getHint (dpy, root, win_workspace_count, &val)) { - workspaceSetCount (val); + workspaceSetCount (val); } if (getUTF8String (dpy, root, net_desktop_names, &names, &i)) { - workspaceSetNames (names, i); + workspaceSetNames (names, i); } else { - params.workspace_names = NULL; - params.workspace_names_length = 0; + params.workspace_names = NULL; + params.workspace_names_length = 0; } if (!loadSettings ()) { - return FALSE; + return FALSE; } placeSidewalks (params.wrap_workspaces); diff --git a/src/settings.h b/src/settings.h index cae46274a..da1e6123f 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ diff --git a/src/spinning_cursor.c b/src/spinning_cursor.c index aa837d9bd..5227f1ba6 100644 --- a/src/spinning_cursor.c +++ b/src/spinning_cursor.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - mozilla - (c) 1998 mozilla.org - xfwm4 - (c) 2003 Olivier Fourdan + mozilla - (c) 1998 mozilla.org + xfwm4 - (c) 2003 Olivier Fourdan */ @@ -74,11 +74,11 @@ cursorCreateSpinning (Display * dpy, Window window) bg.flags = 0xf; cursor = - XCreatePixmapFromBitmapData (dpy, window, (char *) xlib_spinning_bits, - 32, 32, 0xffffffff, 0x0, 1); + XCreatePixmapFromBitmapData (dpy, window, (char *) xlib_spinning_bits, + 32, 32, 0xffffffff, 0x0, 1); mask = - XCreatePixmapFromBitmapData (dpy, window, - (char *) xlib_spinning_mask_bits, 32, 32, 0xffffffff, 0x0, 1); + XCreatePixmapFromBitmapData (dpy, window, + (char *) xlib_spinning_mask_bits, 32, 32, 0xffffffff, 0x0, 1); xcursor = XCreatePixmapCursor (dpy, cursor, mask, &fg, &bg, 2, 2); XFreePixmap (dpy, mask); XFreePixmap (dpy, cursor); diff --git a/src/spinning_cursor.h b/src/spinning_cursor.h index 98acc02ca..dd75fe530 100644 --- a/src/spinning_cursor.h +++ b/src/spinning_cursor.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - Metacity - (c) 2003 Havoc Pennington - xfwm4 - (c) 2003 Olivier Fourdan + Metacity - (c) 2003 Havoc Pennington + xfwm4 - (c) 2003 Olivier Fourdan */ diff --git a/src/stacking.c b/src/stacking.c index ec22782ee..6e3672c4f 100644 --- a/src/stacking.c +++ b/src/stacking.c @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2002-2004 Olivier Fourdan + xfwm4 - (c) 2002-2004 Olivier Fourdan */ @@ -51,15 +51,15 @@ clientApplyStackList (void) if (nwindows) { - GList *index; - Client *c; - - for (index = g_list_last(windows_stack); index; index = g_list_previous (index)) - { - c = (Client *) index->data; - xwinstack[i++] = c->frame; - DBG (" [%i] \"%s\" (0x%lx)", i, c->name, c->window); - } + GList *index; + Client *c; + + for (index = g_list_last(windows_stack); index; index = g_list_previous (index)) + { + c = (Client *) index->data; + xwinstack[i++] = c->frame; + DBG (" [%i] \"%s\" (0x%lx)", i, c->name, c->window); + } } XRestackWindows (dpy, xwinstack, (int) nwindows + 2); @@ -79,19 +79,19 @@ clientTransientOrModalHasAncestor (Client * c, int ws) if (!clientIsTransientOrModal (c)) { - return FALSE; + return FALSE; } for (index = windows_stack; index; index = g_list_next (index)) { - c2 = (Client *) index->data; - if ((c2 != c) && !clientIsTransientOrModal (c2) - && clientIsTransientOrModalFor (c, c2) - && !FLAG_TEST (c2->flags, CLIENT_FLAG_HIDDEN) - && (c2->win_workspace == ws)) - { - return TRUE; - } + c2 = (Client *) index->data; + if ((c2 != c) && !clientIsTransientOrModal (c2) + && clientIsTransientOrModalFor (c, c2) + && !FLAG_TEST (c2->flags, CLIENT_FLAG_HIDDEN) + && (c2->win_workspace == ws)) + { + return TRUE; + } } return FALSE; @@ -109,12 +109,12 @@ clientGetLowestTransient (Client * c) for (index = windows_stack; index; index = g_list_next (index)) { - c2 = (Client *) index->data; - if ((c2 != c) && clientIsTransientFor (c2, c)) - { - lowest_transient = c2; - break; - } + c2 = (Client *) index->data; + if ((c2 != c) && clientIsTransientFor (c2, c)) + { + lowest_transient = c2; + break; + } } return lowest_transient; } @@ -131,14 +131,14 @@ clientGetHighestTransientOrModalFor (Client * c) for (index = windows_stack; index; index = g_list_next (index)) { - c2 = (Client *) index->data; - if (c2) - { - if (clientIsTransientOrModalFor (c, c2)) - { - highest_transient = c2; - } - } + c2 = (Client *) index->data; + if (c2) + { + if (clientIsTransientOrModalFor (c, c2)) + { + highest_transient = c2; + } + } } return highest_transient; @@ -156,14 +156,14 @@ clientGetTopMostForGroup (Client * c) for (index = windows_stack; index; index = g_list_next (index)) { - c2 = (Client *) index->data; - if (c2 != c) - { - if (clientSameGroup (c, c2)) - { - top_most = c2; - } - } + c2 = (Client *) index->data; + if (c2 != c) + { + if (clientSameGroup (c, c2)) + { + top_most = c2; + } + } } return top_most; @@ -179,17 +179,17 @@ clientGetNextTopMost (int layer, Client * exclude) for (index = windows_stack; index; index = g_list_next (index)) { - c = (Client *) index->data; - TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name, - c->window, (int) c->win_layer); - if (!exclude || (c != exclude)) - { - if (c->win_layer > layer) - { - top = c; - break; - } - } + c = (Client *) index->data; + TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name, + c->window, (int) c->win_layer); + if (!exclude || (c != exclude)) + { + if (c->win_layer > layer) + { + top = c; + break; + } + } } return top; @@ -205,23 +205,23 @@ clientGetBottomMost (int layer, Client * exclude) for (index = windows_stack; index; index = g_list_next (index)) { - c = (Client *) index->data; - if (c) - { - TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name, - c->window, (int) c->win_layer); - if (!exclude || (c != exclude)) - { - if (c->win_layer < layer) - { - bot = c; - } - else if (c->win_layer >= layer) - { - break; - } - } - } + c = (Client *) index->data; + if (c) + { + TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name, + c->window, (int) c->win_layer); + if (!exclude || (c != exclude)) + { + if (c->win_layer < layer) + { + bot = c; + } + else if (c->win_layer >= layer) + { + break; + } + } + } } return bot; } @@ -240,16 +240,16 @@ clientAtPosition (int x, int y, Client * exclude) for (index = g_list_last (windows_stack); index; index = g_list_previous (index)) { - c2 = (Client *) index->data; - if (clientSelectMask (c2, 0) && (c2 != exclude)) - { - if ((frameX (c2) < x) && (frameX (c2) + frameWidth (c2) > x) - && (frameY (c2) < y) && (frameY (c2) + frameHeight (c2) > y)) - { - c = c2; - break; - } - } + c2 = (Client *) index->data; + if (clientSelectMask (c2, 0) && (c2 != exclude)) + { + if ((frameX (c2) < x) && (frameX (c2) + frameWidth (c2) > x) + && (frameY (c2) < y) && (frameY (c2) + frameHeight (c2) > y)) + { + c = c2; + break; + } + } } return c; @@ -263,112 +263,112 @@ clientRaise (Client * c) if (c == last_raise) { - TRACE ("client \"%s\" (0x%lx) already raised", c->name, c->window); - return; + TRACE ("client \"%s\" (0x%lx) already raised", c->name, c->window); + return; } TRACE ("raising client \"%s\" (0x%lx)", c->name, c->window); if (g_list_length (windows_stack) < 1) { - return; + return; } if (FLAG_TEST (c->flags, CLIENT_FLAG_MANAGED)) { - Client *c2, *c3; - Client *client_sibling = NULL; - GList *transients = NULL; - GList *sibling = NULL; - GList *index1, *index2; - GList *windows_stack_copy; - - /* Copy the existing window stack temporarily as reference */ - windows_stack_copy = g_list_copy (windows_stack); - /* Search for the window that will be just on top of the raised window (layers...) */ - client_sibling = clientGetNextTopMost (c->win_layer, c); - windows_stack = g_list_remove (windows_stack, (gconstpointer) c); - if (client_sibling) - { - /* If there is one, look for its place in the list */ - sibling = g_list_find (windows_stack, (gconstpointer) client_sibling); - /* Place the raised window just before it */ - windows_stack = g_list_insert_before (windows_stack, sibling, c); - } - else - { - /* There will be no window on top of the raised window, so place it at the end of list */ - windows_stack = g_list_append (windows_stack, c); - } - /* Now, look for transients, transients of transients, etc. */ - for (index1 = windows_stack_copy; index1; index1 = g_list_next (index1)) - { - c2 = (Client *) index1->data; - if (c2) - { - if ((c2 != c) && clientIsTransientOrModalFor (c2, c)) - { - transients = g_list_append (transients, c2); - if (sibling) - { - /* Make sure client_sibling is not c2 otherwise we create a circular linked list */ - if (client_sibling != c2) - { - /* Place the transient window just before sibling */ - windows_stack = g_list_remove (windows_stack, (gconstpointer) c2); - windows_stack = g_list_insert_before (windows_stack, sibling, c2); - } - } - else - { - /* There will be no window on top of the transient window, so place it at the end of list */ - windows_stack = g_list_remove (windows_stack, (gconstpointer) c2); - windows_stack = g_list_append (windows_stack, c2); - } - } - else - { - for (index2 = transients; index2; index2 = g_list_next (index2)) - { - c3 = (Client *) index2->data; - if ((c3 != c2) && clientIsTransientOrModalFor (c2, c3)) - { - transients = g_list_append (transients, c2); - if (sibling) - { - /* Again, make sure client_sibling is not c2 to avoid a circular linked list */ - if (client_sibling != c2) - { - /* Place the transient window just before sibling */ - windows_stack = g_list_remove (windows_stack, (gconstpointer) c2); - windows_stack = g_list_insert_before (windows_stack, sibling, c2); - } - } - else - { - /* There will be no window on top of the transient window, so place it at the end of list */ - windows_stack = g_list_remove (windows_stack, (gconstpointer) c2); - windows_stack = g_list_append (windows_stack, c2); - } - break; - } - } - } - } - } - if (transients) - { - g_list_free (transients); - } - if (windows_stack_copy) - { - g_list_free (windows_stack_copy); - } - /* Now, windows_stack contains the correct window stack - We still need to tell the X Server to reflect the changes - */ - clientApplyStackList (); - clientSetNetClientList (net_client_list_stacking, windows_stack); - last_raise = c; + Client *c2, *c3; + Client *client_sibling = NULL; + GList *transients = NULL; + GList *sibling = NULL; + GList *index1, *index2; + GList *windows_stack_copy; + + /* Copy the existing window stack temporarily as reference */ + windows_stack_copy = g_list_copy (windows_stack); + /* Search for the window that will be just on top of the raised window (layers...) */ + client_sibling = clientGetNextTopMost (c->win_layer, c); + windows_stack = g_list_remove (windows_stack, (gconstpointer) c); + if (client_sibling) + { + /* If there is one, look for its place in the list */ + sibling = g_list_find (windows_stack, (gconstpointer) client_sibling); + /* Place the raised window just before it */ + windows_stack = g_list_insert_before (windows_stack, sibling, c); + } + else + { + /* There will be no window on top of the raised window, so place it at the end of list */ + windows_stack = g_list_append (windows_stack, c); + } + /* Now, look for transients, transients of transients, etc. */ + for (index1 = windows_stack_copy; index1; index1 = g_list_next (index1)) + { + c2 = (Client *) index1->data; + if (c2) + { + if ((c2 != c) && clientIsTransientOrModalFor (c2, c)) + { + transients = g_list_append (transients, c2); + if (sibling) + { + /* Make sure client_sibling is not c2 otherwise we create a circular linked list */ + if (client_sibling != c2) + { + /* Place the transient window just before sibling */ + windows_stack = g_list_remove (windows_stack, (gconstpointer) c2); + windows_stack = g_list_insert_before (windows_stack, sibling, c2); + } + } + else + { + /* There will be no window on top of the transient window, so place it at the end of list */ + windows_stack = g_list_remove (windows_stack, (gconstpointer) c2); + windows_stack = g_list_append (windows_stack, c2); + } + } + else + { + for (index2 = transients; index2; index2 = g_list_next (index2)) + { + c3 = (Client *) index2->data; + if ((c3 != c2) && clientIsTransientOrModalFor (c2, c3)) + { + transients = g_list_append (transients, c2); + if (sibling) + { + /* Again, make sure client_sibling is not c2 to avoid a circular linked list */ + if (client_sibling != c2) + { + /* Place the transient window just before sibling */ + windows_stack = g_list_remove (windows_stack, (gconstpointer) c2); + windows_stack = g_list_insert_before (windows_stack, sibling, c2); + } + } + else + { + /* There will be no window on top of the transient window, so place it at the end of list */ + windows_stack = g_list_remove (windows_stack, (gconstpointer) c2); + windows_stack = g_list_append (windows_stack, c2); + } + break; + } + } + } + } + } + if (transients) + { + g_list_free (transients); + } + if (windows_stack_copy) + { + g_list_free (windows_stack_copy); + } + /* Now, windows_stack contains the correct window stack + We still need to tell the X Server to reflect the changes + */ + clientApplyStackList (); + clientSetNetClientList (net_client_list_stacking, windows_stack); + last_raise = c; } } @@ -381,52 +381,52 @@ clientLower (Client * c) if (g_list_length (windows_stack) < 1) { - return; + return; } if (FLAG_TEST (c->flags, CLIENT_FLAG_MANAGED)) { - Client *client_sibling = NULL; - - if (clientIsTransientOrModalForGroup (c)) - { - client_sibling = clientGetTopMostForGroup (c); - } - else if (clientIsTransient (c)) - { - client_sibling = clientGetTransient (c); - } - if (!client_sibling) - { - client_sibling = clientGetBottomMost (c->win_layer, c); - } - if (client_sibling != c) - { - windows_stack = g_list_remove (windows_stack, (gconstpointer) c); - /* Paranoid check to avoid circular linked list */ - if (client_sibling) - { - GList *sibling = g_list_find (windows_stack, (gconstpointer) client_sibling); - gint position = g_list_position (windows_stack, sibling) + 1; - - windows_stack = g_list_insert (windows_stack, c, position); - TRACE ("lowest client is \"%s\" (0x%lx) at position %i", - client_sibling->name, client_sibling->window, position); - } - else - { - windows_stack = g_list_prepend (windows_stack, c); - } - } - /* Now, windows_stack contains the correct window stack - We still need to tell the X Server to reflect the changes - */ - clientApplyStackList (); - clientSetNetClientList (net_client_list_stacking, windows_stack); - if (last_raise == c) - { - last_raise = NULL; - } + Client *client_sibling = NULL; + + if (clientIsTransientOrModalForGroup (c)) + { + client_sibling = clientGetTopMostForGroup (c); + } + else if (clientIsTransient (c)) + { + client_sibling = clientGetTransient (c); + } + if (!client_sibling) + { + client_sibling = clientGetBottomMost (c->win_layer, c); + } + if (client_sibling != c) + { + windows_stack = g_list_remove (windows_stack, (gconstpointer) c); + /* Paranoid check to avoid circular linked list */ + if (client_sibling) + { + GList *sibling = g_list_find (windows_stack, (gconstpointer) client_sibling); + gint position = g_list_position (windows_stack, sibling) + 1; + + windows_stack = g_list_insert (windows_stack, c, position); + TRACE ("lowest client is \"%s\" (0x%lx) at position %i", + client_sibling->name, client_sibling->window, position); + } + else + { + windows_stack = g_list_prepend (windows_stack, c); + } + } + /* Now, windows_stack contains the correct window stack + We still need to tell the X Server to reflect the changes + */ + clientApplyStackList (); + clientSetNetClientList (net_client_list_stacking, windows_stack); + if (last_raise == c) + { + last_raise = NULL; + } } } @@ -442,49 +442,49 @@ clientAddToList (Client * c) client_count++; if (clients) { - c->prev = clients->prev; - c->next = clients; - clients->prev->next = c; - clients->prev = c; + c->prev = clients->prev; + c->next = clients; + clients->prev->next = c; + clients->prev = c; } else { - clients = c; - c->next = c; - c->prev = c; + clients = c; + c->next = c; + c->prev = c; } TRACE ("adding window \"%s\" (0x%lx) to windows list", c->name, - c->window); + c->window); windows = g_list_append (windows, c); client_sibling = clientGetLowestTransient (c); /* Paranoid check to avoid circular linked list */ if (client_sibling != c) { - if (client_sibling) - { - /* The client has already a transient mapped */ - sibling = g_list_find (windows_stack, (gconstpointer) client_sibling); - windows_stack = g_list_insert_before (windows_stack, sibling, c); - } - else - { - client_sibling = clientGetNextTopMost (c->win_layer, c); - /* Paranoid check to avoid circular linked list */ - if (client_sibling != c) - { - if (client_sibling) - { - sibling = g_list_find (windows_stack, (gconstpointer) client_sibling); - windows_stack = g_list_insert_before (windows_stack, sibling, c); - } - else - { - windows_stack = g_list_append (windows_stack, c); - } - } - } + if (client_sibling) + { + /* The client has already a transient mapped */ + sibling = g_list_find (windows_stack, (gconstpointer) client_sibling); + windows_stack = g_list_insert_before (windows_stack, sibling, c); + } + else + { + client_sibling = clientGetNextTopMost (c->win_layer, c); + /* Paranoid check to avoid circular linked list */ + if (client_sibling != c) + { + if (client_sibling) + { + sibling = g_list_find (windows_stack, (gconstpointer) client_sibling); + windows_stack = g_list_insert_before (windows_stack, sibling, c); + } + else + { + windows_stack = g_list_append (windows_stack, c); + } + } + } } clientSetNetClientList (net_client_list, windows); @@ -505,24 +505,24 @@ clientRemoveFromList (Client * c) client_count--; if (client_count == 0) { - clients = NULL; + clients = NULL; } else { - c->next->prev = c->prev; - c->prev->next = c->next; - if (c == clients) - { - clients = clients->next; - } + c->next->prev = c->prev; + c->prev->next = c->next; + if (c == clients) + { + clients = clients->next; + } } TRACE ("removing window \"%s\" (0x%lx) from windows list", c->name, - c->window); + c->window); windows = g_list_remove (windows, c); TRACE ("removing window \"%s\" (0x%lx) from windows_stack list", c->name, - c->window); + c->window); windows_stack = g_list_remove (windows_stack, c); clientSetNetClientList (net_client_list, windows); @@ -538,7 +538,7 @@ clientGetStackList (void) GList *windows_stack_copy = NULL; if (windows_stack) { - windows_stack_copy = g_list_copy (windows_stack); + windows_stack_copy = g_list_copy (windows_stack); } return windows_stack_copy; } diff --git a/src/stacking.h b/src/stacking.h index b4da206c9..7d9bf9192 100644 --- a/src/stacking.h +++ b/src/stacking.h @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2002-2004 Olivier Fourdan + xfwm4 - (c) 2002-2004 Olivier Fourdan */ diff --git a/src/startup_notification.c b/src/startup_notification.c index 316188591..55700be6a 100644 --- a/src/startup_notification.c +++ b/src/startup_notification.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - Metacity - (c) 2003 Havoc Pennington - xfwm4 - (c) 2003 Olivier Fourdan + Metacity - (c) 2003 Havoc Pennington + xfwm4 - (c) 2003 Olivier Fourdan */ @@ -81,11 +81,11 @@ sn_update_feedback (void) if (startup_sequences != NULL) { - XDefineCursor (dpy, root, busy_cursor); + XDefineCursor (dpy, root, busy_cursor); } else { - XDefineCursor (dpy, root, root_cursor); + XDefineCursor (dpy, root, root_cursor); } } @@ -101,8 +101,8 @@ sn_add_sequence (SnStartupSequence * sequence) if (startup_sequence_timeout == 0) { - startup_sequence_timeout = - g_timeout_add (1000, sn_startup_sequence_timeout, NULL); + startup_sequence_timeout = + g_timeout_add (1000, sn_startup_sequence_timeout, NULL); } sn_update_feedback (); } @@ -119,8 +119,8 @@ sn_remove_sequence (SnStartupSequence * sequence) if ((startup_sequences == NULL) && (startup_sequence_timeout != 0)) { - g_source_remove (startup_sequence_timeout); - startup_sequence_timeout = 0; + g_source_remove (startup_sequence_timeout); + startup_sequence_timeout = 0; } sn_update_feedback (); } @@ -139,12 +139,12 @@ sn_collect_timed_out_foreach (void *element, void *data) sn_startup_sequence_get_last_active_time (sequence, &tv_sec, &tv_usec); elapsed = - ((((double) ctod->now.tv_sec - tv_sec) * G_USEC_PER_SEC + - (ctod->now.tv_usec - tv_usec))) / 1000.0; + ((((double) ctod->now.tv_sec - tv_sec) * G_USEC_PER_SEC + + (ctod->now.tv_usec - tv_usec))) / 1000.0; if (elapsed > STARTUP_TIMEOUT) { - ctod->list = g_slist_prepend (ctod->list, sequence); + ctod->list = g_slist_prepend (ctod->list, sequence); } } @@ -164,24 +164,24 @@ sn_startup_sequence_timeout (void *data) tmp = ctod.list; while (tmp != NULL) { - SnStartupSequence *sequence = tmp->data; + SnStartupSequence *sequence = tmp->data; - sn_startup_sequence_complete (sequence); + sn_startup_sequence_complete (sequence); - tmp = tmp->next; + tmp = tmp->next; } g_slist_free (ctod.list); if (startup_sequences != NULL) { - return TRUE; + return TRUE; } else { - /* remove */ - startup_sequence_timeout = 0; - return FALSE; + /* remove */ + startup_sequence_timeout = 0; + return FALSE; } } @@ -199,22 +199,22 @@ sn_screen_event (SnMonitorEvent * event, void *user_data) switch (sn_monitor_event_get_type (event)) { - case SN_MONITOR_EVENT_INITIATED: - wmclass = sn_startup_sequence_get_wmclass (sequence); - sn_add_sequence (sequence); - break; - - case SN_MONITOR_EVENT_COMPLETED: - sn_remove_sequence (sn_monitor_event_get_startup_sequence - (event)); - break; - - case SN_MONITOR_EVENT_CHANGED: - break; - - case SN_MONITOR_EVENT_CANCELED: - default: - break; + case SN_MONITOR_EVENT_INITIATED: + wmclass = sn_startup_sequence_get_wmclass (sequence); + sn_add_sequence (sequence); + break; + + case SN_MONITOR_EVENT_COMPLETED: + sn_remove_sequence (sn_monitor_event_get_startup_sequence + (event)); + break; + + case SN_MONITOR_EVENT_CHANGED: + break; + + case SN_MONITOR_EVENT_CANCELED: + default: + break; } } @@ -233,72 +233,72 @@ sn_client_startup_properties (Client * c) sequence = NULL; if (startup_id == NULL) { - tmp = startup_sequences; - while (tmp != NULL) - { - const char *wmclass; - - wmclass = sn_startup_sequence_get_wmclass (tmp->data); - - if ((wmclass != NULL) && ((c->class.res_class - && !strcmp (wmclass, c->class.res_class)) - || (c->class.res_name - && !strcmp (wmclass, c->class.res_name)))) - { - sequence = tmp->data; - - free (c->startup_id); - c->startup_id = - strdup (sn_startup_sequence_get_id (sequence)); - startup_id = c->startup_id; - - sn_startup_sequence_complete (sequence); - break; - } - - tmp = tmp->next; - } + tmp = startup_sequences; + while (tmp != NULL) + { + const char *wmclass; + + wmclass = sn_startup_sequence_get_wmclass (tmp->data); + + if ((wmclass != NULL) && ((c->class.res_class + && !strcmp (wmclass, c->class.res_class)) + || (c->class.res_name + && !strcmp (wmclass, c->class.res_name)))) + { + sequence = tmp->data; + + free (c->startup_id); + c->startup_id = + strdup (sn_startup_sequence_get_id (sequence)); + startup_id = c->startup_id; + + sn_startup_sequence_complete (sequence); + break; + } + + tmp = tmp->next; + } } if (startup_id == NULL) { - return; + return; } if (sequence == NULL) { - tmp = startup_sequences; - while (tmp != NULL) - { - const char *id; + tmp = startup_sequences; + while (tmp != NULL) + { + const char *id; - id = sn_startup_sequence_get_id (tmp->data); + id = sn_startup_sequence_get_id (tmp->data); - if (!strcmp (id, startup_id)) - { - sequence = tmp->data; - break; - } + if (!strcmp (id, startup_id)) + { + sequence = tmp->data; + break; + } - tmp = tmp->next; - } + tmp = tmp->next; + } } if (sequence != NULL) { - int workspace; - - if (!FLAG_TEST (c->flags, CLIENT_FLAG_WORKSPACE_SET)) - { - workspace = sn_startup_sequence_get_workspace (sequence); - if (workspace >= 0) - { - FLAG_SET (c->flags, CLIENT_FLAG_WORKSPACE_SET); - c->win_workspace = workspace; - } - } - - return; + int workspace; + + if (!FLAG_TEST (c->flags, CLIENT_FLAG_WORKSPACE_SET)) + { + workspace = sn_startup_sequence_get_workspace (sequence); + if (workspace >= 0) + { + FLAG_SET (c->flags, CLIENT_FLAG_WORKSPACE_SET); + c->win_workspace = workspace; + } + } + + return; } } @@ -313,9 +313,9 @@ sn_init_display (Display * dpy, int screen) sn_display = sn_display_new (dpy, sn_error_trap_push, sn_error_trap_pop); if (sn_display != NULL) { - sn_context = - sn_monitor_context_new (sn_display, screen, sn_screen_event, NULL, - NULL); + sn_context = + sn_monitor_context_new (sn_display, screen, sn_screen_event, NULL, + NULL); } startup_sequences = NULL; startup_sequence_timeout = 0; @@ -326,7 +326,7 @@ sn_close_display (void) { if (sn_display) { - sn_display_unref (sn_display); + sn_display_unref (sn_display); } sn_display = NULL; } diff --git a/src/startup_notification.h b/src/startup_notification.h index b80d4bb92..720202b5f 100644 --- a/src/startup_notification.h +++ b/src/startup_notification.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - Metacity - (c) 2003 Havoc Pennington - xfwm4 - (c) 2003 Olivier Fourdan + Metacity - (c) 2003 Havoc Pennington + xfwm4 - (c) 2003 Olivier Fourdan */ diff --git a/src/tabwin.c b/src/tabwin.c index 70d3c12ca..e97236a0c 100644 --- a/src/tabwin.c +++ b/src/tabwin.c @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2003 Olivier Fourdan + xfwm4 - (c) 2003 Olivier Fourdan */ @@ -44,14 +44,14 @@ tabwinCreate (gchar * label) if (!icon) { - icon = inline_icon_at_size (tabwin_icon_data, 32, 32); - g_object_ref (G_OBJECT (icon)); + icon = inline_icon_at_size (tabwin_icon_data, 32, 32); + g_object_ref (G_OBJECT (icon)); } tabwin->window = gtk_window_new (GTK_WINDOW_POPUP); gtk_container_set_border_width (GTK_CONTAINER (tabwin->window), 0); gtk_window_set_position (GTK_WINDOW (tabwin->window), - GTK_WIN_POS_CENTER_ALWAYS); + GTK_WIN_POS_CENTER_ALWAYS); gtk_window_set_default_size (GTK_WINDOW (tabwin->window), 320, -1); gtk_widget_set_size_request (tabwin->window, 320, -1); gtk_window_set_resizable (GTK_WINDOW (tabwin->window), FALSE); @@ -85,7 +85,7 @@ tabwinCreate (gchar * label) tabwin->label = gtk_label_new (""); if (label) { - tabwinSetLabel (tabwin, label); + tabwinSetLabel (tabwin, label); } gtk_misc_set_alignment (GTK_MISC (tabwin->label), 0.5, 0.5); gtk_widget_show (tabwin->label); @@ -102,11 +102,11 @@ tabwinSetLabel (Tabwin * tabwin, gchar * label) if (label) { - gtk_label_set_text (GTK_LABEL (tabwin->label), label); + gtk_label_set_text (GTK_LABEL (tabwin->label), label); } else { - gtk_label_set_text (GTK_LABEL (tabwin->label), ""); + gtk_label_set_text (GTK_LABEL (tabwin->label), ""); } gtk_widget_queue_draw (tabwin->window); } diff --git a/src/tabwin.h b/src/tabwin.h index cc840f980..d7eed30e8 100644 --- a/src/tabwin.h +++ b/src/tabwin.h @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2003 Olivier Fourdan + xfwm4 - (c) 2003 Olivier Fourdan */ diff --git a/src/transients.c b/src/transients.c index 45d0a61c1..2966a1fa8 100644 --- a/src/transients.c +++ b/src/transients.c @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2002-2004 Olivier Fourdan + xfwm4 - (c) 2002-2004 Olivier Fourdan */ @@ -39,8 +39,8 @@ clientGetTransient (Client * c) if ((c->transient_for) && (c->transient_for != root)) { - c2 = clientGetFromWindow (c->transient_for, WINDOW); - return c2; + c2 = clientGetFromWindow (c->transient_for, WINDOW); + return c2; } return NULL; } @@ -53,7 +53,7 @@ clientIsTransient (Client * c) TRACE ("entering clientIsTransient"); return (((c->transient_for != root) && (c->transient_for != None)) || - ((c->transient_for == root) && (c->group_leader != None))); + ((c->transient_for == root) && (c->group_leader != None))); } gboolean @@ -64,8 +64,8 @@ clientIsModal (Client * c) TRACE ("entering clientIsModal"); return (FLAG_TEST (c->flags, CLIENT_FLAG_STATE_MODAL) && - (((c->transient_for != root) && (c->transient_for != None)) || - (c->group_leader != None))); + (((c->transient_for != root) && (c->transient_for != None)) || + (c->group_leader != None))); } gboolean @@ -87,10 +87,10 @@ clientSameGroup (Client * c1, Client * c2) TRACE ("entering clientSameGroup"); return ((c1 != c2) && - (((c1->group_leader != None) && - (c1->group_leader == c2->group_leader)) || - (c1->group_leader == c2->window) || - (c2->group_leader == c1->window))); + (((c1->group_leader != None) && + (c1->group_leader == c2->group_leader)) || + (c1->group_leader == c2->window) || + (c2->group_leader == c1->window))); } gboolean @@ -103,14 +103,14 @@ clientIsTransientFor (Client * c1, Client * c2) if (c1->transient_for) { - if (c1->transient_for != root) - { - return (c1->transient_for == c2->window); - } - else - { - return (clientSameGroup (c1, c2) && (c1->serial >= c2->serial)); - } + if (c1->transient_for != root) + { + return (c1->transient_for == c2->window); + } + else + { + return (clientSameGroup (c1, c2) && (c1->serial >= c2->serial)); + } } return FALSE; } @@ -125,7 +125,7 @@ clientIsModalFor (Client * c1, Client * c2) if (FLAG_TEST (c1->flags, CLIENT_FLAG_STATE_MODAL)) { - return (clientIsTransientFor (c1, c2) || clientSameGroup (c1, c2)); + return (clientIsTransientFor (c1, c2) || clientSameGroup (c1, c2)); } return FALSE; } @@ -159,7 +159,7 @@ clientIsModalForGroup (Client * c) TRACE ("entering clientIsModalForGroup"); return (FLAG_TEST (c->flags, CLIENT_FLAG_STATE_MODAL) && - !clientIsTransient(c) && (c->group_leader != None)); + !clientIsTransient(c) && (c->group_leader != None)); } gboolean @@ -185,33 +185,33 @@ clientGetModalFor (Client * c) for (index1 = windows_stack; index1; index1 = g_list_next (index1)) { - c2 = (Client *) index1->data; - if (c2) - { - if ((c2 != c) && clientIsModalFor (c2, c)) - { - modals = g_list_append (modals, c2); - latest_modal = c2; - } - else - { - for (index2 = modals; index2; - index2 = g_list_next (index2)) - { - c3 = (Client *) index2->data; - if ((c3 != c2) && clientIsModalFor (c2, c3)) - { - modals = g_list_append (modals, c2); - latest_modal = c2; - break; - } - } - } - } + c2 = (Client *) index1->data; + if (c2) + { + if ((c2 != c) && clientIsModalFor (c2, c)) + { + modals = g_list_append (modals, c2); + latest_modal = c2; + } + else + { + for (index2 = modals; index2; + index2 = g_list_next (index2)) + { + c3 = (Client *) index2->data; + if ((c3 != c2) && clientIsModalFor (c2, c3)) + { + modals = g_list_append (modals, c2); + latest_modal = c2; + break; + } + } + } + } } if (modals) { - g_list_free (modals); + g_list_free (modals); } return latest_modal; @@ -230,27 +230,27 @@ clientListTransient (Client * c) transients = g_list_append (transients, c); for (index1 = windows_stack; index1; index1 = g_list_next (index1)) { - c2 = (Client *) index1->data; - if (c2 != c) - { - if (clientIsTransientFor (c2, c)) - { - transients = g_list_append (transients, c2); - } - else - { - for (index2 = transients; index2; - index2 = g_list_next (index2)) - { - c3 = (Client *) index2->data; - if ((c3 != c2) && clientIsTransientFor (c2, c3)) - { - transients = g_list_append (transients, c2); - break; - } - } - } - } + c2 = (Client *) index1->data; + if (c2 != c) + { + if (clientIsTransientFor (c2, c)) + { + transients = g_list_append (transients, c2); + } + else + { + for (index2 = transients; index2; + index2 = g_list_next (index2)) + { + c3 = (Client *) index2->data; + if ((c3 != c2) && clientIsTransientFor (c2, c3)) + { + transients = g_list_append (transients, c2); + break; + } + } + } + } } return transients; } @@ -268,27 +268,27 @@ clientListTransientOrModal (Client * c) transients = g_list_append (transients, c); for (index1 = windows_stack; index1; index1 = g_list_next (index1)) { - c2 = (Client *) index1->data; - if (c2 != c) - { - if (clientIsTransientOrModalFor (c2, c)) - { - transients = g_list_append (transients, c2); - } - else - { - for (index2 = transients; index2; - index2 = g_list_next (index2)) - { - c3 = (Client *) index2->data; - if ((c3 != c2) && clientIsTransientOrModalFor (c2, c3)) - { - transients = g_list_append (transients, c2); - break; - } - } - } - } + c2 = (Client *) index1->data; + if (c2 != c) + { + if (clientIsTransientOrModalFor (c2, c)) + { + transients = g_list_append (transients, c2); + } + else + { + for (index2 = transients; index2; + index2 = g_list_next (index2)) + { + c3 = (Client *) index2->data; + if ((c3 != c2) && clientIsTransientOrModalFor (c2, c3)) + { + transients = g_list_append (transients, c2); + break; + } + } + } + } } return transients; } diff --git a/src/transients.h b/src/transients.h index 938d649da..3a5781cdd 100644 --- a/src/transients.h +++ b/src/transients.h @@ -1,19 +1,19 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - xfwm4 - (c) 2002-2004 Olivier Fourdan + xfwm4 - (c) 2002-2004 Olivier Fourdan */ diff --git a/src/workspaces.c b/src/workspaces.c index cd595ac92..ae0fcba14 100644 --- a/src/workspaces.c +++ b/src/workspaces.c @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ @@ -54,26 +54,26 @@ workspaceSwitch (int new_ws, Client * c2) if (new_ws > params.workspace_count - 1) { - new_ws = 0; + new_ws = 0; } else if (new_ws < 0) { - new_ws = params.workspace_count - 1; + new_ws = params.workspace_count - 1; } if (new_ws == workspace) { - return; + return; } /* Grab the pointer to avoid side effects with EnterNotify events */ XGrabPointer (dpy, gnome_win, FALSE, EnterWindowMask, GrabModeAsync, - GrabModeAsync, None, None, CurrentTime); + GrabModeAsync, None, None, CurrentTime); workspace = new_ws; if (c2) { - clientSetWorkspace (c2, new_ws, FALSE); + clientSetWorkspace (c2, new_ws, FALSE); } list_hide = NULL; @@ -82,70 +82,70 @@ workspaceSwitch (int new_ws, Client * c2) /* First pass */ for (index = windows_stack; index; index = g_list_next (index)) { - c = (Client *) index->data; - if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_VISIBLE, - CLIENT_FLAG_STICKY) && ((c->win_workspace != new_ws))) - { - if (c == previous) - { - FLAG_SET (previous->flags, CLIENT_FLAG_FOCUS); - clientSetFocus (NULL, FOCUS_IGNORE_MODAL); - } - if (!clientIsTransientOrModal (c)) - { - /* Just build of windows that will be hidden, so that - we can record the previous focus even when on a - transient (otherwise the transient vanishes along - with its parent window which is placed below... - */ - list_hide = g_list_append (list_hide, c); - } - } + c = (Client *) index->data; + if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_VISIBLE, + CLIENT_FLAG_STICKY) && ((c->win_workspace != new_ws))) + { + if (c == previous) + { + FLAG_SET (previous->flags, CLIENT_FLAG_FOCUS); + clientSetFocus (NULL, FOCUS_IGNORE_MODAL); + } + if (!clientIsTransientOrModal (c)) + { + /* Just build of windows that will be hidden, so that + we can record the previous focus even when on a + transient (otherwise the transient vanishes along + with its parent window which is placed below... + */ + list_hide = g_list_append (list_hide, c); + } + } } /* First pass and a half :) */ if (list_hide) { - for (index = list_hide; index; index = g_list_next (index)) - { - c = (Client *) index->data; - clientHide (c, new_ws, FALSE); - } - g_list_free (list_hide); + for (index = list_hide; index; index = g_list_next (index)) + { + c = (Client *) index->data; + clientHide (c, new_ws, FALSE); + } + g_list_free (list_hide); } /* Second pass */ for (index = g_list_last(windows_stack); index; index = g_list_previous (index)) { - c = (Client *) index->data; - if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY | CLIENT_FLAG_VISIBLE)) - { - clientSetWorkspace (c, new_ws, TRUE); - if (c == previous) - { - new_focus = c; - } - FLAG_UNSET (c->flags, CLIENT_FLAG_FOCUS); - } - else if ((c->win_workspace == new_ws) - && !FLAG_TEST (c->flags, CLIENT_FLAG_HIDDEN)) - { - if (!clientIsTransientOrModal (c)) - { - clientShow (c, FALSE); - } - if ((!new_focus) && FLAG_TEST (c->flags, CLIENT_FLAG_FOCUS)) - { - new_focus = c; - } - FLAG_UNSET (c->flags, CLIENT_FLAG_FOCUS); - } + c = (Client *) index->data; + if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY | CLIENT_FLAG_VISIBLE)) + { + clientSetWorkspace (c, new_ws, TRUE); + if (c == previous) + { + new_focus = c; + } + FLAG_UNSET (c->flags, CLIENT_FLAG_FOCUS); + } + else if ((c->win_workspace == new_ws) + && !FLAG_TEST (c->flags, CLIENT_FLAG_HIDDEN)) + { + if (!clientIsTransientOrModal (c)) + { + clientShow (c, FALSE); + } + if ((!new_focus) && FLAG_TEST (c->flags, CLIENT_FLAG_FOCUS)) + { + new_focus = c; + } + FLAG_UNSET (c->flags, CLIENT_FLAG_FOCUS); + } } setHint (dpy, root, win_workspace, new_ws); data[0] = new_ws; XChangeProperty (dpy, root, net_current_desktop, XA_CARDINAL, 32, - PropModeReplace, (unsigned char *) data, 1); + PropModeReplace, (unsigned char *) data, 1); workspaceUpdateArea (margins, gnome_margins); /* Ungrab the pointer we grabbed before mapping/unmapping all windows */ @@ -153,14 +153,14 @@ workspaceSwitch (int new_ws, Client * c2) if (!(params.click_to_focus)) { - if (!(c2) && (XQueryPointer (dpy, root, &dr, &window, &rx, &ry, &wx, &wy, &mask))) - { - c = clientAtPosition (rx, ry, NULL); - if (c) - { - new_focus = c; - } - } + if (!(c2) && (XQueryPointer (dpy, root, &dr, &window, &rx, &ry, &wx, &wy, &mask))) + { + c = clientAtPosition (rx, ry, NULL); + if (c) + { + new_focus = c; + } + } } clientSetFocus (new_focus, NO_FOCUS_FLAG); } @@ -170,7 +170,7 @@ workspaceSetNames (char *names, int length) { if (params.workspace_names) { - g_free (params.workspace_names); + g_free (params.workspace_names); } params.workspace_names = names; @@ -187,11 +187,11 @@ workspaceSetCount (int count) if (count < 1) { - count = 1; + count = 1; } if (count == params.workspace_count) { - return; + return; } setHint (dpy, root, win_workspace_count, count); @@ -200,14 +200,14 @@ workspaceSetCount (int count) for (c = clients, i = 0; i < client_count; c = c->next, i++) { - if (c->win_workspace > count - 1) - { - clientSetWorkspace (c, count - 1, TRUE); - } + if (c->win_workspace > count - 1) + { + clientSetWorkspace (c, count - 1, TRUE); + } } if (workspace > count - 1) { - workspaceSwitch (count - 1, NULL); + workspaceSwitch (count - 1, NULL); } setNetWorkarea (dpy, screen, params.workspace_count, margins); } @@ -224,29 +224,29 @@ workspaceGetArea (int * m1, int * m2, Client * c) for (i = 0; i < 4; i++) { - if (m2 == NULL) - { - m1[i] = 0; - } - else - { - m1[i] = m2[i]; - } + if (m2 == NULL) + { + m1[i] = 0; + } + else + { + m1[i] = m2[i]; + } } for (c2 = clients, i = 0; i < client_count; c2 = c2->next, i++) { - if (((!c) || (c != c2)) - && FLAG_TEST_ALL (c2->flags, - CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE)) - { - m1[TOP] = MAX (m1[TOP], c2->struts[TOP]); - m1[LEFT] = MAX (m1[LEFT], c2->struts[LEFT]); - m1[RIGHT] = - MAX (m1[RIGHT], c2->struts[RIGHT]); - m1[BOTTOM] = - MAX (m1[BOTTOM], c2->struts[BOTTOM]); - } + if (((!c) || (c != c2)) + && FLAG_TEST_ALL (c2->flags, + CLIENT_FLAG_HAS_STRUT | CLIENT_FLAG_VISIBLE)) + { + m1[TOP] = MAX (m1[TOP], c2->struts[TOP]); + m1[LEFT] = MAX (m1[LEFT], c2->struts[LEFT]); + m1[RIGHT] = + MAX (m1[RIGHT], c2->struts[RIGHT]); + m1[BOTTOM] = + MAX (m1[BOTTOM], c2->struts[BOTTOM]); + } } } @@ -271,12 +271,12 @@ workspaceUpdateArea (int * m1, int * m2) workspaceGetArea (m1, m2, NULL); TRACE ("Desktop area computed : (%d,%d,%d,%d)", (int) m1[0], (int) m1[1], - (int) m1[2], (int) m1[3]); + (int) m1[2], (int) m1[3]); if ((prev_top != m1[TOP]) || (prev_left != m1[LEFT]) - || (prev_right != m1[RIGHT]) - || (prev_bottom != m1[BOTTOM])) + || (prev_right != m1[RIGHT]) + || (prev_bottom != m1[BOTTOM])) { - TRACE ("Margins have changed, updating net_workarea"); - setNetWorkarea (dpy, screen, params.workspace_count, m1); + TRACE ("Margins have changed, updating net_workarea"); + setNetWorkarea (dpy, screen, params.workspace_count, m1); } } diff --git a/src/workspaces.h b/src/workspaces.h index c78159956..dce56ed89 100644 --- a/src/workspaces.h +++ b/src/workspaces.h @@ -1,20 +1,20 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; You may only use version 2 of the License, - you have no option to use any other version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; You may only use version 2 of the License, + you have no option to use any other version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - oroborus - (c) 2001 Ken Lynch - xfwm4 - (c) 2002-2003 Olivier Fourdan + oroborus - (c) 2001 Ken Lynch + xfwm4 - (c) 2002-2003 Olivier Fourdan */ -- cgit v1.2.1