diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2014-10-05 03:20:16 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2014-10-05 03:20:16 +0300 |
commit | 130f3686ffe5c914f7b721f4623bee825df7c3bb (patch) | |
tree | 1149268f52ccbf00a08aab0c403bfdd796d3fc9b | |
parent | e132e2a700c4b50c93eae064d8fd1769b67baf06 (diff) | |
download | metacity-130f3686ffe5c914f7b721f4623bee825df7c3bb.tar.gz |
remove trailing whitespace
103 files changed, 3816 insertions, 3816 deletions
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c index 012badf1..bc06fa6a 100644 --- a/src/compositor/compositor-xrender.c +++ b/src/compositor/compositor-xrender.c @@ -1,10 +1,10 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2007 Iain Holmes * Based on xcompmgr - (c) 2003 Keith Packard * xfwm4 - (c) 2005-2007 Olivier Fourdan - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -70,7 +70,7 @@ composite_at_least_version (MetaDisplay *display, if (major == -1) meta_display_get_compositor_version (display, &major, &minor); - + return (major > maj || (major == maj && minor >= min)); } @@ -100,7 +100,7 @@ typedef enum _MetaShadowType LAST_SHADOW_TYPE } MetaShadowType; -typedef struct _MetaCompositorXRender +typedef struct _MetaCompositorXRender { MetaCompositor compositor; @@ -131,20 +131,20 @@ typedef struct _MetaCompositorXRender guint debug : 1; } MetaCompositorXRender; -typedef struct _conv +typedef struct _conv { int size; double *data; } conv; -typedef struct _shadow +typedef struct _shadow { conv *gaussian_map; guchar *shadow_corner; guchar *shadow_top; } shadow; - -typedef struct _MetaCompScreen + +typedef struct _MetaCompScreen { MetaScreen *screen; GList *windows; @@ -171,7 +171,7 @@ typedef struct _MetaCompScreen GSList *dock_windows; } MetaCompScreen; -typedef struct _MetaCompWindow +typedef struct _MetaCompWindow { MetaScreen *screen; MetaWindow *window; /* May be NULL if this window isn't managed by Metacity */ @@ -183,7 +183,7 @@ typedef struct _MetaCompWindow /* When the window is shaded back_pixmap will be replaced with the pixmap for the shaded window. This is a copy of the original unshaded window - so that we can still see what the window looked like when it is needed + so that we can still see what the window looked like when it is needed for the _get_window_pixmap function */ Pixmap shaded_back_pixmap; #endif @@ -237,7 +237,7 @@ typedef struct _MetaCompWindow #define SHADOW_LARGE_OFFSET_Y -15 #define SHADOW_OPACITY 0.66 - + #define TRANS_OPACITY 0.75 #define DISPLAY_COMPOSITOR(display) ((MetaCompositorXRender *) meta_display_get_compositor (display)) @@ -267,34 +267,34 @@ make_gaussian_map (double r) c->data = (double *) (c + 1); t = 0.0; - for (y = 0; y < size; y++) + for (y = 0; y < size; y++) { - for (x = 0; x < size; x++) + for (x = 0; x < size; x++) { g = gaussian (r, (double) (x - centre), (double) (y - centre)); t += g; c->data[y * size + x] = g; } } - - for (y = 0; y < size; y++) + + for (y = 0; y < size; y++) { - for (x = 0; x < size; x++) + for (x = 0; x < size; x++) { c->data[y * size + x] /= t; } } - + return c; } static void -dump_xserver_region (const char *location, +dump_xserver_region (const char *location, MetaDisplay *display, XserverRegion region) { MetaCompositorXRender *compositor = DISPLAY_COMPOSITOR (display); - Display *xdisplay = meta_display_get_xdisplay (display); + Display *xdisplay = meta_display_get_xdisplay (display); int nrects; XRectangle *rects; XRectangle bounds; @@ -357,11 +357,11 @@ sum_gaussian (conv *map, g_size = map->size; centre = g_size / 2; fx_start = centre - x; - if (fx_start < 0) + if (fx_start < 0) fx_start = 0; fx_end = width + centre - x; - if (fx_end > g_size) + if (fx_end > g_size) fx_end = g_size; fy_start = centre - y; @@ -369,24 +369,24 @@ sum_gaussian (conv *map, fy_start = 0; fy_end = height + centre - y; - if (fy_end > g_size) + if (fy_end > g_size) fy_end = g_size; g_line = g_line + fy_start * g_size + fx_start; v = 0.0; - for (fy = fy_start; fy < fy_end; fy++) + for (fy = fy_start; fy < fy_end; fy++) { g_data = g_line; g_line += g_size; - + for (fx = fx_start; fx < fx_end; fx++) v += *g_data++; } - + if (v > 1.0) v = 1.0; - + return ((guchar) (v * opacity * 255.0)); } @@ -410,38 +410,38 @@ presum_gaussian (shadow *shad) shad->shadow_corner = (guchar *)(g_malloc ((msize + 1) * (msize + 1) * 26)); shad->shadow_top = (guchar *) (g_malloc ((msize + 1) * 26)); - - for (x = 0; x <= msize; x++) + + for (x = 0; x <= msize; x++) { - + shad->shadow_top[25 * (msize + 1) + x] = sum_gaussian (map, 1, x - centre, centre, msize * 2, msize * 2); - for (opacity = 0; opacity < 25; opacity++) + for (opacity = 0; opacity < 25; opacity++) { shad->shadow_top[opacity * (msize + 1) + x] = shad->shadow_top[25 * (msize + 1) + x] * opacity / 25; } - - for (y = 0; y <= x; y++) + + for (y = 0; y <= x; y++) { - shad->shadow_corner[25 * (msize + 1) * (msize + 1) - + y * (msize + 1) + shad->shadow_corner[25 * (msize + 1) * (msize + 1) + + y * (msize + 1) + x] = sum_gaussian (map, 1, x - centre, y - centre, msize * 2, msize * 2); - - shad->shadow_corner[25 * (msize + 1) * (msize + 1) + + shad->shadow_corner[25 * (msize + 1) * (msize + 1) + x * (msize + 1) + y] = - shad->shadow_corner[25 * (msize + 1) * (msize + 1) + shad->shadow_corner[25 * (msize + 1) * (msize + 1) + y * (msize + 1) + x]; - - for (opacity = 0; opacity < 25; opacity++) + + for (opacity = 0; opacity < 25; opacity++) { - shad->shadow_corner[opacity * (msize + 1) * (msize + 1) + shad->shadow_corner[opacity * (msize + 1) * (msize + 1) + y * (msize + 1) + x] - = shad->shadow_corner[opacity * (msize + 1) * (msize + 1) + = shad->shadow_corner[opacity * (msize + 1) * (msize + 1) + x * (msize + 1) + y] - = shad->shadow_corner[25 * (msize + 1) * (msize + 1) + = shad->shadow_corner[25 * (msize + 1) * (msize + 1) + y * (msize + 1) + x] * opacity / 25; } } @@ -505,7 +505,7 @@ make_shadow (MetaDisplay *display, ximage = XCreateImage (xdisplay, DefaultVisual (xdisplay, screen_number), 8, ZPixmap, 0, (char *) data, swidth, sheight, 8, swidth * sizeof (guchar)); - if (!ximage) + if (!ximage) { g_free (data); return NULL; @@ -521,7 +521,7 @@ make_shadow (MetaDisplay *display, if (msize > 0) d = shad->shadow_top[opacity_int * (msize + 1) + msize]; else - d = sum_gaussian (shad->gaussian_map, opacity, centre, + d = sum_gaussian (shad->gaussian_map, opacity, centre, centre, width, height); memset (data, d, sheight * swidth); @@ -536,59 +536,59 @@ make_shadow (MetaDisplay *display, if (xlimit > swidth / 2) xlimit = (swidth + 1) / 2; - for (y = 0; y < ylimit; y++) + for (y = 0; y < ylimit; y++) { - for (x = 0; x < xlimit; x++) + for (x = 0; x < xlimit; x++) { - + if (xlimit == msize && ylimit == msize) - d = shad->shadow_corner[opacity_int * (msize + 1) * (msize + 1) + y * (msize + 1) + x]; + d = shad->shadow_corner[opacity_int * (msize + 1) * (msize + 1) + y * (msize + 1) + x]; else - d = sum_gaussian (shad->gaussian_map, opacity, x - centre, + d = sum_gaussian (shad->gaussian_map, opacity, x - centre, y - centre, width, height); - + data[y * swidth + x] = d; data[(sheight - y - 1) * swidth + x] = d; data[(sheight - y - 1) * swidth + (swidth - x - 1)] = d; data[y * swidth + (swidth - x - 1)] = d; } } - + /* top/bottom */ x_diff = swidth - (msize * 2); - if (x_diff > 0 && ylimit > 0) + if (x_diff > 0 && ylimit > 0) { - for (y = 0; y < ylimit; y++) + for (y = 0; y < ylimit; y++) { if (ylimit == msize) d = shad->shadow_top[opacity_int * (msize + 1) + y]; else - d = sum_gaussian (shad->gaussian_map, opacity, centre, + d = sum_gaussian (shad->gaussian_map, opacity, centre, y - centre, width, height); memset (&data[y * swidth + msize], d, x_diff); memset (&data[(sheight - y - 1) * swidth + msize], d, x_diff); } } - + /* * sides */ - for (x = 0; x < xlimit; x++) + for (x = 0; x < xlimit; x++) { if (xlimit == msize) d = shad->shadow_top[opacity_int * (msize + 1) + x]; else - d = sum_gaussian (shad->gaussian_map, opacity, x - centre, + d = sum_gaussian (shad->gaussian_map, opacity, x - centre, centre, width, height); - - for (y = msize; y < sheight - msize; y++) + + for (y = msize; y < sheight - msize; y++) { data[y * swidth + x] = d; data[y * swidth + (swidth - x - 1)] = d; } } - + return ximage; } @@ -617,25 +617,25 @@ shadow_picture (MetaDisplay *display, shadow_pixmap = XCreatePixmap (xdisplay, xroot, shadow_image->width, shadow_image->height, 8); - if (!shadow_pixmap) + if (!shadow_pixmap) { XDestroyImage (shadow_image); return None; } shadow_picture = XRenderCreatePicture (xdisplay, shadow_pixmap, - XRenderFindStandardFormat (xdisplay, + XRenderFindStandardFormat (xdisplay, PictStandardA8), 0, 0); - if (!shadow_picture) + if (!shadow_picture) { XDestroyImage (shadow_image); XFreePixmap (xdisplay, shadow_pixmap); return None; } - + gc = XCreateGC (xdisplay, shadow_pixmap, 0, 0); - if (!gc) + if (!gc) { XDestroyImage (shadow_image); XFreePixmap (xdisplay, shadow_pixmap); @@ -647,11 +647,11 @@ PictStandardA8), shadow_image->width, shadow_image->height); *wp = shadow_image->width; *hp = shadow_image->height; - + XFreeGC (xdisplay, gc); XDestroyImage (shadow_image); XFreePixmap (xdisplay, shadow_pixmap); - + return shadow_picture; } @@ -663,7 +663,7 @@ find_window_for_screen (MetaScreen *screen, if (info == NULL) return NULL; - + return g_hash_table_lookup (info->windows_by_xid, (gpointer) xwindow); } @@ -673,14 +673,14 @@ find_window_in_display (MetaDisplay *display, { GSList *index; - for (index = meta_display_get_screens (display); index; index = index->next) + for (index = meta_display_get_screens (display); index; index = index->next) { MetaCompWindow *cw = find_window_for_screen (index->data, xwindow); if (cw != NULL) return cw; } - + return NULL; } @@ -694,7 +694,7 @@ find_window_for_child_window_in_display (MetaDisplay *display, XQueryTree (meta_display_get_xdisplay (display), xwindow, &ignored1, &parent, &ignored2, &ignored_children); - + if (parent != None) return find_window_in_display (display, parent); @@ -727,7 +727,7 @@ solid_picture (MetaDisplay *display, pa.repeat = TRUE; picture = XRenderCreatePicture (xdisplay, pixmap, render_format, CPRepeat, &pa); - if (picture == None) + if (picture == None) { XFreePixmap (xdisplay, pixmap); g_warning ("(picture != None) failed"); @@ -738,10 +738,10 @@ solid_picture (MetaDisplay *display, c.red = r * 0xffff; c.green = g * 0xffff; c.blue = b * 0xffff; - + XRenderFillRectangle (xdisplay, PictOpSrc, picture, &c, 0, 0, 1, 1); XFreePixmap (xdisplay, pixmap); - + return picture; } @@ -766,46 +766,46 @@ root_tile (MetaScreen *screen) background_atoms[1] = DISPLAY_COMPOSITOR (display)->atom_x_set_root; pixmap_atom = XInternAtom (xdisplay, "PIXMAP", False); - for (p = 0; p < 2; p++) + for (p = 0; p < 2; p++) { Atom actual_type; int actual_format; gulong nitems, bytes_after; guchar *prop; - - if (XGetWindowProperty (xdisplay, xroot, + + if (XGetWindowProperty (xdisplay, xroot, background_atoms[p], 0, 4, FALSE, AnyPropertyType, - &actual_type, &actual_format, + &actual_type, &actual_format, &nitems, &bytes_after, &prop) == Success) { if (actual_type == pixmap_atom && actual_format == 32 && - nitems == 1) + nitems == 1) { memcpy (&pixmap, prop, 4); XFree (prop); fill = FALSE; break; } - } + } } - if (!pixmap) + if (!pixmap) { - pixmap = XCreatePixmap (xdisplay, xroot, 1, 1, + pixmap = XCreatePixmap (xdisplay, xroot, 1, 1, DefaultDepth (xdisplay, screen_number)); g_return_val_if_fail (pixmap != None, None); fill = TRUE; } - + pa.repeat = TRUE; format = XRenderFindVisualFormat (xdisplay, DefaultVisual (xdisplay, screen_number)); g_return_val_if_fail (format != NULL, None); - + picture = XRenderCreatePicture (xdisplay, pixmap, format, CPRepeat, &pa); - if ((picture != None) && (fill)) + if ((picture != None) && (fill)) { XRenderColor c; @@ -814,16 +814,16 @@ root_tile (MetaScreen *screen) c.green = 0x8080; c.blue = 0x8080; c.alpha = 0xffff; - + XRenderFillRectangle (xdisplay, PictOpSrc, picture, &c, 0, 0, 1, 1); - XFreePixmap (xdisplay, pixmap); + XFreePixmap (xdisplay, pixmap); } return picture; } - + static Picture -create_root_buffer (MetaScreen *screen) +create_root_buffer (MetaScreen *screen) { MetaDisplay *display = meta_screen_get_display (screen); Display *xdisplay = meta_display_get_xdisplay (display); @@ -873,12 +873,12 @@ paint_root (MetaScreen *screen, g_return_if_fail (root_buffer != None); - if (info->root_tile == None) + if (info->root_tile == None) { info->root_tile = root_tile (screen); g_return_if_fail (info->root_tile != None); } - + meta_screen_get_size (screen, &width, &height); XRenderComposite (xdisplay, PictOpSrc, info->root_tile, None, root_buffer, 0, 0, 0, 0, 0, 0, width, height); @@ -895,7 +895,7 @@ window_has_shadow (MetaCompWindow *cw) /* Always put a shadow around windows with a frame - This should override the restriction about not putting a shadow around shaped windows as the frame might be the reason the window is shaped */ - if (cw->window) + if (cw->window) { if (meta_window_get_frame (cw->window)) { meta_verbose ("Window has shadow because it has a frame\n"); @@ -928,7 +928,7 @@ window_has_shadow (MetaCompWindow *cw) return TRUE; } - if (cw->type == META_COMP_WINDOW_MENU || + if (cw->type == META_COMP_WINDOW_MENU || cw->type == META_COMP_WINDOW_DROP_DOWN_MENU) { meta_verbose ("Window has shadow as it is a menu\n"); return TRUE; @@ -969,43 +969,43 @@ win_extents (MetaCompWindow *cw) cw->shadow_dx = shadow_offsets_x [cw->shadow_type]; cw->shadow_dy = shadow_offsets_y [cw->shadow_type]; - if (!cw->shadow) + if (!cw->shadow) { double opacity = SHADOW_OPACITY; if (cw->opacity != (guint) OPAQUE) opacity = opacity * ((double) cw->opacity) / ((double) OPAQUE); - - cw->shadow = shadow_picture (display, screen, cw->shadow_type, + + cw->shadow = shadow_picture (display, screen, cw->shadow_type, opacity, cw->alpha_pict, cw->attrs.width + cw->attrs.border_width * 2, cw->attrs.height + cw->attrs.border_width * 2, &cw->shadow_width, &cw->shadow_height); } - + sr.x = cw->attrs.x + cw->shadow_dx; sr.y = cw->attrs.y + cw->shadow_dy; sr.width = cw->shadow_width; sr.height = cw->shadow_height; - - if (sr.x < r.x) + + if (sr.x < r.x) { r.width = (r.x + r.width) - sr.x; r.x = sr.x; } - - if (sr.y < r.y) + + if (sr.y < r.y) { r.height = (r.y + r.height) - sr.y; r.y = sr.y; } - + if (sr.x + sr.width > r.x + r.width) r.width = sr.x + sr.width - r.x; - - if (sr.y + sr.height > r.y + r.height) + + if (sr.y + sr.height > r.y + r.height) r.height = sr.y + sr.height - r.y; } - + return XFixesCreateRegion (xdisplay, &r, 1); } @@ -1064,14 +1064,14 @@ get_window_picture (MetaCompWindow *cw) { if (cw->back_pixmap == None) cw->back_pixmap = XCompositeNameWindowPixmap (xdisplay, cw->id); - + if (cw->back_pixmap != None) draw = cw->back_pixmap; } #endif format = get_window_format (cw); - if (format) + if (format) { Picture pict; @@ -1102,7 +1102,7 @@ paint_dock_shadows (MetaScreen *screen, return; } - for (d = info->dock_windows; d; d = d->next) + for (d = info->dock_windows; d; d = d->next) { MetaCompWindow *cw = d->data; XserverRegion shadow_clip; @@ -1110,9 +1110,9 @@ paint_dock_shadows (MetaScreen *screen, if (cw->shadow) { shadow_clip = XFixesCreateRegion (xdisplay, NULL, 0); - XFixesIntersectRegion (xdisplay, shadow_clip, + XFixesIntersectRegion (xdisplay, shadow_clip, cw->border_clip, region); - + XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0, shadow_clip); XRenderComposite (xdisplay, PictOpOver, info->black_picture, @@ -1147,7 +1147,7 @@ paint_windows (MetaScreen *screen, meta_screen_get_size (screen, &screen_width, &screen_height); - if (region == None) + if (region == None) { XRectangle r; r.x = 0; @@ -1155,7 +1155,7 @@ paint_windows (MetaScreen *screen, r.width = screen_width; r.height = screen_height; paint_region = XFixesCreateRegion (xdisplay, &r, 1); - } + } else { paint_region = XFixesCreateRegion (xdisplay, NULL, 0); @@ -1165,17 +1165,17 @@ paint_windows (MetaScreen *screen, desktop_region = None; /* - * Painting from top to bottom, reducing the clipping area at + * Painting from top to bottom, reducing the clipping area at * each iteration. Only the opaque windows are painted 1st. */ last = NULL; - for (index = windows; index; index = index->next) + for (index = windows; index; index = index->next) { /* Store the last window we dealt with */ last = index; cw = (MetaCompWindow *) index->data; - if (!cw->damaged) + if (!cw->damaged) { /* Not damaged */ continue; @@ -1184,45 +1184,45 @@ paint_windows (MetaScreen *screen, #if 0 if ((cw->attrs.x + cw->attrs.width < 1) || (cw->attrs.y + cw->attrs.height < 1) || - (cw->attrs.x >= screen_width) || (cw->attrs.y >= screen_height)) + (cw->attrs.x >= screen_width) || (cw->attrs.y >= screen_height)) { /* Off screen */ continue; } #endif - if (cw->picture == None) + if (cw->picture == None) cw->picture = get_window_picture (cw); /* If the clip region of the screen has been changed then we need to recreate the extents of the window */ - if (info->clip_changed) + if (info->clip_changed) { - if (cw->border_size) + if (cw->border_size) { XFixesDestroyRegion (xdisplay, cw->border_size); cw->border_size = None; } #if 0 - if (cw->extents) + if (cw->extents) { XFixesDestroyRegion (xdisplay, cw->extents); cw->extents = None; } #endif } - + if (cw->border_size == None) cw->border_size = border_size (cw); - + if (cw->extents == None) cw->extents = win_extents (cw); - - if (cw->mode == WINDOW_SOLID) + + if (cw->mode == WINDOW_SOLID) { int x, y, wid, hei; - + #ifdef HAVE_NAME_WINDOW_PIXMAP if (have_name_window_pixmap (display)) { @@ -1239,30 +1239,30 @@ paint_windows (MetaScreen *screen, wid = cw->attrs.width; hei = cw->attrs.height; } - - XFixesSetPictureClipRegion (xdisplay, root_buffer, + + XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0, paint_region); - XRenderComposite (xdisplay, PictOpSrc, cw->picture, + XRenderComposite (xdisplay, PictOpSrc, cw->picture, None, root_buffer, 0, 0, 0, 0, x, y, wid, hei); - if (cw->type == META_COMP_WINDOW_DESKTOP) + if (cw->type == META_COMP_WINDOW_DESKTOP) { desktop_region = XFixesCreateRegion (xdisplay, 0, 0); XFixesCopyRegion (xdisplay, desktop_region, paint_region); } - XFixesSubtractRegion (xdisplay, paint_region, + XFixesSubtractRegion (xdisplay, paint_region, paint_region, cw->border_size); } - - if (!cw->border_clip) + + if (!cw->border_clip) { cw->border_clip = XFixesCreateRegion (xdisplay, 0, 0); XFixesCopyRegion (xdisplay, cw->border_clip, paint_region); } } - + XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0, paint_region); paint_root (screen, root_buffer); @@ -1271,25 +1271,25 @@ paint_windows (MetaScreen *screen, if (desktop_region != None) XFixesDestroyRegion (xdisplay, desktop_region); - /* + /* * Painting from bottom to top, translucent windows and shadows are painted */ - for (index = last; index; index = index->prev) - { + for (index = last; index; index = index->prev) + { cw = (MetaCompWindow *) index->data; - - if (cw->picture) + + if (cw->picture) { - if (cw->shadow && cw->type != META_COMP_WINDOW_DOCK) + if (cw->shadow && cw->type != META_COMP_WINDOW_DOCK) { XserverRegion shadow_clip; shadow_clip = XFixesCreateRegion (xdisplay, NULL, 0); XFixesSubtractRegion (xdisplay, shadow_clip, cw->border_clip, cw->border_size); - XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0, + XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0, shadow_clip); - + XRenderComposite (xdisplay, PictOpOver, info->black_picture, cw->shadow, root_buffer, 0, 0, 0, 0, @@ -1300,18 +1300,18 @@ paint_windows (MetaScreen *screen, XFixesDestroyRegion (xdisplay, shadow_clip); } - if ((cw->opacity != (guint) OPAQUE) && !(cw->alpha_pict)) + if ((cw->opacity != (guint) OPAQUE) && !(cw->alpha_pict)) { cw->alpha_pict = solid_picture (display, screen, FALSE, (double) cw->opacity / OPAQUE, 0, 0, 0); } - - XFixesIntersectRegion (xdisplay, cw->border_clip, cw->border_clip, + + XFixesIntersectRegion (xdisplay, cw->border_clip, cw->border_clip, cw->border_size); XFixesSetPictureClipRegion (xdisplay, root_buffer, 0, 0, cw->border_clip); - if (cw->mode == WINDOW_ARGB) + if (cw->mode == WINDOW_ARGB) { int x, y, wid, hei; #ifdef HAVE_NAME_WINDOW_PIXMAP @@ -1330,14 +1330,14 @@ paint_windows (MetaScreen *screen, wid = cw->attrs.width; hei = cw->attrs.height; } - - XRenderComposite (xdisplay, PictOpOver, cw->picture, + + XRenderComposite (xdisplay, PictOpOver, cw->picture, cw->alpha_pict, root_buffer, 0, 0, 0, 0, x, y, wid, hei); - } + } } - - if (cw->border_clip) + + if (cw->border_clip) { XFixesDestroyRegion (xdisplay, cw->border_clip); cw->border_clip = None; @@ -1372,22 +1372,22 @@ paint_all (MetaScreen *screen, ((double) (rand () % 100)) / 100.0, ((double) (rand () % 100)) / 100.0, ((double) (rand () % 100)) / 100.0); - + XRenderComposite (xdisplay, PictOpOver, overlay, None, info->root_picture, 0, 0, 0, 0, 0, 0, screen_width, screen_height); XRenderFreePicture (xdisplay, overlay); XFlush (xdisplay); usleep (100 * 1000); } - - if (info->root_buffer == None) + + if (info->root_buffer == None) info->root_buffer = create_root_buffer (screen); - + paint_windows (screen, info->windows, info->root_buffer, region); XFixesSetPictureClipRegion (xdisplay, info->root_buffer, 0, 0, region); XRenderComposite (xdisplay, PictOpSrc, info->root_buffer, None, - info->root_picture, 0, 0, 0, 0, 0, 0, + info->root_picture, 0, 0, 0, 0, 0, 0, screen_width, screen_height); } @@ -1398,7 +1398,7 @@ repair_screen (MetaScreen *screen) MetaDisplay *display = meta_screen_get_display (screen); Display *xdisplay = meta_display_get_xdisplay (display); - if (info!=NULL && info->all_damage != None) + if (info!=NULL && info->all_damage != None) { meta_error_trap_push (display); paint_all (screen, info->all_damage); @@ -1416,7 +1416,7 @@ repair_display (MetaDisplay *display) MetaCompositorXRender *compositor = DISPLAY_COMPOSITOR (display); #ifdef USE_IDLE_REPAINT - if (compositor->repaint_id > 0) + if (compositor->repaint_id > 0) { g_source_remove (compositor->repaint_id); compositor->repaint_id = 0; @@ -1474,7 +1474,7 @@ add_damage (MetaScreen *screen, { XFixesUnionRegion (xdisplay, info->all_damage, info->all_damage, damage); XFixesDestroyRegion (xdisplay, damage); - } + } else info->all_damage = damage; @@ -1512,12 +1512,12 @@ repair_win (MetaCompWindow *cw) XserverRegion parts; meta_error_trap_push (display); - if (!cw->damaged) + if (!cw->damaged) { parts = win_extents (cw); XDamageSubtract (xdisplay, cw->damage, None, None); - } - else + } + else { parts = XFixesCreateRegion (xdisplay, 0, 0); XDamageSubtract (xdisplay, cw->damage, None, parts); @@ -1525,7 +1525,7 @@ repair_win (MetaCompWindow *cw) cw->attrs.x + cw->attrs.border_width, cw->attrs.y + cw->attrs.border_width); } - + meta_error_trap_pop (display, FALSE); dump_xserver_region ("repair_win", display, parts); @@ -1545,12 +1545,12 @@ free_win (MetaCompWindow *cw, if (have_name_window_pixmap (display)) { /* See comment in map_win */ - if (cw->back_pixmap && destroy) + if (cw->back_pixmap && destroy) { XFreePixmap (xdisplay, cw->back_pixmap); cw->back_pixmap = None; } - + if (cw->shaded_back_pixmap && destroy) { XFreePixmap (xdisplay, cw->shaded_back_pixmap); @@ -1559,50 +1559,50 @@ free_win (MetaCompWindow *cw, } #endif - if (cw->picture) + if (cw->picture) { XRenderFreePicture (xdisplay, cw->picture); cw->picture = None; } - if (cw->shadow) + if (cw->shadow) { XRenderFreePicture (xdisplay, cw->shadow); cw->shadow = None; } - if (cw->alpha_pict) + if (cw->alpha_pict) { XRenderFreePicture (xdisplay, cw->alpha_pict); cw->alpha_pict = None; } - if (cw->shadow_pict) + if (cw->shadow_pict) { XRenderFreePicture (xdisplay, cw->shadow_pict); cw->shadow_pict = None; } - - if (cw->border_size) + + if (cw->border_size) { XFixesDestroyRegion (xdisplay, cw->border_size); cw->border_size = None; } - - if (cw->border_clip) + + if (cw->border_clip) { XFixesDestroyRegion (xdisplay, cw->border_clip); cw->border_clip = None; } - if (cw->extents) + if (cw->extents) { XFixesDestroyRegion (xdisplay, cw->extents); cw->extents = None; } - if (destroy) - { + if (destroy) + { if (cw->damage != None) { meta_error_trap_push (display); XDamageDestroy (xdisplay, cw->damage); @@ -1619,7 +1619,7 @@ free_win (MetaCompWindow *cw, g_free (cw); } } - + static void map_win (MetaDisplay *display, MetaScreen *screen, @@ -1633,15 +1633,15 @@ map_win (MetaDisplay *display, #ifdef HAVE_NAME_WINDOW_PIXMAP /* The reason we deallocate this here and not in unmap - is so that we will still have a valid pixmap for + is so that we will still have a valid pixmap for whenever the window is unmapped */ - if (cw->back_pixmap) + if (cw->back_pixmap) { XFreePixmap (xdisplay, cw->back_pixmap); cw->back_pixmap = None; } - if (cw->shaded_back_pixmap) + if (cw->shaded_back_pixmap) { XFreePixmap (xdisplay, cw->shaded_back_pixmap); cw->shaded_back_pixmap = None; @@ -1665,13 +1665,13 @@ unmap_win (MetaDisplay *display, return; } - if (cw->window && cw->window == info->focus_window) + if (cw->window && cw->window == info->focus_window) info->focus_window = NULL; cw->attrs.map_state = IsUnmapped; cw->damaged = FALSE; - if (cw->extents != None) + if (cw->extents != None) { dump_xserver_region ("unmap_win", display, cw->extents); add_damage (screen, cw->extents); @@ -1690,13 +1690,13 @@ determine_mode (MetaDisplay *display, XRenderPictFormat *format; Display *xdisplay = meta_display_get_xdisplay (display); - if (cw->alpha_pict) + if (cw->alpha_pict) { XRenderFreePicture (xdisplay, cw->alpha_pict); cw->alpha_pict = None; } - if (cw->shadow_pict) + if (cw->shadow_pict) { XRenderFreePicture (xdisplay, cw->shadow_pict); cw->shadow_pict = None; @@ -1706,14 +1706,14 @@ determine_mode (MetaDisplay *display, format = NULL; else format = XRenderFindVisualFormat (xdisplay, cw->attrs.visual); - + if ((format && format->type == PictTypeDirect && format->direct.alphaMask) || cw->opacity != (guint) OPAQUE) cw->mode = WINDOW_ARGB; else cw->mode = WINDOW_SOLID; - if (cw->extents) + if (cw->extents) { XserverRegion damage; damage = XFixesCreateRegion (xdisplay, NULL, 0); @@ -1740,7 +1740,7 @@ is_shaped (MetaDisplay *display, &xbs, &ybs, &wbs, &hbs); return (bounding_shaped != 0); } - + return FALSE; } @@ -1756,12 +1756,12 @@ get_window_type (MetaDisplay *display, type_atom = None; n_atoms = 0; atoms = NULL; - - meta_prop_get_atom_list (display, cw->id, + + meta_prop_get_atom_list (display, cw->id, compositor->atom_net_wm_window_type, &atoms, &n_atoms); - for (i = 0; i < n_atoms; i++) + for (i = 0; i < n_atoms; i++) { if (atoms[i] == compositor->atom_net_wm_window_type_dnd || atoms[i] == compositor->atom_net_wm_window_type_desktop || @@ -1799,7 +1799,7 @@ get_window_type (MetaDisplay *display, /* meta_verbose ("Window is %d\n", cw->type); */ } - + /* Must be called with an error trap in place */ static void add_win (MetaScreen *screen, @@ -1812,10 +1812,10 @@ add_win (MetaScreen *screen, MetaCompWindow *cw; gulong event_mask; - if (info == NULL) + if (info == NULL) return; - if (xwindow == info->output) + if (xwindow == info->output) return; /* If already added, ignore */ @@ -1827,7 +1827,7 @@ add_win (MetaScreen *screen, cw->window = window; cw->id = xwindow; - if (!XGetWindowAttributes (xdisplay, xwindow, &cw->attrs)) + if (!XGetWindowAttributes (xdisplay, xwindow, &cw->attrs)) { g_free (cw); return; @@ -1837,7 +1837,7 @@ add_win (MetaScreen *screen, /* If Metacity has decided not to manage this window then the input events won't have been set on the window */ event_mask = cw->attrs.your_event_mask | PropertyChangeMask; - + XSelectInput (xdisplay, xwindow, event_mask); @@ -1870,14 +1870,14 @@ add_win (MetaScreen *screen, cw->shadow_type = META_SHADOW_MEDIUM; cw->opacity = OPAQUE; - + cw->border_clip = None; determine_mode (display, screen, cw); cw->needs_shadow = window_has_shadow (cw); /* Only add the window to the list of docks if it needs a shadow */ - if (cw->type == META_COMP_WINDOW_DOCK && cw->needs_shadow) + if (cw->type == META_COMP_WINDOW_DOCK && cw->needs_shadow) { meta_verbose ("Appending %p to dock windows\n", cw); info->dock_windows = g_slist_append (info->dock_windows, cw); @@ -1907,21 +1907,21 @@ destroy_win (MetaDisplay *display, return; screen = cw->screen; - - if (cw->extents != None) + + if (cw->extents != None) { dump_xserver_region ("destroy_win", display, cw->extents); add_damage (screen, cw->extents); cw->extents = None; } - + info = meta_screen_get_compositor_data (screen); if (info != NULL) { info->windows = g_list_remove (info->windows, (gconstpointer) cw); g_hash_table_remove (info->windows_by_xid, (gpointer) xwindow); } - + free_win (cw, TRUE); } @@ -1946,32 +1946,32 @@ restack_win (MetaCompWindow *cw, next = g_list_next (sibling); previous_above = None; - if (next) + if (next) { MetaCompWindow *ncw = (MetaCompWindow *) next->data; previous_above = ncw->id; } - /* If above is set to None, the window whose state was changed is on + /* If above is set to None, the window whose state was changed is on * the bottom of the stack with respect to sibling. */ - if (above == None) + if (above == None) { /* Insert at bottom of window stack */ info->windows = g_list_delete_link (info->windows, sibling); info->windows = g_list_append (info->windows, cw); - } - else if (previous_above != above) + } + else if (previous_above != above) { GList *index; - + for (index = info->windows; index; index = index->next) { MetaCompWindow *cw2 = (MetaCompWindow *) index->data; if (cw2->id == above) break; } - - if (index != NULL) + + if (index != NULL) { info->windows = g_list_delete_link (info->windows, sibling); info->windows = g_list_insert_before (info->windows, index, cw); @@ -2017,25 +2017,25 @@ resize_win (MetaCompWindow *cw, meta_screen_get_size (screen, &r.width, &r.height); fprintf (stderr, "Damage whole screen %d,%d (%d %d)\n", r.x, r.y, r.width, r.height); - + damage = XFixesCreateRegion (xdisplay, &r, 1); } */ cw->attrs.x = x; cw->attrs.y = y; - if (cw->attrs.width != width || cw->attrs.height != height) + if (cw->attrs.width != width || cw->attrs.height != height) { #ifdef HAVE_NAME_WINDOW_PIXMAP if (have_name_window_pixmap (display)) { - if (cw->shaded_back_pixmap) + if (cw->shaded_back_pixmap) { XFreePixmap (xdisplay, cw->shaded_back_pixmap); cw->shaded_back_pixmap = None; } - - if (cw->back_pixmap) + + if (cw->back_pixmap) { /* If the window is shaded, we store the old backing pixmap so we can return a proper image of the window */ @@ -2052,13 +2052,13 @@ resize_win (MetaCompWindow *cw, } } #endif - if (cw->picture) + if (cw->picture) { XRenderFreePicture (xdisplay, cw->picture); cw->picture = None; } - - if (cw->shadow) + + if (cw->shadow) { XRenderFreePicture (xdisplay, cw->shadow); cw->shadow = None; @@ -2075,12 +2075,12 @@ resize_win (MetaCompWindow *cw, cw->extents = win_extents (cw); - if (damage) + if (damage) { if (debug) - fprintf (stderr, "Inexplicable intersection with new extents!\n"); + fprintf (stderr, "Inexplicable intersection with new extents!\n"); - XFixesUnionRegion (xdisplay, damage, damage, cw->extents); + XFixesUnionRegion (xdisplay, damage, damage, cw->extents); } else { @@ -2110,7 +2110,7 @@ process_circulate_notify (MetaCompositorXRender *compositor, GList *first; Window above; - if (!cw) + if (!cw) return; screen = cw->screen; @@ -2142,7 +2142,7 @@ process_configure_notify (MetaCompositorXRender *compositor, Display *xdisplay = meta_display_get_xdisplay (display); MetaCompWindow *cw = find_window_in_display (display, event->window); - if (cw) + if (cw) { #if 0 int x = -1, y = -1, width = -1, height = -1; @@ -2155,7 +2155,7 @@ process_configure_notify (MetaCompositorXRender *compositor, y = rect->y; width = rect->width; height = rect->height; - } + } fprintf (stderr, "configure notify xy (%d %d) -> (%d %d), wh (%d %d) -> (%d %d)\n", x, y, event->x, event->y, width, height, event->width, event->height); @@ -2163,7 +2163,7 @@ process_configure_notify (MetaCompositorXRender *compositor, if (compositor->debug) { - fprintf (stderr, "configure notify %d %d %d\n", cw->damaged, + fprintf (stderr, "configure notify %d %d %d\n", cw->damaged, cw->shaped, cw->needs_shadow); dump_xserver_region ("\textents", display, cw->extents); fprintf (stderr, "\txy (%d %d), wh (%d %d)\n", @@ -2175,7 +2175,7 @@ process_configure_notify (MetaCompositorXRender *compositor, event->border_width, event->override_redirect); } else - { + { MetaScreen *screen; MetaCompScreen *info; @@ -2209,7 +2209,7 @@ process_property_notify (MetaCompositorXRender *compositor, background_atoms[0] = compositor->atom_x_root_pixmap; background_atoms[1] = compositor->atom_x_set_root; - for (p = 0; p < 2; p++) + for (p = 0; p < 2; p++) { if (event->atom == background_atoms[p]) { @@ -2224,8 +2224,8 @@ process_property_notify (MetaCompositorXRender *compositor, XClearArea (xdisplay, xroot, 0, 0, 0, 0, TRUE); XRenderFreePicture (xdisplay, info->root_tile); info->root_tile = None; - - /* Damage the whole screen as we may need to redraw the + + /* Damage the whole screen as we may need to redraw the background ourselves */ damage_screen (screen); #ifdef USE_IDLE_REPAINT @@ -2239,19 +2239,19 @@ process_property_notify (MetaCompositorXRender *compositor, } /* Check for the opacity changing */ - if (event->atom == compositor->atom_net_wm_window_opacity) + if (event->atom == compositor->atom_net_wm_window_opacity) { MetaCompWindow *cw = find_window_in_display (display, event->window); gulong value; - if (!cw) + if (!cw) { /* Applications can set this for their toplevel windows, so * this must be propagated to the window managed by the compositor */ cw = find_window_for_child_window_in_display (display, event->window); } - + if (!cw) return; @@ -2327,7 +2327,7 @@ process_expose (MetaCompositorXRender *compositor, } else { - screen = meta_display_screen_for_root (compositor->display, + screen = meta_display_screen_for_root (compositor->display, event->window); if (screen == NULL) return; @@ -2337,7 +2337,7 @@ process_expose (MetaCompositorXRender *compositor, rect[0].y = event->y + origin_y; rect[0].width = event->width; rect[0].height = event->height; - + expose_area (screen, rect, 1); } @@ -2347,12 +2347,12 @@ process_unmap (MetaCompositorXRender *compositor, { MetaCompWindow *cw; - if (event->from_configure) + if (event->from_configure) { /* Ignore unmap caused by parent's resize */ return; } - + cw = find_window_in_display (compositor->display, event->window); if (cw) @@ -2363,7 +2363,7 @@ static void process_map (MetaCompositorXRender *compositor, XMapEvent *event) { - MetaCompWindow *cw = find_window_in_display (compositor->display, + MetaCompWindow *cw = find_window_in_display (compositor->display, event->window); if (cw) @@ -2381,7 +2381,7 @@ process_reparent (MetaCompositorXRender *compositor, if (screen != NULL) add_win (screen, window, event->window); else - destroy_win (compositor->display, event->window, FALSE); + destroy_win (compositor->display, event->window, FALSE); } static void @@ -2396,7 +2396,7 @@ process_create (MetaCompositorXRender *compositor, screen = meta_display_screen_for_root (compositor->display, event->parent); if (screen == NULL) return; - + if (!find_window_in_display (compositor->display, event->window)) add_win (screen, window, event->window); } @@ -2424,7 +2424,7 @@ process_damage (MetaCompositorXRender *compositor, add_repair (compositor->display); #endif } - + static void process_shape (MetaCompositorXRender *compositor, XShapeEvent *event) @@ -2435,15 +2435,15 @@ process_shape (MetaCompositorXRender *compositor, if (cw == NULL) return; - if (event->kind == ShapeBounding) + if (event->kind == ShapeBounding) { if (!event->shaped && cw->shaped) cw->shaped = FALSE; - + resize_win (cw, cw->attrs.x, cw->attrs.y, event->width + event->x, event->height + event->y, cw->attrs.border_width, cw->attrs.override_redirect); - + if (event->shaped && !cw->shaped) cw->shaped = TRUE; } @@ -2495,12 +2495,12 @@ show_overlay_window (MetaScreen *screen, XserverRegion region; region = XFixesCreateRegion (xdisplay, NULL, 0); - + XFixesSetWindowShapeRegion (xdisplay, cow, ShapeBounding, 0, 0, 0); XFixesSetWindowShapeRegion (xdisplay, cow, ShapeInput, 0, 0, region); - + XFixesDestroyRegion (xdisplay, region); - + damage_screen (screen); } #endif @@ -2575,12 +2575,12 @@ xrender_manage_screen (MetaCompositor *compositor, info = g_new0 (MetaCompScreen, 1); info->screen = screen; - + meta_screen_set_compositor_data (screen, info); visual_format = XRenderFindVisualFormat (xdisplay, DefaultVisual (xdisplay, screen_number)); - if (!visual_format) + if (!visual_format) { g_warning ("Cannot find visual format on screen %i", screen_number); return; @@ -2590,20 +2590,20 @@ xrender_manage_screen (MetaCompositor *compositor, pa.subwindow_mode = IncludeInferiors; info->root_picture = XRenderCreatePicture (xdisplay, info->output, - visual_format, + visual_format, CPSubwindowMode, &pa); - if (info->root_picture == None) + if (info->root_picture == None) { g_warning ("Cannot create root picture on screen %i", screen_number); return; } - + info->root_buffer = None; info->black_picture = solid_picture (display, screen, TRUE, 1, 0, 0, 0); info->root_tile = None; info->all_damage = None; - + info->windows = NULL; info->windows_by_xid = g_hash_table_new (g_direct_hash, g_direct_equal); @@ -2651,7 +2651,7 @@ xrender_unmanage_screen (MetaCompositor *compositor, hide_overlay_window (screen, info->output); /* Destroy the windows */ - for (index = info->windows; index; index = index->next) + for (index = info->windows; index; index = index->next) { MetaCompWindow *cw = (MetaCompWindow *) index->data; free_win (cw, TRUE); @@ -2665,10 +2665,10 @@ xrender_unmanage_screen (MetaCompositor *compositor, if (info->black_picture) XRenderFreePicture (xdisplay, info->black_picture); - if (info->have_shadows) + if (info->have_shadows) { int i; - + for (i = 0; i < LAST_SHADOW_TYPE; i++) g_free (info->shadows[i]->gaussian_map); } @@ -2693,7 +2693,7 @@ xrender_set_updates (MetaCompositor *compositor, gboolean updates) { #ifdef HAVE_COMPOSITE_EXTENSIONS - + #endif } @@ -2744,9 +2744,9 @@ xrender_free_window (MetaCompositor *compositor, MetaWindow *window) { #ifdef HAVE_COMPOSITE_EXTENSIONS - /* FIXME: When an undecorated window is hidden this is called, - but the window does not get readded if it is subsequentally shown again - See http://bugzilla.gnome.org/show_bug.cgi?id=504876 + /* FIXME: When an undecorated window is hidden this is called, + but the window does not get readded if it is subsequentally shown again + See http://bugzilla.gnome.org/show_bug.cgi?id=504876 I don't *think* theres any need for this call anyway, leaving it out does not seem to cause any side effects so far, but I should check with @@ -2769,12 +2769,12 @@ xrender_process_event (MetaCompositor *compositor, * enough about Metacity/X to know how else you are supposed to do it */ meta_error_trap_push (xrc->display); - switch (event->type) + switch (event->type) { case CirculateNotify: process_circulate_notify (xrc, (XCirculateEvent *) event); break; - + case ConfigureNotify: process_configure_notify (xrc, (XConfigureEvent *) event); break; @@ -2786,47 +2786,47 @@ xrender_process_event (MetaCompositor *compositor, case Expose: process_expose (xrc, (XExposeEvent *) event); break; - + case UnmapNotify: process_unmap (xrc, (XUnmapEvent *) event); break; - + case MapNotify: process_map (xrc, (XMapEvent *) event); break; - + case ReparentNotify: process_reparent (xrc, (XReparentEvent *) event, window); break; - + case CreateNotify: process_create (xrc, (XCreateWindowEvent *) event, window); break; - + case DestroyNotify: process_destroy (xrc, (XDestroyWindowEvent *) event); break; - + default: - if (event->type == meta_display_get_damage_event_base (xrc->display) + XDamageNotify) + if (event->type == meta_display_get_damage_event_base (xrc->display) + XDamageNotify) process_damage (xrc, (XDamageNotifyEvent *) event); #ifdef HAVE_SHAPE - else if (event->type == meta_display_get_shape_event_base (xrc->display) + ShapeNotify) + else if (event->type == meta_display_get_shape_event_base (xrc->display) + ShapeNotify) process_shape (xrc, (XShapeEvent *) event); #endif /* HAVE_SHAPE */ - else + else { meta_error_trap_pop (xrc->display, FALSE); return; } break; } - + meta_error_trap_pop (xrc->display, FALSE); #ifndef USE_IDLE_REPAINT repair_display (xrc->display); #endif - + return; #endif } @@ -2840,7 +2840,7 @@ xrender_get_window_pixmap (MetaCompositor *compositor, MetaScreen *screen = meta_window_get_screen (window); MetaFrame *frame = meta_window_get_frame (window); - cw = find_window_for_screen (screen, frame ? meta_frame_get_xwindow (frame) : + cw = find_window_for_screen (screen, frame ? meta_frame_get_xwindow (frame) : meta_window_get_xwindow (window)); if (cw == NULL) return None; @@ -2884,16 +2884,16 @@ xrender_set_active_window (MetaCompositor *compositor, old_focus_win = info->focus_window; } - if (old_focus_win) + if (old_focus_win) { MetaFrame *f = meta_window_get_frame (old_focus_win); - old_focus = find_window_for_screen (screen, + old_focus = find_window_for_screen (screen, f ? meta_frame_get_xwindow (f) : meta_window_get_xwindow (old_focus_win)); } - if (window) + if (window) { MetaFrame *f = meta_window_get_frame (window); new_focus = find_window_for_screen (screen, @@ -2922,7 +2922,7 @@ xrender_set_active_window (MetaCompositor *compositor, XRenderFreePicture (xdisplay, old_focus->shadow); old_focus->shadow = None; } - + if (old_focus->extents) { damage = XFixesCreateRegion (xdisplay, NULL, 0); @@ -2931,18 +2931,18 @@ xrender_set_active_window (MetaCompositor *compositor, } else damage = None; - + /* Build new extents */ old_focus->extents = win_extents (old_focus); - - if (damage) - XFixesUnionRegion (xdisplay, damage, damage, old_focus->extents); + + if (damage) + XFixesUnionRegion (xdisplay, damage, damage, old_focus->extents); else { damage = XFixesCreateRegion (xdisplay, NULL, 0); XFixesCopyRegion (xdisplay, damage, old_focus->extents); } - + dump_xserver_region ("resize_win", display, damage); add_damage (screen, damage); @@ -2960,13 +2960,13 @@ xrender_set_active_window (MetaCompositor *compositor, new_focus->shadow_type = META_SHADOW_LARGE; determine_mode (display, screen, new_focus); new_focus->needs_shadow = window_has_shadow (new_focus); - + if (new_focus->shadow) { XRenderFreePicture (xdisplay, new_focus->shadow); new_focus->shadow = None; } - + if (new_focus->extents) { damage = XFixesCreateRegion (xdisplay, NULL, 0); @@ -2975,18 +2975,18 @@ xrender_set_active_window (MetaCompositor *compositor, } else damage = None; - + /* Build new extents */ new_focus->extents = win_extents (new_focus); - - if (damage) - XFixesUnionRegion (xdisplay, damage, damage, new_focus->extents); + + if (damage) + XFixesUnionRegion (xdisplay, damage, damage, new_focus->extents); else { damage = XFixesCreateRegion (xdisplay, NULL, 0); XFixesCopyRegion (xdisplay, damage, new_focus->extents); } - + dump_xserver_region ("resize_win", display, damage); add_damage (screen, damage); diff --git a/src/compositor/compositor-xrender.h b/src/compositor/compositor-xrender.h index afb37074..92e963f8 100644 --- a/src/compositor/compositor-xrender.h +++ b/src/compositor/compositor-xrender.h @@ -1,10 +1,10 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2007 Iain Holmes * Based on xcompmgr - (c) 2003 Keith Packard * xfwm4 - (c) 2005-2007 Olivier Fourdan - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 70e00d12..374b54e3 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -112,7 +112,7 @@ meta_compositor_get_window_pixmap (MetaCompositor *compositor, #ifdef HAVE_COMPOSITE_EXTENSIONS if (compositor && compositor->get_window_pixmap) return compositor->get_window_pixmap (compositor, window); - else + else return None; #else return None; @@ -125,7 +125,7 @@ meta_compositor_set_active_window (MetaCompositor *compositor, MetaWindow *window) { #ifdef HAVE_COMPOSITE_EXTENSIONS - if (compositor && compositor->set_active_window) + if (compositor && compositor->set_active_window) compositor->set_active_window (compositor, screen, window); #endif } @@ -134,14 +134,14 @@ meta_compositor_set_active_window (MetaCompositor *compositor, void meta_compositor_begin_move (MetaCompositor *compositor, MetaWindow *window, MetaRectangle *initial, - int grab_x, + int grab_x, int grab_y) { } void meta_compositor_update_move (MetaCompositor *compositor, MetaWindow *window, - int x, + int x, int y) { } diff --git a/src/core/async-getprop.c b/src/core/async-getprop.c index 64855445..bdad889d 100644 --- a/src/core/async-getprop.c +++ b/src/core/async-getprop.c @@ -55,7 +55,7 @@ struct _ListNode struct _AgGetPropertyTask { ListNode node; - + AgPerDisplayData *dd; Window window; Atom property; @@ -77,7 +77,7 @@ struct _AgPerDisplayData { ListNode node; _XAsyncHandler async; - + Display *display; ListNode *pending_tasks; ListNode *pending_tasks_tail; @@ -96,7 +96,7 @@ append_to_list (ListNode **head, ListNode *task) { task->next = NULL; - + if (*tail == NULL) { assert (*head == NULL); @@ -131,10 +131,10 @@ remove_from_list (ListNode **head, if (node == *tail) *tail = prev; - + break; } - + prev = node; node = node->next; } @@ -152,7 +152,7 @@ move_to_completed (AgPerDisplayData *dd, remove_from_list (&dd->pending_tasks, &dd->pending_tasks_tail, &task->node); - + append_to_list (&dd->completed_tasks, &dd->completed_tasks_tail, &task->node); @@ -187,18 +187,18 @@ find_pending_by_request_sequence (AgPerDisplayData *dd, * I'm not sure this is 100% guaranteed, if it is, * it would be a big speedup. */ - + node = dd->pending_tasks; while (node != NULL) { AgGetPropertyTask *task = (AgGetPropertyTask*) node; - + if (task->request_seq == request_seq) return task; - + node = node->next; } - + return NULL; } @@ -216,12 +216,12 @@ async_get_property_handler (Display *dpy, int bytes_read; dd = (void*) data; - + #if 0 printf ("%s: seeing request seq %ld buflen %d\n", __FUNCTION__, dpy->last_request_read, len); #endif - + task = find_pending_by_request_sequence (dd, dpy->last_request_read); if (task == NULL) @@ -231,7 +231,7 @@ async_get_property_handler (Display *dpy, task->have_reply = True; move_to_completed (dd, task); - + /* read bytes so far */ bytes_read = SIZEOF (xReply); @@ -240,7 +240,7 @@ async_get_property_handler (Display *dpy, xError errbuf; task->error = rep->error.errorCode; - + #ifdef DEBUG_SPEW printf ("%s: error code = %d (ignoring error, eating %d bytes, generic.length = %ld)\n", __FUNCTION__, task->error, (SIZEOF (xError) - bytes_read), @@ -263,7 +263,7 @@ async_get_property_handler (Display *dpy, _XGetAsyncReply (dpy, (char *)&errbuf, rep, buf, len, (SIZEOF (xError) - bytes_read) >> 2, /* in 32-bit words */ False); /* really seems like it should be True */ - + return True; } @@ -368,7 +368,7 @@ async_get_property_handler (Display *dpy, char *netdata; char *lptr; char *end_lptr; - + /* Store the 32-bit values in the end of the array */ netdata = task->data + nbytes / 2; @@ -377,7 +377,7 @@ async_get_property_handler (Display *dpy, netbytes); /* Now move the 32-bit values to the front */ - + lptr = task->data; end_lptr = task->data + nbytes; while (lptr != end_lptr) @@ -411,7 +411,7 @@ async_get_property_handler (Display *dpy, #if 0 xError error; #endif - + task->error = BadImplementation; #if 0 @@ -468,21 +468,21 @@ get_display_data (Display *display, { ListNode *node; AgPerDisplayData *dd; - + node = display_datas; while (node != NULL) { dd = (AgPerDisplayData*) node; - + if (dd->display == display) return dd; - + node = node->next; } if (!create) return NULL; - + dd = Xcalloc (1, sizeof (AgPerDisplayData)); if (dd == NULL) return NULL; @@ -496,7 +496,7 @@ get_display_data (Display *display, append_to_list (&display_datas, &display_datas_tail, &dd->node); - + return dd; } @@ -524,8 +524,8 @@ ag_task_create (Display *dpy, { AgGetPropertyTask *task; xGetPropertyReq *req; - AgPerDisplayData *dd; - + AgPerDisplayData *dd; + /* Fire up our request */ LockDisplay (dpy); @@ -535,7 +535,7 @@ ag_task_create (Display *dpy, UnlockDisplay (dpy); return NULL; } - + GetReq (GetProperty, req); req->window = window; req->property = property; @@ -561,7 +561,7 @@ ag_task_create (Display *dpy, &dd->pending_tasks_tail, &task->node); dd->n_tasks_pending += 1; - + UnlockDisplay (dpy); SyncHandle (); @@ -593,13 +593,13 @@ ag_task_get_reply_and_free (AgGetPropertyTask *task, *prop = NULL; dpy = task->dd->display; /* Xlib macros require a variable named "dpy" */ - + if (task->error != Success) { Status s = task->error; free_task (task); - + return s; } @@ -620,7 +620,7 @@ ag_task_get_reply_and_free (AgGetPropertyTask *task, SyncHandle (); free_task (task); - + return Success; } @@ -657,7 +657,7 @@ ag_get_next_completed_task (Display *display) if (dd == NULL) return NULL; - + #ifdef DEBUG_SPEW printf ("%d pending %d completed\n", dd->n_tasks_pending, diff --git a/src/core/async-getprop.h b/src/core/async-getprop.h index c857e930..b975d0f0 100644 --- a/src/core/async-getprop.h +++ b/src/core/async-getprop.h @@ -4,16 +4,16 @@ /* * Copyright (C) 2002 Havoc Pennington - * + * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation. - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND diff --git a/src/core/atomnames.h b/src/core/atomnames.h index 8f6cd3ab..43293f0c 100644 --- a/src/core/atomnames.h +++ b/src/core/atomnames.h @@ -1,12 +1,12 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002, 2003, 2004 Red Hat, Inc. * Copyright (C) 2003, 2004 Rob Adams * Copyright (C) 2004-2006 Elijah Newren * Copyright (C) 2008 Thomas Thurman - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -52,7 +52,7 @@ item(WM_WINDOW_ROLE) item(UTF8_STRING) item(WM_ICON_SIZE) item(_KWM_WIN_ICON) -item(_METACITY_RESTART_MESSAGE) +item(_METACITY_RESTART_MESSAGE) item(_METACITY_RELOAD_THEME_MESSAGE) item(_METACITY_SET_KEYBINDINGS_MESSAGE) item(_METACITY_SET_MOUSEMODS_MESSAGE) diff --git a/src/core/bell.c b/src/core/bell.c index c1f3b778..3fa02949 100644 --- a/src/core/bell.c +++ b/src/core/bell.c @@ -2,10 +2,10 @@ /* Metacity visual bell */ -/* +/* * Copyright (C) 2002 Sun Microsystems Inc. * Copyright (C) 2005, 2006 Elijah Newren - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -74,13 +74,13 @@ * \bug This appears to destroy our current XSync status. */ static void -bell_flash_screen (MetaDisplay *display, +bell_flash_screen (MetaDisplay *display, MetaScreen *screen) { Window root = screen->xroot; int width = screen->rect.width; int height = screen->rect.height; - + if (screen->flash_window == None) { Visual *visual = (Visual *)CopyFromParent; @@ -88,11 +88,11 @@ bell_flash_screen (MetaDisplay *display, int depth = CopyFromParent; xswa.save_under = True; xswa.override_redirect = True; - /* + /* * TODO: use XGetVisualInfo and determine which is an * overlay, if one is present, and use the Overlay visual - * for this window (for performance reasons). - * Not sure how to tell this yet... + * for this window (for performance reasons). + * Not sure how to tell this yet... */ screen->flash_window = XCreateWindow (display->xdisplay, root, 0, 0, width, height, @@ -114,12 +114,12 @@ bell_flash_screen (MetaDisplay *display, GC gc = XCreateGC (display->xdisplay, screen->flash_window, 0, NULL); XMapWindow (display->xdisplay, screen->flash_window); XSetForeground (display->xdisplay, gc, - WhitePixel (display->xdisplay, + WhitePixel (display->xdisplay, XScreenNumberOfScreen (screen->xscreen))); XFillRectangle (display->xdisplay, screen->flash_window, gc, 0, 0, width, height); XSetForeground (display->xdisplay, gc, - BlackPixel (display->xdisplay, + BlackPixel (display->xdisplay, XScreenNumberOfScreen (screen->xscreen))); XFillRectangle (display->xdisplay, screen->flash_window, gc, 0, 0, width, height); @@ -147,7 +147,7 @@ bell_flash_screen (MetaDisplay *display, */ #ifdef HAVE_XKB static void -bell_flash_fullscreen (MetaDisplay *display, +bell_flash_fullscreen (MetaDisplay *display, XkbAnyEvent *xkb_ev) { XkbBellNotifyEvent *xkb_bell_ev = (XkbBellNotifyEvent *) xkb_ev; @@ -160,10 +160,10 @@ bell_flash_fullscreen (MetaDisplay *display, if (screen) bell_flash_screen (display, screen); } - else + else { GSList *screen_list = display->screens; - while (screen_list) + while (screen_list) { screen = (MetaScreen *) screen_list->data; bell_flash_screen (display, screen); @@ -186,7 +186,7 @@ bell_flash_fullscreen (MetaDisplay *display, * \bug This is the parallel to bell_flash_window_frame(), so it should * really be called meta_bell_unflash_window_frame(). */ -static gboolean +static gboolean bell_unflash_frame (gpointer data) { MetaFrame *frame = (MetaFrame *) data; @@ -212,7 +212,7 @@ bell_flash_window_frame (MetaWindow *window) g_assert (window->frame != NULL); window->frame->is_flashing = 1; meta_frame_queue_draw (window->frame); - g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 100, + g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 100, bell_unflash_frame, window->frame, NULL); } @@ -224,12 +224,12 @@ bell_flash_window_frame (MetaWindow *window) * \param xkb_ev The bell event we just received */ static void -bell_flash_frame (MetaDisplay *display, +bell_flash_frame (MetaDisplay *display, XkbAnyEvent *xkb_ev) { XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent *) xkb_ev; MetaWindow *window; - + g_assert (xkb_ev->xkb_type == XkbBellNotify); window = meta_display_lookup_x_window (display, xkb_bell_event->window); if (!window && (display->focus_window)) @@ -258,10 +258,10 @@ bell_flash_frame (MetaDisplay *display, * \bug This should be merged with meta_bell_notify(). */ static void -bell_visual_notify (MetaDisplay *display, +bell_visual_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev) { - switch (meta_prefs_get_visual_bell_type ()) + switch (meta_prefs_get_visual_bell_type ()) { case G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH: bell_flash_fullscreen (display, xkb_ev); @@ -273,14 +273,14 @@ bell_visual_notify (MetaDisplay *display, } void -meta_bell_notify (MetaDisplay *display, +meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev) { /* flash something */ if (meta_prefs_get_visual_bell ()) bell_visual_notify (display, xkb_ev); - if (meta_prefs_bell_is_audible ()) + if (meta_prefs_bell_is_audible ()) { XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev; @@ -299,7 +299,7 @@ meta_bell_notify (MetaDisplay *display, window = display->focus_window; if (window) - { + { ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title); ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow); ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name); @@ -315,12 +315,12 @@ meta_bell_notify (MetaDisplay *display, #else if (1) #endif /* HAVE_CANBERRA */ - { + { /* ...and in case that failed we use the classic X11 bell. */ - XkbForceDeviceBell (display->xdisplay, - xkb_bell_event->device, - xkb_bell_event->bell_class, - xkb_bell_event->bell_id, + XkbForceDeviceBell (display->xdisplay, + xkb_bell_event->device, + xkb_bell_event->bell_class, + xkb_bell_event->bell_id, xkb_bell_event->percent); } } @@ -338,19 +338,19 @@ meta_bell_init (MetaDisplay *display) #ifdef HAVE_XKB int xkb_base_error_type, xkb_opcode; - if (!XkbQueryExtension (display->xdisplay, &xkb_opcode, - &display->xkb_base_event_type, - &xkb_base_error_type, + if (!XkbQueryExtension (display->xdisplay, &xkb_opcode, + &display->xkb_base_event_type, + &xkb_base_error_type, NULL, NULL)) { display->xkb_base_event_type = -1; g_message ("could not find XKB extension."); return FALSE; } - else + else { unsigned int mask = XkbBellNotifyMask; - gboolean visual_bell_auto_reset = FALSE; + gboolean visual_bell_auto_reset = FALSE; /* TRUE if and when non-broken version is available */ XkbSelectEvents (display->xdisplay, XkbUseCoreKbd, @@ -395,6 +395,6 @@ meta_bell_shutdown (MetaDisplay *display) void meta_bell_notify_frame_destroy (MetaFrame *frame) { - if (frame->is_flashing) + if (frame->is_flashing) g_source_remove_by_funcs_user_data (&g_timeout_funcs, frame); } diff --git a/src/core/bell.h b/src/core/bell.h index c9b8d71e..19ec8326 100644 --- a/src/core/bell.h +++ b/src/core/bell.h @@ -12,9 +12,9 @@ * <http://bugzilla.gnome.org/show_bug.cgi?id=99886>. */ -/* +/* * Copyright (C) 2002 Sun Microsystems Inc. - * + * * 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; either version 2 of the @@ -24,7 +24,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/boxes.c b/src/core/boxes.c index 55fd7b3d..8c569aae 100644 --- a/src/core/boxes.c +++ b/src/core/boxes.c @@ -2,14 +2,14 @@ /* Simple box operations */ -/* +/* * Copyright (C) 2005, 2006 Elijah Newren * [meta_rectangle_intersect() is copyright the GTK+ Team according to Havoc, * see gdkrectangle.c. As far as Havoc knows, he probably wrote * meta_rectangle_equal(), and I'm guessing it's (C) Red Hat. So...] * Copyright (C) 1995-2000 GTK+ Team * Copyright (C) 2002 Red Hat, Inc. - * + * * 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; either version 2 of the @@ -19,7 +19,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -36,7 +36,7 @@ meta_rectangle_to_string (const MetaRectangle *rect, * Should be more than enough space. Note that of this space, the * trailing \0 will be overwritten for all but the last rectangle. */ - g_snprintf (output, RECT_LENGTH, "%d,%d +%d,%d", + g_snprintf (output, RECT_LENGTH, "%d,%d +%d,%d", rect->x, rect->y, rect->width, rect->height); return output; @@ -63,7 +63,7 @@ meta_rectangle_region_to_string (GList *region, while (tmp) { MetaRectangle *rect = tmp->data; - g_snprintf (rect_string, RECT_LENGTH, "[%d,%d +%d,%d]", + g_snprintf (rect_string, RECT_LENGTH, "[%d,%d +%d,%d]", rect->x, rect->y, rect->width, rect->height); cur = g_stpcpy (cur, rect_string); tmp = tmp->next; @@ -85,7 +85,7 @@ meta_rectangle_edge_to_string (const MetaEdge *edge, * Plus 2 for parenthesis, 4 for 2 more numbers, 2 more commas, and * 2 more spaces, for a total of 10 more. */ - g_snprintf (output, EDGE_LENGTH, "[%d,%d +%d,%d], %2d, %2d", + g_snprintf (output, EDGE_LENGTH, "[%d,%d +%d,%d], %2d, %2d", edge->rect.x, edge->rect.y, edge->rect.width, edge->rect.height, edge->side_type, edge->edge_type); @@ -117,7 +117,7 @@ meta_rectangle_edge_list_to_string (GList *edge_list, { MetaEdge *edge = tmp->data; MetaRectangle *rect = &edge->rect; - g_snprintf (rect_string, EDGE_LENGTH, "([%d,%d +%d,%d], %2d, %2d)", + g_snprintf (rect_string, EDGE_LENGTH, "([%d,%d +%d,%d], %2d, %2d)", rect->x, rect->y, rect->width, rect->height, edge->side_type, edge->edge_type); cur = g_stpcpy (cur, rect_string); @@ -167,7 +167,7 @@ meta_rectangle_intersect (const MetaRectangle *src1, dest_y = MAX (src1->y, src2->y); dest_w = MIN (src1->x + src1->width, src2->x + src2->width) - dest_x; dest_h = MIN (src1->y + src1->height, src2->y + src2->height) - dest_y; - + if (dest_w > 0 && dest_h > 0) { dest->x = dest_x; @@ -270,7 +270,7 @@ gboolean meta_rectangle_contains_rect (const MetaRectangle *outer_rect, const MetaRectangle *inner_rect) { - return + return inner_rect->x >= outer_rect->x && inner_rect->y >= outer_rect->y && inner_rect->x + inner_rect->width <= outer_rect->x + outer_rect->width && @@ -289,7 +289,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect, * boxes.h has a good comment, but I'm not sure if the below info is also * helpful on top of that (or whether it has superfluous info). */ - + /* These formulas may look overly simplistic at first but you can work * everything out with a left_frame_with, right_frame_width, * border_width, and old and new client area widths (instead of old total @@ -339,7 +339,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect, break; } rect->width = new_width; - + /* Next, the y direction */ switch (gravity) { @@ -578,7 +578,7 @@ meta_rectangle_get_minimal_spanning_set_for_region ( strut_iter = all_struts; for (strut_iter = all_struts; strut_iter; strut_iter = strut_iter->next) { - GList *rect_iter; + GList *rect_iter; MetaRectangle *strut_rect = &((MetaStrut*)strut_iter->data)->rect; tmp_list = ret; @@ -705,7 +705,7 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect, */ g_assert ((direction == META_DIRECTION_HORIZONTAL) ^ (direction == META_DIRECTION_VERTICAL )); - + if (direction == META_DIRECTION_HORIZONTAL) { rect->x = expand_to->x; @@ -717,12 +717,12 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect, rect->height = expand_to->height; } - + /* Run over all struts */ for (strut_iter = all_struts; strut_iter; strut_iter = strut_iter->next) { MetaStrut *strut = (MetaStrut*) strut_iter->data; - + /* Skip struts that don't overlap */ if (!meta_rectangle_overlap (&strut->rect, rect)) continue; @@ -763,7 +763,7 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect, void meta_rectangle_free_list_and_elements (GList *filled_list) { - g_list_foreach (filled_list, + g_list_foreach (filled_list, (void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */ NULL); g_list_free (filled_list); @@ -841,20 +841,20 @@ meta_rectangle_clamp_to_fit_into_region (const GList *spanning_rects, { MetaRectangle *compare_rect = temp->data; int maximal_overlap_amount_for_compare; - + /* If x is fixed and the entire width of rect doesn't fit in compare, * skip this rectangle. */ if ((fixed_directions & FIXED_DIRECTION_X) && - (compare_rect->x > rect->x || + (compare_rect->x > rect->x || compare_rect->x + compare_rect->width < rect->x + rect->width)) continue; - + /* If y is fixed and the entire height of rect doesn't fit in compare, * skip this rectangle. */ if ((fixed_directions & FIXED_DIRECTION_Y) && - (compare_rect->y > rect->y || + (compare_rect->y > rect->y || compare_rect->y + compare_rect->height < rect->y + rect->height)) continue; @@ -914,20 +914,20 @@ meta_rectangle_clip_to_region (const GList *spanning_rects, MetaRectangle *compare_rect = temp->data; MetaRectangle overlap; int maximal_overlap_amount_for_compare; - + /* If x is fixed and the entire width of rect doesn't fit in compare, * skip the rectangle. */ if ((fixed_directions & FIXED_DIRECTION_X) && - (compare_rect->x > rect->x || + (compare_rect->x > rect->x || compare_rect->x + compare_rect->width < rect->x + rect->width)) continue; - + /* If y is fixed and the entire height of rect doesn't fit in compare, * skip the rectangle. */ if ((fixed_directions & FIXED_DIRECTION_Y) && - (compare_rect->y > rect->y || + (compare_rect->y > rect->y || compare_rect->y + compare_rect->height < rect->y + rect->height)) continue; @@ -988,26 +988,26 @@ meta_rectangle_shove_into_region (const GList *spanning_rects, /* First, find best rectangle from spanning_rects to which we will shove * rect into. */ - + for (temp = spanning_rects; temp; temp = temp->next) { MetaRectangle *compare_rect = temp->data; int maximal_overlap_amount_for_compare; int dist_to_compare; - + /* If x is fixed and the entire width of rect doesn't fit in compare, * skip this rectangle. */ if ((fixed_directions & FIXED_DIRECTION_X) && - (compare_rect->x > rect->x || + (compare_rect->x > rect->x || compare_rect->x + compare_rect->width < rect->x + rect->width)) continue; - + /* If y is fixed and the entire height of rect doesn't fit in compare, * skip this rectangle. */ if ((fixed_directions & FIXED_DIRECTION_Y) && - (compare_rect->y > rect->y || + (compare_rect->y > rect->y || compare_rect->y + compare_rect->height < rect->y + rect->height)) continue; @@ -1163,7 +1163,7 @@ meta_rectangle_edge_aligns (const MetaRectangle *rect, const MetaEdge *edge) } static GList* -get_rect_minus_overlap (const GList *rect_in_list, +get_rect_minus_overlap (const GList *rect_in_list, MetaRectangle *overlap) { MetaRectangle *temp; @@ -1208,7 +1208,7 @@ get_rect_minus_overlap (const GList *rect_in_list, } static GList* -replace_rect_with_list (GList *old_element, +replace_rect_with_list (GList *old_element, GList *new_list) { GList *ret; @@ -1420,7 +1420,7 @@ rectangle_and_edge_intersection (const MetaRectangle *rect, overlap->edge_type = -1; overlap->side_type = -1; - /* Figure out what the intersection is */ + /* Figure out what the intersection is */ result->x = MAX (rect->x, rect2->x); result->y = MAX (rect->y, rect2->y); result->width = MIN (BOX_RIGHT (*rect), BOX_RIGHT (*rect2)) - result->x; @@ -1491,7 +1491,7 @@ rectangle_and_edge_intersection (const MetaRectangle *rect, * TOP<->BOTTOM). */ static GList* -add_edges (GList *cur_edges, +add_edges (GList *cur_edges, const MetaRectangle *rect, gboolean rect_is_internal) { @@ -1505,23 +1505,23 @@ add_edges (GList *cur_edges, switch (i) { case 0: - temp_edge->side_type = + temp_edge->side_type = rect_is_internal ? META_SIDE_LEFT : META_SIDE_RIGHT; temp_edge->rect.width = 0; break; case 1: - temp_edge->side_type = + temp_edge->side_type = rect_is_internal ? META_SIDE_RIGHT : META_SIDE_LEFT; temp_edge->rect.x += temp_edge->rect.width; temp_edge->rect.width = 0; break; case 2: - temp_edge->side_type = + temp_edge->side_type = rect_is_internal ? META_SIDE_TOP : META_SIDE_BOTTOM; temp_edge->rect.height = 0; break; case 3: - temp_edge->side_type = + temp_edge->side_type = rect_is_internal ? META_SIDE_BOTTOM : META_SIDE_TOP; temp_edge->rect.y += temp_edge->rect.height; temp_edge->rect.height = 0; @@ -1538,8 +1538,8 @@ add_edges (GList *cur_edges, * edges to cur_list. Return cur_list when finished. */ static GList* -split_edge (GList *cur_list, - const MetaEdge *old_edge, +split_edge (GList *cur_list, + const MetaEdge *old_edge, const MetaEdge *remove) { MetaEdge *temp_edge; @@ -1598,7 +1598,7 @@ split_edge (GList *cur_list, * if and how rect and edge intersect. */ static void -fix_up_edges (MetaRectangle *rect, MetaEdge *edge, +fix_up_edges (MetaRectangle *rect, MetaEdge *edge, GList **strut_edges, GList **edge_splits, gboolean *edge_needs_removal) { @@ -1715,7 +1715,7 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect, { GList *ret; GList *fixed_strut_rects; - GList *edge_iter; + GList *edge_iter; const GList *strut_rect_iter; /* The algorithm is basically as follows: @@ -1755,7 +1755,7 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect, GList *splits_of_cur_edge = NULL; gboolean edge_needs_removal = FALSE; - fix_up_edges (strut_rect, cur_edge, + fix_up_edges (strut_rect, cur_edge, &new_strut_edges, &splits_of_cur_edge, &edge_needs_removal); @@ -1858,7 +1858,7 @@ meta_rectangle_find_nonintersected_xinerama_edges ( for (; all_struts; all_struts = all_struts->next) temp_rects = g_slist_prepend (temp_rects, &((MetaStrut*)all_struts->data)->rect); - ret = meta_rectangle_remove_intersections_with_boxes_from_edges (ret, + ret = meta_rectangle_remove_intersections_with_boxes_from_edges (ret, temp_rects); g_slist_free (temp_rects); diff --git a/src/core/common.c b/src/core/common.c index c7fe1012..e1f27eb0 100644 --- a/src/core/common.c +++ b/src/core/common.c @@ -2,11 +2,11 @@ /* Metacity X window decorations */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2003, 2004 Red Hat, Inc. * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/constraints.c b/src/core/constraints.c index 22705a37..0dc93cb0 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -41,7 +41,7 @@ // "constrain_whatever". // 3) Add your function to the all_constraints and all_constraint_names // arrays (the latter of which is for debugging purposes) - // + // // An example constraint function, constrain_whatever: // // /* constrain_whatever does the following: @@ -252,7 +252,7 @@ do_all_constraints (MetaWindow *window, /* Log how the constraint modified the position */ meta_topic (META_DEBUG_GEOMETRY, "info->current is %d,%d +%d,%d after %s\n", - info->current.x, info->current.y, + info->current.x, info->current.y, info->current.width, info->current.height, constraint->name); } @@ -294,8 +294,8 @@ meta_window_constrain (MetaWindow *window, new->x, new->y, new->width, new->height); setup_constraint_info (&info, - window, - orig_borders, + window, + orig_borders, flags, resize_gravity, orig, @@ -308,7 +308,7 @@ meta_window_constrain (MetaWindow *window, /* Individually enforce all the high-enough priority constraints */ do_all_constraints (window, &info, priority, !check_only); - /* Check if all high-enough priority constraints are simultaneously + /* Check if all high-enough priority constraints are simultaneously * satisfied */ satisfied = do_all_constraints (window, &info, priority, check_only); @@ -425,10 +425,10 @@ setup_constraint_info (ConstraintInfo *info, } cur_workspace = window->screen->active_workspace; - info->usable_screen_region = + info->usable_screen_region = meta_workspace_get_onscreen_region (cur_workspace); - info->usable_xinerama_region = - meta_workspace_get_onxinerama_region (cur_workspace, + info->usable_xinerama_region = + meta_workspace_get_onxinerama_region (cur_workspace, xinerama_info->number); /* Workaround braindead legacy apps that don't know how to @@ -465,7 +465,7 @@ setup_constraint_info (ConstraintInfo *info, " work_area_xinerama: %d,%d +%d,%d\n" " entire_xinerama : %d,%d +%d,%d\n", info->orig.x, info->orig.y, info->orig.width, info->orig.height, - info->current.x, info->current.y, + info->current.x, info->current.y, info->current.width, info->current.height, (info->action_type == ACTION_MOVE) ? "Move" : (info->action_type == ACTION_RESIZE) ? "Resize" : @@ -478,7 +478,7 @@ setup_constraint_info (ConstraintInfo *info, (info->fixed_directions == FIXED_DIRECTION_Y) ? "Y fixed" : "Freakin' Invalid Stupid", info->work_area_xinerama.x, info->work_area_xinerama.y, - info->work_area_xinerama.width, + info->work_area_xinerama.width, info->work_area_xinerama.height, info->entire_xinerama.x, info->entire_xinerama.y, info->entire_xinerama.width, info->entire_xinerama.height); @@ -521,8 +521,8 @@ place_window_if_needed(MetaWindow *window, xinerama_info->number, &info->work_area_xinerama); cur_workspace = window->screen->active_workspace; - info->usable_xinerama_region = - meta_workspace_get_onxinerama_region (cur_workspace, + info->usable_xinerama_region = + meta_workspace_get_onxinerama_region (cur_workspace, xinerama_info->number); @@ -559,7 +559,7 @@ place_window_if_needed(MetaWindow *window, if (window->maximize_horizontally_after_placement || window->maximize_vertically_after_placement) - meta_window_maximize_internal (window, + meta_window_maximize_internal (window, (window->maximize_horizontally_after_placement ? META_MAXIMIZE_HORIZONTAL : 0 ) | (window->maximize_vertically_after_placement ? @@ -650,7 +650,7 @@ update_onscreen_requirements (MetaWindow *window, if (old ^ window->require_on_single_xinerama) meta_topic (META_DEBUG_GEOMETRY, "require_on_single_xinerama for %s toggled to %s\n", - window->desc, + window->desc, window->require_on_single_xinerama ? "TRUE" : "FALSE"); /* Update whether we want future constraint runs to require the @@ -966,7 +966,7 @@ constrain_size_increments (MetaWindow *window, return TRUE; /* Determine whether constraint applies; exit if it doesn't */ - if (META_WINDOW_MAXIMIZED (window) || window->fullscreen || + if (META_WINDOW_MAXIMIZED (window) || window->fullscreen || META_WINDOW_TILED_SIDE_BY_SIDE (window) || info->action_type == ACTION_MOVE) return TRUE; @@ -984,7 +984,7 @@ constrain_size_increments (MetaWindow *window, if (window->maximized_vertically) extra_height *= 0; /* constraint is satisfied iff there is no extra height or width */ - constraint_already_satisfied = + constraint_already_satisfied = (extra_height == 0 && extra_width == 0); if (check_only || constraint_already_satisfied) @@ -1010,10 +1010,10 @@ constrain_size_increments (MetaWindow *window, start_rect = &info->current; else start_rect = &info->orig; - + /* Resize to the new size */ meta_rectangle_resize_with_gravity (start_rect, - &info->current, + &info->current, info->resize_gravity, new_width, new_height); @@ -1058,7 +1058,7 @@ constrain_size_limits (MetaWindow *window, /*** Enforce constraint ***/ new_width = CLAMP (info->current.width, min_size.width, max_size.width); new_height = CLAMP (info->current.height, min_size.height, max_size.height); - + /* Figure out what original rect to pass to meta_rectangle_resize_with_gravity * See bug 448183 */ @@ -1066,9 +1066,9 @@ constrain_size_limits (MetaWindow *window, start_rect = &info->current; else start_rect = &info->orig; - + meta_rectangle_resize_with_gravity (start_rect, - &info->current, + &info->current, info->resize_gravity, new_width, new_height); @@ -1098,7 +1098,7 @@ constrain_aspect_ratio (MetaWindow *window, (double)window->size_hints.max_aspect.y; constraints_are_inconsistent = minr > maxr; if (constraints_are_inconsistent || - META_WINDOW_MAXIMIZED (window) || window->fullscreen || + META_WINDOW_MAXIMIZED (window) || window->fullscreen || META_WINDOW_TILED_SIDE_BY_SIDE (window) || info->action_type == ACTION_MOVE) return TRUE; @@ -1138,7 +1138,7 @@ constrain_aspect_ratio (MetaWindow *window, fudge = 1; break; } - constraint_already_satisfied = + constraint_already_satisfied = info->current.width - (info->current.height * minr ) > -minr*fudge && info->current.width - (info->current.height * maxr ) < maxr*fudge; if (check_only || constraint_already_satisfied) @@ -1202,7 +1202,7 @@ constrain_aspect_ratio (MetaWindow *window, start_rect = &info->orig; meta_rectangle_resize_with_gravity (start_rect, - &info->current, + &info->current, info->resize_gravity, new_width, new_height); @@ -1251,7 +1251,7 @@ do_screen_and_xinerama_relative_constraints ( exit_early = TRUE; /* Determine whether constraint is already satisfied; exit if it is */ - constraint_satisfied = + constraint_satisfied = meta_rectangle_contained_in_region (region_spanning_rectangles, &info->current); if (exit_early || constraint_satisfied || check_only) @@ -1294,7 +1294,7 @@ constrain_to_single_xinerama (MetaWindow *window, return TRUE; /* Exit early if we know the constraint won't apply--note that this constraint - * is only meant for normal windows (e.g. we don't want docks to be shoved + * is only meant for normal windows (e.g. we don't want docks to be shoved * "onscreen" by their own strut) and we can't apply it to frameless windows * or else users will be unable to move windows such as XMMS across xineramas. */ @@ -1307,7 +1307,7 @@ constrain_to_single_xinerama (MetaWindow *window, return TRUE; /* Have a helper function handle the constraint for us */ - return do_screen_and_xinerama_relative_constraints (window, + return do_screen_and_xinerama_relative_constraints (window, info->usable_xinerama_region, info, check_only); @@ -1323,18 +1323,18 @@ constrain_fully_onscreen (MetaWindow *window, return TRUE; /* Exit early if we know the constraint won't apply--note that this constraint - * is only meant for normal windows (e.g. we don't want docks to be shoved + * is only meant for normal windows (e.g. we don't want docks to be shoved * "onscreen" by their own strut). */ if (window->type == META_WINDOW_DESKTOP || window->type == META_WINDOW_DOCK || window->fullscreen || - !window->require_fully_onscreen || + !window->require_fully_onscreen || info->is_user_action) return TRUE; /* Have a helper function handle the constraint for us */ - return do_screen_and_xinerama_relative_constraints (window, + return do_screen_and_xinerama_relative_constraints (window, info->usable_screen_region, info, check_only); @@ -1362,7 +1362,7 @@ constrain_titlebar_visible (MetaWindow *window, info->is_user_action && !window->display->grab_frame_action; /* Exit early if we know the constraint won't apply--note that this constraint - * is only meant for normal windows (e.g. we don't want docks to be shoved + * is only meant for normal windows (e.g. we don't want docks to be shoved * "onscreen" by their own strut). */ if (window->type == META_WINDOW_DESKTOP || @@ -1404,13 +1404,13 @@ constrain_titlebar_visible (MetaWindow *window, */ meta_rectangle_expand_region_conditionally (info->usable_screen_region, horiz_amount_offscreen, - horiz_amount_offscreen, + horiz_amount_offscreen, 0, /* Don't let titlebar off */ bottom_amount, horiz_amount_onscreen, vert_amount_onscreen); retval = - do_screen_and_xinerama_relative_constraints (window, + do_screen_and_xinerama_relative_constraints (window, info->usable_screen_region, info, check_only); @@ -1440,7 +1440,7 @@ constrain_partially_onscreen (MetaWindow *window, return TRUE; /* Exit early if we know the constraint won't apply--note that this constraint - * is only meant for normal windows (e.g. we don't want docks to be shoved + * is only meant for normal windows (e.g. we don't want docks to be shoved * "onscreen" by their own strut). */ if (window->type == META_WINDOW_DESKTOP || @@ -1479,13 +1479,13 @@ constrain_partially_onscreen (MetaWindow *window, */ meta_rectangle_expand_region_conditionally (info->usable_screen_region, horiz_amount_offscreen, - horiz_amount_offscreen, + horiz_amount_offscreen, top_amount, bottom_amount, horiz_amount_onscreen, vert_amount_onscreen); retval = - do_screen_and_xinerama_relative_constraints (window, + do_screen_and_xinerama_relative_constraints (window, info->usable_screen_region, info, check_only); diff --git a/src/core/constraints.h b/src/core/constraints.h index 1a03868f..80f189b7 100644 --- a/src/core/constraints.h +++ b/src/core/constraints.h @@ -2,10 +2,10 @@ /* Metacity size/position constraints */ -/* +/* * Copyright (C) 2002 Red Hat, Inc. * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/core.c b/src/core/core.c index cf95259a..6b62ec40 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -2,11 +2,11 @@ /* Metacity interface used by GTK+ UI to talk to core */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2003 Rob Adams * Copyright (C) 2004-2006 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -45,7 +45,7 @@ get_window (Display *xdisplay, { MetaDisplay *display; MetaWindow *window; - + display = meta_display_for_x_display (xdisplay); window = meta_display_lookup_x_window (display, frame_xwindow); @@ -91,14 +91,14 @@ meta_core_get (Display *xdisplay, } while (request != META_CORE_GET_END) { - + gpointer answer = va_arg (args, gpointer); switch (request) { case META_CORE_WINDOW_HAS_FRAME: *((gboolean*)answer) = window != NULL && window->frame != NULL; if (!*((gboolean*)answer)) goto out; /* see above */ - break; + break; case META_CORE_GET_CLIENT_WIDTH: *((gint*)answer) = window->rect.width; break; @@ -113,7 +113,7 @@ meta_core_get (Display *xdisplay, break; case META_CORE_GET_FRAME_FLAGS: *((MetaFrameFlags*)answer) = meta_frame_get_flags (window->frame); - break; + break; case META_CORE_GET_FRAME_TYPE: { MetaFrameType base_type = META_FRAME_TYPE_LAST; @@ -157,19 +157,19 @@ meta_core_get (Display *xdisplay, if (base_type == META_FRAME_TYPE_LAST) { /* can't add border if undecorated */ - *((MetaFrameType*)answer) = META_FRAME_TYPE_LAST; + *((MetaFrameType*)answer) = META_FRAME_TYPE_LAST; } else if (window->border_only && base_type != META_FRAME_TYPE_ATTACHED) { /* override base frame type */ - *((MetaFrameType*)answer) = META_FRAME_TYPE_BORDER; + *((MetaFrameType*)answer) = META_FRAME_TYPE_BORDER; } else { *((MetaFrameType*)answer) = base_type; } - break; + break; } case META_CORE_GET_MINI_ICON: *((GdkPixbuf**)answer) = window->mini_icon; @@ -210,7 +210,7 @@ meta_core_get (Display *xdisplay, } request = va_arg (args, MetaCoreGetType); - } + } out: va_end (args); @@ -253,7 +253,7 @@ meta_core_user_raise (Display *xdisplay, Window frame_xwindow) { MetaWindow *window = get_window (xdisplay, frame_xwindow); - + meta_window_raise (window); } @@ -263,7 +263,7 @@ meta_core_user_lower_and_unfocus (Display *xdisplay, guint32 timestamp) { MetaWindow *window = get_window (xdisplay, frame_xwindow); - + meta_window_lower (window); if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK && @@ -274,21 +274,21 @@ meta_core_user_lower_and_unfocus (Display *xdisplay, * (Borrowed from window.c.) */ if (window->screen->active_workspace && - meta_window_located_on_workspace (window, + meta_window_located_on_workspace (window, window->screen->active_workspace)) { GList* link; - link = g_list_find (window->screen->active_workspace->mru_list, + link = g_list_find (window->screen->active_workspace->mru_list, window); g_assert (link); - window->screen->active_workspace->mru_list = + window->screen->active_workspace->mru_list = g_list_remove_link (window->screen->active_workspace->mru_list, link); g_list_free (link); - window->screen->active_workspace->mru_list = - g_list_append (window->screen->active_workspace->mru_list, + window->screen->active_workspace->mru_list = + g_list_append (window->screen->active_workspace->mru_list, window); } } @@ -335,7 +335,7 @@ meta_core_user_focus (Display *xdisplay, guint32 timestamp) { MetaWindow *window = get_window (xdisplay, frame_xwindow); - + meta_window_focus (window, timestamp); } @@ -357,7 +357,7 @@ meta_core_maximize (Display *xdisplay, if (meta_prefs_get_raise_on_click ()) meta_window_raise (window); - meta_window_maximize (window, + meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL); } @@ -371,7 +371,7 @@ meta_core_toggle_maximize_vertically (Display *xdisplay, meta_window_raise (window); if (META_WINDOW_MAXIMIZED_VERTICALLY (window)) - meta_window_unmaximize (window, + meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL); else meta_window_maximize (window, @@ -388,7 +388,7 @@ meta_core_toggle_maximize_horizontally (Display *xdisplay, meta_window_raise (window); if (META_WINDOW_MAXIMIZED_HORIZONTALLY (window)) - meta_window_unmaximize (window, + meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL); else meta_window_maximize (window, @@ -405,7 +405,7 @@ meta_core_toggle_maximize (Display *xdisplay, meta_window_raise (window); if (META_WINDOW_MAXIMIZED (window)) - meta_window_unmaximize (window, + meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL); else meta_window_maximize (window, @@ -431,7 +431,7 @@ meta_core_delete (Display *xdisplay, guint32 timestamp) { MetaWindow *window = get_window (xdisplay, frame_xwindow); - + meta_window_delete (window, timestamp); } @@ -451,7 +451,7 @@ meta_core_shade (Display *xdisplay, guint32 timestamp) { MetaWindow *window = get_window (xdisplay, frame_xwindow); - + meta_window_shade (window, timestamp); } @@ -532,7 +532,7 @@ meta_core_show_window_menu (Display *xdisplay, guint32 timestamp) { MetaWindow *window = get_window (xdisplay, frame_xwindow); - + if (meta_prefs_get_raise_on_click ()) meta_window_raise (window); meta_window_focus (window, timestamp); @@ -549,7 +549,7 @@ meta_core_get_menu_accelerator (MetaMenuOp menu_op, const char *name; name = NULL; - + switch (menu_op) { case META_MENU_OP_NONE: @@ -590,25 +590,25 @@ meta_core_get_menu_accelerator (MetaMenuOp menu_op, break; case 3: name = "move-to-workspace-3"; - break; + break; case 4: name = "move-to-workspace-4"; - break; + break; case 5: name = "move-to-workspace-5"; - break; + break; case 6: name = "move-to-workspace-6"; - break; + break; case 7: name = "move-to-workspace-7"; - break; + break; case 8: name = "move-to-workspace-8"; - break; + break; case 9: name = "move-to-workspace-9"; - break; + break; case 10: name = "move-to-workspace-10"; break; @@ -685,12 +685,12 @@ meta_core_begin_grab_op (Display *xdisplay, MetaWindow *window = get_window (xdisplay, frame_xwindow); MetaDisplay *display; MetaScreen *screen; - + display = meta_display_for_x_display (xdisplay); screen = meta_display_screen_for_xwindow (display, frame_xwindow); g_assert (screen != NULL); - + return meta_display_begin_grab_op (display, screen, window, op, pointer_already_grabbed, frame_action, @@ -703,7 +703,7 @@ meta_core_end_grab_op (Display *xdisplay, guint32 timestamp) { MetaDisplay *display; - + display = meta_display_for_x_display (xdisplay); meta_display_end_grab_op (display, timestamp); @@ -713,7 +713,7 @@ MetaGrabOp meta_core_get_grab_op (Display *xdisplay) { MetaDisplay *display; - + display = meta_display_for_x_display (xdisplay); return display->grab_op; @@ -723,15 +723,15 @@ Window meta_core_get_grab_frame (Display *xdisplay) { MetaDisplay *display; - + display = meta_display_for_x_display (xdisplay); g_assert (display != NULL); - g_assert (display->grab_op == META_GRAB_OP_NONE || + g_assert (display->grab_op == META_GRAB_OP_NONE || display->grab_screen != NULL); g_assert (display->grab_op == META_GRAB_OP_NONE || display->grab_screen->display->xdisplay == xdisplay); - + if (display->grab_op != META_GRAB_OP_NONE && display->grab_window && display->grab_window->frame) @@ -744,12 +744,12 @@ int meta_core_get_grab_button (Display *xdisplay) { MetaDisplay *display; - + display = meta_display_for_x_display (xdisplay); if (display->grab_op == META_GRAB_OP_NONE) return -1; - + return display->grab_button; } @@ -758,7 +758,7 @@ meta_core_grab_buttons (Display *xdisplay, Window frame_xwindow) { MetaDisplay *display; - + display = meta_display_for_x_display (xdisplay); meta_verbose ("Grabbing buttons on frame 0x%lx\n", frame_xwindow); @@ -779,7 +779,7 @@ void meta_core_increment_event_serial (Display *xdisplay) { MetaDisplay *display; - + display = meta_display_for_x_display (xdisplay); meta_display_increment_event_serial (display); diff --git a/src/core/delete.c b/src/core/delete.c index f6997167..d9a60ab0 100644 --- a/src/core/delete.c +++ b/src/core/delete.c @@ -2,10 +2,10 @@ /* Metacity window deletion */ -/* +/* * Copyright (C) 2001, 2002 Havoc Pennington * Copyright (C) 2004 Elijah Newren - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -77,7 +77,7 @@ delete_ping_timeout_func (MetaDisplay *display, char *window_title; gchar *window_content, *tmp; GPid dialog_pid; - + meta_topic (META_DEBUG_PING, "Got delete ping timeout for %s\n", window->desc); @@ -144,10 +144,10 @@ meta_window_delete (MetaWindow *window, delete_ping_reply_func, delete_ping_timeout_func, window); - + if (window->has_focus) { - /* FIXME Clean this up someday + /* FIXME Clean this up someday * http://bugzilla.gnome.org/show_bug.cgi?id=108706 */ #if 0 @@ -179,7 +179,7 @@ void meta_window_kill (MetaWindow *window) { char buf[257]; - + meta_topic (META_DEBUG_WINDOW_OPS, "Killing %s brutally\n", window->desc); @@ -207,7 +207,7 @@ meta_window_kill (MetaWindow *window) strerror (errno)); } } - + meta_topic (META_DEBUG_WINDOW_OPS, "Disconnecting %s with XKillClient()\n", window->desc); @@ -232,7 +232,7 @@ meta_window_present_delete_dialog (MetaWindow *window, guint32 timestamp) meta_topic (META_DEBUG_PING, "Presenting existing ping dialog for %s\n", window->desc); - + if (window->dialog_pid >= 0) { GSList *windows; @@ -241,7 +241,7 @@ meta_window_present_delete_dialog (MetaWindow *window, guint32 timestamp) /* Activate transient for window that belongs to * metacity-dialog */ - + windows = meta_display_list_windows (window->display); tmp = windows; while (tmp != NULL) @@ -255,7 +255,7 @@ meta_window_present_delete_dialog (MetaWindow *window, guint32 timestamp) meta_window_activate (w, timestamp); break; } - + tmp = tmp->next; } diff --git a/src/core/display-private.h b/src/core/display-private.h index f98db283..a723be77 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -2,12 +2,12 @@ /* Metacity X display handler */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat, Inc. * Copyright (C) 2003 Rob Adams * Copyright (C) 2004-2006 Elijah Newren - * + * * 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; either version 2 of the @@ -17,7 +17,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -85,7 +85,7 @@ struct _MetaDisplay Window leader_window; Window timestamp_pinging_window; - + /* Pull in all the names of atoms as fields; we will intern them when the * class is constructed. */ @@ -128,7 +128,7 @@ struct _MetaDisplay guint allow_terminal_deactivation : 1; guint static_gravity_works : 1; - + /*< private-ish >*/ guint error_trap_synced_at_last_pop : 1; MetaEventQueue *events; @@ -137,7 +137,7 @@ struct _MetaDisplay GHashTable *window_ids; int error_traps; int (* error_trap_handler) (Display *display, - XErrorEvent *error); + XErrorEvent *error); int server_grab_count; /* serials of leave/unmap events that may @@ -146,7 +146,7 @@ struct _MetaDisplay */ unsigned long ignored_serials[N_IGNORED_SERIALS]; Window ungrab_should_not_cause_focus_window; - + guint32 current_time; /* Pings which we're waiting for a reply from */ @@ -158,7 +158,7 @@ struct _MetaDisplay /* Alt+click button grabs */ unsigned int window_grab_modifiers; - + /* current window operation */ MetaGrabOp grab_op; MetaScreen *grab_screen; @@ -225,7 +225,7 @@ struct _MetaDisplay unsigned int hyper_mask; unsigned int super_mask; unsigned int meta_mask; - + /* Xinerama cache */ unsigned int xinerama_cache_invalidated : 1; @@ -252,7 +252,7 @@ struct _MetaDisplay /* Managed by compositor.c */ MetaCompositor *compositor; - + #ifdef HAVE_STARTUP_NOTIFICATION SnDisplay *sn_display; #endif @@ -316,7 +316,7 @@ struct _MetaDisplay * time1 < time2 * Of course, the rest of the ugliness of this macro comes from accounting * for the fact that wraparound can occur and the fact that a timestamp of - * 0 must be special-cased since it means older than anything else. + * 0 must be special-cased since it means older than anything else. * * Note that this is NOT an equivalent for time1 <= time2; if that's what * you need then you'll need to swap the order of the arguments and negate @@ -429,7 +429,7 @@ const char* meta_event_detail_to_string (int d); void meta_display_queue_retheme_all_windows (MetaDisplay *display); void meta_display_retheme_all (void); -void meta_display_set_cursor_theme (const char *theme, +void meta_display_set_cursor_theme (const char *theme, int size); void meta_display_ping_window (MetaDisplay *display, @@ -493,7 +493,7 @@ gboolean meta_display_focus_sentinel_clear (MetaDisplay *display); * whether a window should be allowed to be focused should depend * on user_time events (see bug 167358, comment 15 in particular) */ -void meta_display_set_input_focus_window (MetaDisplay *display, +void meta_display_set_input_focus_window (MetaDisplay *display, MetaWindow *window, gboolean focus_frame, guint32 timestamp); @@ -502,7 +502,7 @@ void meta_display_set_input_focus_window (MetaDisplay *display, * designated no_focus_window should be focused, but is otherwise the * same as meta_display_set_input_focus_window */ -void meta_display_focus_the_no_focus_window (MetaDisplay *display, +void meta_display_focus_the_no_focus_window (MetaDisplay *display, MetaScreen *screen, guint32 timestamp); diff --git a/src/core/display.c b/src/core/display.c index 0f84bcf5..b8a68f99 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -2,12 +2,12 @@ /* Metacity X display handler */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002, 2003, 2004 Red Hat, Inc. * Copyright (C) 2003, 2004 Rob Adams * Copyright (C) 2004-2006 Elijah Newren - * + * * 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; either version 2 of the @@ -17,7 +17,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -108,7 +108,7 @@ * * \ingroup pings */ -typedef struct +typedef struct { MetaDisplay *display; Window xwindow; @@ -119,7 +119,7 @@ typedef struct guint ping_timeout_id; } MetaPingData; -typedef struct +typedef struct { MetaDisplay *display; Window xwindow; @@ -201,7 +201,7 @@ remove_pending_pings_for_window (MetaDisplay *display, Window xwindow) GSList *dead; /* could obviously be more efficient, don't care */ - + /* build list to be removed */ dead = NULL; for (tmp = display->pending_pings; tmp; tmp = tmp->next) @@ -270,11 +270,11 @@ enable_compositor (MetaDisplay *display, if (!display->compositor) return; - + for (list = display->screens; list != NULL; list = list->next) { MetaScreen *screen = list->data; - + meta_compositor_manage_screen (screen->display->compositor, screen); @@ -287,18 +287,18 @@ static void disable_compositor (MetaDisplay *display) { GSList *list; - + if (!display->compositor) return; - + for (list = display->screens; list != NULL; list = list->next) { MetaScreen *screen = list->data; - + meta_compositor_unmanage_screen (screen->display->compositor, screen); } - + meta_compositor_destroy (display->compositor); display->compositor = NULL; } @@ -329,11 +329,11 @@ meta_display_open (void) #undef item }; Atom atoms[G_N_ELEMENTS(atom_names)]; - + meta_verbose ("Opening display '%s'\n", XDisplayName (NULL)); xdisplay = meta_ui_get_display (); - + if (xdisplay == NULL) { meta_warning (_("Failed to open X Window System display '%s'\n"), @@ -343,12 +343,12 @@ meta_display_open (void) if (meta_is_syncing ()) XSynchronize (xdisplay, True); - + g_assert (the_display == NULL); the_display = g_new (MetaDisplay, 1); the_display->closing = 0; - + /* here we use XDisplayName which is what the user * probably put in, vs. DisplayString(display) which is * canonicalized by XOpenDisplay() @@ -375,10 +375,10 @@ meta_display_open (void) #ifdef HAVE_XSYNC the_display->grab_sync_request_alarm = None; #endif - + /* FIXME copy the checks from GDK probably */ the_display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL; - + meta_bell_init (the_display); meta_display_init_keys (the_display); @@ -391,7 +391,7 @@ meta_display_open (void) XInternAtoms (the_display->xdisplay, atom_names, G_N_ELEMENTS (atom_names), False, atoms); { - int i = 0; + int i = 0; #define item(x) the_display->atom_##x = atoms[i++]; #include "atomnames.h" #undef item @@ -401,7 +401,7 @@ meta_display_open (void) meta_display_init_window_prop_hooks (the_display); the_display->group_prop_hooks = NULL; meta_display_init_group_prop_hooks (the_display); - + /* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK, * created in screen_new */ @@ -414,26 +414,26 @@ meta_display_open (void) the_display->window_with_menu = NULL; the_display->window_menu = NULL; - + the_display->screens = NULL; the_display->active_screen = NULL; - + #ifdef HAVE_STARTUP_NOTIFICATION the_display->sn_display = sn_display_new (the_display->xdisplay, sn_error_trap_push, sn_error_trap_pop); #endif - + the_display->events = NULL; /* Get events */ meta_ui_add_event_func (the_display->xdisplay, event_callback, the_display); - + the_display->window_ids = g_hash_table_new (meta_unsigned_long_hash, meta_unsigned_long_equal); - + i = 0; while (i < N_IGNORED_SERIALS) { @@ -441,14 +441,14 @@ meta_display_open (void) ++i; } the_display->ungrab_should_not_cause_focus_window = None; - + the_display->current_time = CurrentTime; the_display->sentinel_counter = 0; the_display->grab_resize_timeout_id = 0; the_display->grab_have_keyboard = FALSE; - -#ifdef HAVE_XKB + +#ifdef HAVE_XKB the_display->last_bell_time = 0; #endif @@ -467,14 +467,14 @@ meta_display_open (void) int major, minor; the_display->have_xsync = FALSE; - + the_display->xsync_error_base = 0; the_display->xsync_event_base = 0; /* I don't think we really have to fill these in */ major = SYNC_MAJOR_VERSION; minor = SYNC_MINOR_VERSION; - + if (!XSyncQueryExtension (the_display->xdisplay, &the_display->xsync_event_base, &the_display->xsync_error_base) || @@ -486,7 +486,7 @@ meta_display_open (void) } else the_display->have_xsync = TRUE; - + meta_verbose ("Attempted to init Xsync, found version %d.%d error base %d event base %d\n", major, minor, the_display->xsync_error_base, @@ -500,10 +500,10 @@ meta_display_open (void) #ifdef HAVE_SHAPE { the_display->have_shape = FALSE; - + the_display->shape_error_base = 0; the_display->shape_event_base = 0; - + if (!XShapeQueryExtension (the_display->xdisplay, &the_display->shape_event_base, &the_display->shape_error_base)) @@ -513,7 +513,7 @@ meta_display_open (void) } else the_display->have_shape = TRUE; - + meta_verbose ("Attempted to init Shape, found error base %d event base %d\n", the_display->shape_error_base, the_display->shape_event_base); @@ -525,10 +525,10 @@ meta_display_open (void) #ifdef HAVE_RENDER { the_display->have_render = FALSE; - + the_display->render_error_base = 0; the_display->render_event_base = 0; - + if (!XRenderQueryExtension (the_display->xdisplay, &the_display->render_event_base, &the_display->render_error_base)) @@ -538,7 +538,7 @@ meta_display_open (void) } else the_display->have_render = TRUE; - + meta_verbose ("Attempted to init Render, found error base %d event base %d\n", the_display->render_error_base, the_display->render_event_base); @@ -560,7 +560,7 @@ meta_display_open (void) { the_display->composite_error_base = 0; the_display->composite_event_base = 0; - } + } else { the_display->composite_major_version = 0; @@ -580,7 +580,7 @@ meta_display_open (void) meta_verbose ("Attempted to init Composite, found error base %d event base %d " "extn ver %d %d\n", - the_display->composite_error_base, + the_display->composite_error_base, the_display->composite_event_base, the_display->composite_major_version, the_display->composite_minor_version); @@ -596,12 +596,12 @@ meta_display_open (void) { the_display->damage_error_base = 0; the_display->damage_event_base = 0; - } + } else the_display->have_damage = TRUE; meta_verbose ("Attempted to init Damage, found error base %d event base %d\n", - the_display->damage_error_base, + the_display->damage_error_base, the_display->damage_event_base); the_display->have_xfixes = FALSE; @@ -615,18 +615,18 @@ meta_display_open (void) { the_display->xfixes_error_base = 0; the_display->xfixes_event_base = 0; - } + } else the_display->have_xfixes = TRUE; meta_verbose ("Attempted to init XFixes, found error base %d event base %d\n", - the_display->xfixes_error_base, + the_display->xfixes_error_base, the_display->xfixes_event_base); } #else /* HAVE_COMPOSITE_EXTENSIONS */ meta_verbose ("Not compiled with Composite support\n"); #endif /* !HAVE_COMPOSITE_EXTENSIONS */ - + #ifdef HAVE_XCURSOR { XcursorSetTheme (the_display->xdisplay, meta_prefs_get_cursor_theme ()); @@ -658,7 +658,7 @@ meta_display_open (void) the_display->leader_window, the_display->atom__NET_WM_NAME, "Metacity"); - + meta_prop_set_utf8_string_hint (the_display, the_display->leader_window, the_display->atom__METACITY_VERSION, @@ -697,9 +697,9 @@ meta_display_open (void) the_display->last_focus_time = timestamp; the_display->last_user_time = timestamp; the_display->compositor = NULL; - + screens = NULL; - + i = 0; while (i < ScreenCount (xdisplay)) { @@ -711,9 +711,9 @@ meta_display_open (void) screens = g_slist_prepend (screens, screen); ++i; } - + the_display->screens = screens; - + if (screens == NULL) { /* This would typically happen because all the screens already @@ -723,20 +723,20 @@ meta_display_open (void) return FALSE; } - /* We don't composite the windows here because they will be composited - faster with the call to meta_screen_manage_all_windows further down + /* We don't composite the windows here because they will be composited + faster with the call to meta_screen_manage_all_windows further down the code */ if (meta_prefs_get_compositing_manager ()) enable_compositor (the_display, FALSE); - + meta_display_grab (the_display); - + /* Now manage all existing windows */ tmp = the_display->screens; while (tmp != NULL) { MetaScreen *screen = tmp->data; - + meta_screen_manage_all_windows (screen); tmp = tmp->next; @@ -779,8 +779,8 @@ meta_display_open (void) meta_error_trap_pop (the_display, FALSE); } - - meta_display_ungrab (the_display); + + meta_display_ungrab (the_display); /* Done opening new display */ the_display->display_opening = FALSE; @@ -814,7 +814,7 @@ meta_display_list_windows (MetaDisplay *display) GSList *winlist; GSList *tmp; GSList *prev; - + winlist = NULL; g_hash_table_foreach (display->window_ids, listify_func, @@ -832,7 +832,7 @@ meta_display_list_windows (MetaDisplay *display) GSList *next; next = tmp->next; - + if (next && next->data == tmp->data) { @@ -843,7 +843,7 @@ meta_display_list_windows (MetaDisplay *display) if (tmp == winlist) winlist = next; - + g_slist_free_1 (tmp); /* leave prev unchanged */ @@ -852,7 +852,7 @@ meta_display_list_windows (MetaDisplay *display) { prev = tmp; } - + tmp = next; } @@ -879,17 +879,17 @@ meta_display_close (MetaDisplay *display, display->closing += 1; meta_prefs_remove_listener (prefs_changed_callback, display); - + meta_display_remove_autoraise_callback (display); if (display->grab_old_window_stacking) g_list_free (display->grab_old_window_stacking); - + /* Stop caring about events */ meta_ui_remove_event_func (display->xdisplay, event_callback, display); - + /* Free all screens */ tmp = display->screens; while (tmp != NULL) @@ -909,7 +909,7 @@ meta_display_close (MetaDisplay *display, display->sn_display = NULL; } #endif - + /* Must be after all calls to meta_window_free() since they * unregister windows */ @@ -922,14 +922,14 @@ meta_display_close (MetaDisplay *display, meta_display_free_window_prop_hooks (display); meta_display_free_group_prop_hooks (display); - + g_free (display->name); meta_display_shutdown_keys (display); if (display->compositor) meta_compositor_destroy (display->compositor); - + g_free (display); the_display = NULL; @@ -962,7 +962,7 @@ meta_display_screen_for_xwindow (MetaDisplay *display, { XWindowAttributes attr; int result; - + meta_error_trap_push (display); attr.screen = NULL; result = XGetWindowAttributes (display->xdisplay, xwindow, &attr); @@ -974,7 +974,7 @@ meta_display_screen_for_xwindow (MetaDisplay *display, */ if (result == 0 || attr.screen == NULL) return NULL; - + return meta_display_screen_for_x_screen (display, attr.screen); } @@ -1016,7 +1016,7 @@ meta_display_ungrab (MetaDisplay *display) { if (display->server_grab_count == 0) meta_bug ("Ungrabbed non-grabbed server\n"); - + display->server_grab_count -= 1; if (display->server_grab_count == 0) { @@ -1050,7 +1050,7 @@ meta_display_for_x_display (Display *xdisplay) meta_warning ("Could not find display for X display %p, probably going to crash\n", xdisplay); - + return NULL; } @@ -1077,8 +1077,8 @@ grab_op_is_mouse_only (MetaGrabOp op) { case META_GRAB_OP_MOVING: case META_GRAB_OP_RESIZING_SE: - case META_GRAB_OP_RESIZING_S: - case META_GRAB_OP_RESIZING_SW: + case META_GRAB_OP_RESIZING_S: + case META_GRAB_OP_RESIZING_SW: case META_GRAB_OP_RESIZING_N: case META_GRAB_OP_RESIZING_NE: case META_GRAB_OP_RESIZING_NW: @@ -1098,8 +1098,8 @@ grab_op_is_mouse (MetaGrabOp op) { case META_GRAB_OP_MOVING: case META_GRAB_OP_RESIZING_SE: - case META_GRAB_OP_RESIZING_S: - case META_GRAB_OP_RESIZING_SW: + case META_GRAB_OP_RESIZING_S: + case META_GRAB_OP_RESIZING_SW: case META_GRAB_OP_RESIZING_N: case META_GRAB_OP_RESIZING_NE: case META_GRAB_OP_RESIZING_NW: @@ -1157,8 +1157,8 @@ meta_grab_op_is_resizing (MetaGrabOp op) switch (op) { case META_GRAB_OP_RESIZING_SE: - case META_GRAB_OP_RESIZING_S: - case META_GRAB_OP_RESIZING_SW: + case META_GRAB_OP_RESIZING_S: + case META_GRAB_OP_RESIZING_SW: case META_GRAB_OP_RESIZING_N: case META_GRAB_OP_RESIZING_NE: case META_GRAB_OP_RESIZING_NW: @@ -1188,7 +1188,7 @@ meta_grab_op_is_moving (MetaGrabOp op) case META_GRAB_OP_MOVING: case META_GRAB_OP_KEYBOARD_MOVING: return TRUE; - + default: return FALSE; } @@ -1206,7 +1206,7 @@ guint32 meta_display_get_current_time_roundtrip (MetaDisplay *display) { guint32 timestamp; - + timestamp = meta_display_get_current_time (display); if (timestamp == CurrentTime) { @@ -1240,7 +1240,7 @@ add_ignored_serial (MetaDisplay *display, /* don't add the same serial more than once */ if (display->ignored_serials[N_IGNORED_SERIALS-1] == serial) return; - + /* shift serials to the left */ i = 0; while (i < (N_IGNORED_SERIALS - 1)) @@ -1283,7 +1283,7 @@ reset_ignores (MetaDisplay *display) display->ungrab_should_not_cause_focus_window = None; } -static gboolean +static gboolean window_raise_with_delay_callback (void *data) { MetaWindow *window; @@ -1291,23 +1291,23 @@ window_raise_with_delay_callback (void *data) auto_raise = data; - meta_topic (META_DEBUG_FOCUS, - "In autoraise callback for window 0x%lx\n", + meta_topic (META_DEBUG_FOCUS, + "In autoraise callback for window 0x%lx\n", auto_raise->xwindow); auto_raise->display->autoraise_timeout_id = 0; auto_raise->display->autoraise_window = NULL; - window = meta_display_lookup_x_window (auto_raise->display, + window = meta_display_lookup_x_window (auto_raise->display, auto_raise->xwindow); - - if (window == NULL) + + if (window == NULL) return FALSE; /* If we aren't already on top, check whether the pointer is inside * the window and raise the window if so. - */ - if (meta_stack_get_top (window->screen->stack) != window) + */ + if (meta_stack_get_top (window->screen->stack) != window) { int x, y, root_x, root_y; Window root, child; @@ -1322,14 +1322,14 @@ window_raise_with_delay_callback (void *data) &root_x, &root_y, &x, &y, &mask); meta_error_trap_pop (window->display, TRUE); - point_in_window = + point_in_window = (window->frame && POINT_IN_RECT (root_x, root_y, window->frame->rect)) || (window->frame == NULL && POINT_IN_RECT (root_x, root_y, window->rect)); if (same_screen && point_in_window) meta_window_raise (window); else - meta_topic (META_DEBUG_FOCUS, - "Pointer not inside window, not raising %s\n", + meta_topic (META_DEBUG_FOCUS, + "Pointer not inside window, not raising %s\n", window->desc); } @@ -1342,19 +1342,19 @@ meta_display_queue_autoraise_callback (MetaDisplay *display, { MetaAutoRaiseData *auto_raise_data; - meta_topic (META_DEBUG_FOCUS, - "Queuing an autoraise timeout for %s with delay %d\n", - window->desc, + meta_topic (META_DEBUG_FOCUS, + "Queuing an autoraise timeout for %s with delay %d\n", + window->desc, meta_prefs_get_auto_raise_delay ()); - + auto_raise_data = g_new (MetaAutoRaiseData, 1); auto_raise_data->display = window->display; auto_raise_data->xwindow = window->xwindow; - + if (display->autoraise_timeout_id != 0) g_source_remove (display->autoraise_timeout_id); - display->autoraise_timeout_id = + display->autoraise_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, meta_prefs_get_auto_raise_delay (), window_raise_with_delay_callback, @@ -1390,7 +1390,7 @@ event_callback (XEvent *event, gboolean filter_out_event; display = data; - + #ifdef WITH_VERBOSE_MODE if (dump_events) meta_spew_event (display, event); @@ -1399,13 +1399,13 @@ event_callback (XEvent *event, #ifdef HAVE_STARTUP_NOTIFICATION sn_display_process_event (display->sn_display, event); #endif - + filter_out_event = FALSE; display->current_time = event_get_time (display, event); display->xinerama_cache_invalidated = TRUE; - + modified = event_get_modified_window (display, event); - + if (event->type == ButtonPress) { /* filter out scrollwheel */ @@ -1449,7 +1449,7 @@ event_callback (XEvent *event, property_for_window = window; window = NULL; } - + frame_was_receiver = FALSE; if (window && @@ -1466,12 +1466,12 @@ event_callback (XEvent *event, } #ifdef HAVE_XSYNC - if (META_DISPLAY_HAS_XSYNC (display) && + if (META_DISPLAY_HAS_XSYNC (display) && event->type == (display->xsync_event_base + XSyncAlarmNotify) && ((XSyncAlarmNotifyEvent*)event)->alarm == display->grab_sync_request_alarm) { filter_out_event = TRUE; /* GTK doesn't want to see this really */ - + if (display->grab_op != META_GRAB_OP_NONE && display->grab_window != NULL && grab_op_is_mouse (display->grab_op)) @@ -1480,11 +1480,11 @@ event_callback (XEvent *event, #endif /* HAVE_XSYNC */ #ifdef HAVE_SHAPE - if (META_DISPLAY_HAS_SHAPE (display) && + if (META_DISPLAY_HAS_SHAPE (display) && event->type == (display->shape_event_base + ShapeNotify)) { filter_out_event = TRUE; /* GTK doesn't want to see this really */ - + if (window && !frame_was_receiver) { XShapeEvent *sev = (XShapeEvent*) event; @@ -1493,7 +1493,7 @@ event_callback (XEvent *event, { if (sev->shaped && !window->has_shape) { - window->has_shape = TRUE; + window->has_shape = TRUE; meta_topic (META_DEBUG_SHAPES, "Window %s now has a shape\n", window->desc); @@ -1515,7 +1515,7 @@ event_callback (XEvent *event, if (window->frame) { window->frame->need_reapply_frame_shape = TRUE; - meta_warning("from event callback\n"); + meta_warning("from event callback\n"); meta_window_queue (window, META_QUEUE_MOVE_RESIZE); } } @@ -1548,7 +1548,7 @@ event_callback (XEvent *event, sanity_check_timestamps (display, display->current_time); } } - + switch (event->type) { case KeyPress: @@ -1566,14 +1566,14 @@ event_callback (XEvent *event, "Ending grab op %u on window %s due to button press\n", display->grab_op, (display->grab_window ? - display->grab_window->desc : + display->grab_window->desc : "none")); if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op)) { MetaScreen *screen; - meta_topic (META_DEBUG_WINDOW_OPS, + meta_topic (META_DEBUG_WINDOW_OPS, "Syncing to old stack positions.\n"); - screen = + screen = meta_display_screen_for_root (display, event->xany.window); if (screen!=NULL) @@ -1599,7 +1599,7 @@ event_callback (XEvent *event, * button 1. So for all such events we focus the window. */ unmodified = (event->xbutton.state & grab_mask) == 0; - + if (unmodified || event->xbutton.button == 1) { @@ -1609,7 +1609,7 @@ event_callback (XEvent *event, */ if (!frame_was_receiver) { - if (meta_prefs_get_raise_on_click ()) + if (meta_prefs_get_raise_on_click ()) meta_window_raise (window); else meta_topic (META_DEBUG_FOCUS, @@ -1631,7 +1631,7 @@ event_callback (XEvent *event, */ display->allow_terminal_deactivation = TRUE; } - + /* you can move on alt-click but not on * the click-to-focus */ @@ -1672,7 +1672,7 @@ event_callback (XEvent *event, op = META_GRAB_OP_RESIZING_S; else /* Middle region is no-op to avoid user triggering wrong action */ op = META_GRAB_OP_NONE; - + if (op != META_GRAB_OP_NONE) meta_display_begin_grab_op (display, window->screen, @@ -1704,7 +1704,7 @@ event_callback (XEvent *event, * it has no modifiers and was on the client window */ int mode; - + /* When clicking a different app in click-to-focus * in application-based mode, and the different * app is not a dock or desktop, eat the focus click. @@ -1724,7 +1724,7 @@ event_callback (XEvent *event, meta_verbose ("Allowing events mode %s time %u\n", mode == AsyncPointer ? "AsyncPointer" : "ReplayPointer", (unsigned int)event->xbutton.time); - + XAllowEvents (display->xdisplay, mode, event->xbutton.time); } @@ -1768,11 +1768,11 @@ event_callback (XEvent *event, * actually appear on the right screen. */ { - MetaScreen *new_screen = + MetaScreen *new_screen = meta_display_screen_for_root (display, event->xcrossing.root); if (new_screen != NULL && display->active_screen != new_screen) - meta_workspace_focus_default_window (new_screen->active_workspace, + meta_workspace_focus_default_window (new_screen->active_workspace, NULL, event->xcrossing.time); } @@ -1781,7 +1781,7 @@ event_callback (XEvent *event, * avoid races. */ if (window && !serial_is_ignored (display, event->xany.serial) && - event->xcrossing.mode != NotifyGrab && + event->xcrossing.mode != NotifyGrab && event->xcrossing.mode != NotifyUngrab && event->xcrossing.detail != NotifyInferior && meta_display_focus_sentinel_clear (display)) @@ -1798,7 +1798,7 @@ event_callback (XEvent *event, "Focusing %s due to enter notify with serial %lu " "at time %lu, and setting display->mouse_mode to " "TRUE.\n", - window->desc, + window->desc, event->xany.serial, event->xcrossing.time); @@ -1806,15 +1806,15 @@ event_callback (XEvent *event, /* stop ignoring stuff */ reset_ignores (display); - - if (meta_prefs_get_auto_raise ()) + + if (meta_prefs_get_auto_raise ()) { meta_display_queue_autoraise_callback (display, window); } else { meta_topic (META_DEBUG_FOCUS, - "Auto raise is disabled\n"); + "Auto raise is disabled\n"); } } /* In mouse focus mode, we defocus when the mouse *enters* @@ -1834,7 +1834,7 @@ event_callback (XEvent *event, "Unsetting focus from %s due to mouse entering " "the DESKTOP window\n", display->expected_focus_window->desc); - meta_display_focus_the_no_focus_window (display, + meta_display_focus_the_no_focus_window (display, window->screen, event->xcrossing.time); } @@ -1842,7 +1842,7 @@ event_callback (XEvent *event, case G_DESKTOP_FOCUS_MODE_CLICK: break; } - + if (window->type == META_WINDOW_DOCK) meta_window_raise (window); } @@ -1896,11 +1896,11 @@ event_callback (XEvent *event, event->xany.window, meta_event_mode_to_string (event->xfocus.mode), meta_event_detail_to_string (event->xfocus.detail)); - + if (event->type == FocusIn && event->xfocus.detail == NotifyDetailNone) { - meta_topic (META_DEBUG_FOCUS, + meta_topic (META_DEBUG_FOCUS, "Focus got set to None, probably due to " "brain-damage in the X protocol (see bug " "125492). Setting the default focus window.\n"); @@ -1935,7 +1935,7 @@ event_callback (XEvent *event, break; case CreateNotify: break; - + case DestroyNotify: if (window) { @@ -1949,7 +1949,7 @@ event_callback (XEvent *event, if (display->grab_op != META_GRAB_OP_NONE && display->grab_window == window) meta_display_end_grab_op (display, timestamp); - + if (frame_was_receiver) { meta_warning ("Unexpected destruction of frame 0x%lx, not sure if this should silently fail or be considered a bug\n", @@ -1980,7 +1980,7 @@ event_callback (XEvent *event, display->grab_window == window && ((window->frame == NULL) || !window->frame->mapped)) meta_display_end_grab_op (display, timestamp); - + if (!frame_was_receiver) { if (window->unmaps_pending == 0) @@ -1991,7 +1991,7 @@ event_callback (XEvent *event, meta_effect_run_close (window, NULL, NULL); - /* Unmanage withdrawn window */ + /* Unmanage withdrawn window */ window->withdrawn = TRUE; meta_window_free (window, timestamp); window = NULL; @@ -2022,7 +2022,7 @@ event_callback (XEvent *event, FALSE); } /* if frame was receiver it's some malicious send event or something */ - else if (!frame_was_receiver && window) + else if (!frame_was_receiver && window) { meta_verbose ("MapRequest on %s mapped = %d minimized = %d\n", window->desc, window->mapped, window->minimized); @@ -2059,8 +2059,8 @@ event_callback (XEvent *event, screen->xscreen->width = event->xconfigure.width; screen->xscreen->height = event->xconfigure.height; #endif - - meta_screen_resize (screen, + + meta_screen_resize (screen, event->xconfigure.width, event->xconfigure.height); } @@ -2078,7 +2078,7 @@ event_callback (XEvent *event, { unsigned int xwcm; XWindowChanges xwc; - + xwcm = event->xconfigurerequest.value_mask & (CWX | CWY | CWWidth | CWHeight | CWBorderWidth); @@ -2113,7 +2113,7 @@ event_callback (XEvent *event, { MetaGroup *group; MetaScreen *screen; - + if (window && !frame_was_receiver) meta_window_property_notify (window, event); else if (property_for_window && !frame_was_receiver) @@ -2123,13 +2123,13 @@ event_callback (XEvent *event, event->xproperty.window); if (group != NULL) meta_group_property_notify (group, event); - + screen = NULL; if (window == NULL && group == NULL) /* window/group != NULL means it wasn't a root window */ screen = meta_display_screen_for_root (display, event->xproperty.window); - + if (screen != NULL) { if (event->xproperty.atom == @@ -2187,7 +2187,7 @@ event_callback (XEvent *event, screen = meta_display_screen_for_root (display, event->xclient.window); - + if (screen) { if (event->xclient.message_type == @@ -2196,10 +2196,10 @@ event_callback (XEvent *event, int space; MetaWorkspace *workspace; guint32 time; - + space = event->xclient.data.l[0]; time = event->xclient.data.l[1]; - + meta_verbose ("Request to change current workspace to %d with " "specified timestamp of %u\n", space, time); @@ -2226,9 +2226,9 @@ event_callback (XEvent *event, display->atom__NET_NUMBER_OF_DESKTOPS) { int num_spaces; - + num_spaces = event->xclient.data.l[0]; - + meta_verbose ("Request to set number of workspaces to %d\n", num_spaces); @@ -2239,13 +2239,13 @@ event_callback (XEvent *event, { gboolean showing_desktop; guint32 timestamp; - + showing_desktop = event->xclient.data.l[0] != 0; /* FIXME: Braindead protocol doesn't have a timestamp */ timestamp = meta_display_get_current_time_roundtrip (display); meta_verbose ("Request to %s desktop\n", showing_desktop ? "show" : "hide"); - + if (showing_desktop) meta_screen_show_desktop (screen, timestamp); else @@ -2289,10 +2289,10 @@ event_callback (XEvent *event, meta_set_verbose (!meta_is_verbose ()); } else if (event->xclient.message_type == - display->atom_WM_PROTOCOLS) + display->atom_WM_PROTOCOLS) { meta_verbose ("Received WM_PROTOCOLS message\n"); - + if ((Atom)event->xclient.data.l[0] == display->atom__NET_WM_PING) { process_pong_message (display, event); @@ -2319,7 +2319,7 @@ event_callback (XEvent *event, gboolean ignore_current; ignore_current = FALSE; - + /* Check whether the next event is an identical MappingNotify * event. If it is, ignore the current event, we'll update * when we get the next one. @@ -2327,9 +2327,9 @@ event_callback (XEvent *event, if (XPending (display->xdisplay)) { XEvent next_event; - + XPeekEvent (display->xdisplay, &next_event); - + if (next_event.type == MappingNotify && next_event.xmapping.request == event->xmapping.request) ignore_current = TRUE; @@ -2346,10 +2346,10 @@ event_callback (XEvent *event, break; default: #ifdef HAVE_XKB - if (event->type == display->xkb_base_event_type) + if (event->type == display->xkb_base_event_type) { XkbAnyEvent *xkb_ev = (XkbAnyEvent *) event; - + switch (xkb_ev->xkb_type) { case XkbBellNotify: @@ -2376,7 +2376,7 @@ event_callback (XEvent *event, event, window); } - + display->current_time = CurrentTime; return filter_out_event; } @@ -2413,10 +2413,10 @@ event_get_modified_window (MetaDisplay *display, case EnterNotify: case LeaveNotify: return event->xany.window; - + case CreateNotify: return event->xcreatewindow.window; - + case DestroyNotify: return event->xdestroywindow.window; @@ -2431,10 +2431,10 @@ event_get_modified_window (MetaDisplay *display, case ReparentNotify: return event->xreparent.window; - + case ConfigureNotify: return event->xconfigure.window; - + case ConfigureRequest: return event->xconfigurerequest.window; @@ -2452,7 +2452,7 @@ event_get_modified_window (MetaDisplay *display, default: #ifdef HAVE_SHAPE - if (META_DISPLAY_HAS_SHAPE (display) && + if (META_DISPLAY_HAS_SHAPE (display) && event->type == (display->shape_event_base + ShapeNotify)) { XShapeEvent *sev = (XShapeEvent*) event; @@ -2473,11 +2473,11 @@ event_get_time (MetaDisplay *display, case KeyPress: case KeyRelease: return event->xkey.time; - + case ButtonPress: case ButtonRelease: return event->xbutton.time; - + case MotionNotify: return event->xmotion.time; @@ -2495,7 +2495,7 @@ event_get_time (MetaDisplay *display, case FocusIn: case FocusOut: - case KeymapNotify: + case KeymapNotify: case Expose: case GraphicsExpose: case NoExpose: @@ -2604,7 +2604,7 @@ stack_mode_to_string (int mode) case BottomIf: return "BottomIf"; case Opposite: - return "Opposite"; + return "Opposite"; } return "Unknown"; @@ -2635,7 +2635,7 @@ sync_value_to_64 (const XSyncValue *value) v = XSyncValueLow32 (*value); v |= (((gint64)XSyncValueHigh32 (*value)) << 32); - + return v; } #endif /* WITH_VERBOSE_MODE */ @@ -2672,12 +2672,12 @@ meta_spew_event (MetaDisplay *display, if (!meta_is_verbose()) return; - + /* filter overnumerous events */ if (event->type == Expose || event->type == MotionNotify || event->type == NoExpose) return; - + switch (event->type) { case KeyPress: @@ -2861,9 +2861,9 @@ meta_spew_event (MetaDisplay *display, { char *str; const char *state; - + name = "PropertyNotify"; - + meta_error_trap_push (display); str = XGetAtomName (display->xdisplay, event->xproperty.atom); @@ -2875,7 +2875,7 @@ meta_spew_event (MetaDisplay *display, state = "PropertyDelete"; else state = "???"; - + extra = g_strdup_printf ("atom: %s state: %s", str ? str : "(unknown atom)", state); @@ -2913,11 +2913,11 @@ meta_spew_event (MetaDisplay *display, break; default: #ifdef HAVE_XSYNC - if (META_DISPLAY_HAS_XSYNC (display) && + if (META_DISPLAY_HAS_XSYNC (display) && event->type == (display->xsync_event_base + XSyncAlarmNotify)) { XSyncAlarmNotifyEvent *aevent = (XSyncAlarmNotifyEvent*) event; - + name = "XSyncAlarmNotify"; extra = g_strdup_printf ("alarm: 0x%lx" @@ -2933,7 +2933,7 @@ meta_spew_event (MetaDisplay *display, else #endif /* HAVE_XSYNC */ #ifdef HAVE_SHAPE - if (META_DISPLAY_HAS_SHAPE (display) && + if (META_DISPLAY_HAS_SHAPE (display) && event->type == (display->shape_event_base + ShapeNotify)) { XShapeEvent *sev = (XShapeEvent*) event; @@ -2952,7 +2952,7 @@ meta_spew_event (MetaDisplay *display, sev->shaped); } else -#endif /* HAVE_SHAPE */ +#endif /* HAVE_SHAPE */ { name = "(Unknown event)"; extra = g_strdup_printf ("type: %d", event->xany.type); @@ -2961,12 +2961,12 @@ meta_spew_event (MetaDisplay *display, } screen = meta_display_screen_for_root (display, event->xany.window); - + if (screen) winname = g_strdup_printf ("root %d", screen->number); else winname = g_strdup_printf ("0x%lx", event->xany.window); - + meta_topic (META_DEBUG_EVENTS, "%s on %s%s %s %sserial %lu\n", name, winname, extra ? ":" : "", extra ? extra : "", @@ -2993,7 +2993,7 @@ meta_display_register_x_window (MetaDisplay *display, MetaWindow *window) { g_return_if_fail (g_hash_table_lookup (display->window_ids, xwindowp) == NULL); - + g_hash_table_insert (display->window_ids, xwindowp, window); } @@ -3069,13 +3069,13 @@ meta_display_create_x_cursor (MetaDisplay *display, case META_CURSOR_BUSY: glyph = XC_watch; break; - + default: g_assert_not_reached (); glyph = 0; /* silence compiler */ break; } - + xcursor = XCreateFontCursor (display->xdisplay, glyph); return xcursor; @@ -3086,7 +3086,7 @@ xcursor_for_op (MetaDisplay *display, MetaGrabOp op) { MetaCursor cursor = META_CURSOR_DEFAULT; - + switch (op) { case META_GRAB_OP_RESIZING_SE: @@ -3126,7 +3126,7 @@ xcursor_for_op (MetaDisplay *display, case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN: cursor = META_CURSOR_MOVE_OR_RESIZE_WINDOW; break; - + default: break; } @@ -3200,7 +3200,7 @@ meta_display_set_grab_op_cursor (MetaDisplay *display, } #undef GRAB_MASK - + if (cursor != None) XFreeCursor (display->xdisplay, cursor); } @@ -3219,7 +3219,7 @@ meta_display_begin_grab_op (MetaDisplay *display, int root_y) { Window grab_xwindow; - + if (grab_op_is_mouse (op) && meta_grab_op_is_moving (op)) { if (display->compositor) @@ -3229,12 +3229,12 @@ meta_display_begin_grab_op (MetaDisplay *display, root_x, root_y); } } - + meta_topic (META_DEBUG_WINDOW_OPS, "Doing grab op %u on window %s button %d pointer already grabbed: %d pointer pos %d,%d\n", op, window ? window->desc : "none", button, pointer_already_grabbed, root_x, root_y); - + if (display->grab_op != META_GRAB_OP_NONE) { if (window) @@ -3269,10 +3269,10 @@ meta_display_begin_grab_op (MetaDisplay *display, grab_xwindow = screen->xroot; display->grab_have_pointer = FALSE; - + if (pointer_already_grabbed) display->grab_have_pointer = TRUE; - + meta_display_set_grab_op_cursor (display, screen, op, FALSE, grab_xwindow, timestamp); @@ -3293,7 +3293,7 @@ meta_display_begin_grab_op (MetaDisplay *display, else display->grab_have_keyboard = meta_screen_grab_all_keys (screen, timestamp); - + if (!display->grab_have_keyboard) { meta_topic (META_DEBUG_WINDOW_OPS, @@ -3303,7 +3303,7 @@ meta_display_begin_grab_op (MetaDisplay *display, return FALSE; } } - + display->grab_op = op; display->grab_window = window; display->grab_screen = screen; @@ -3340,7 +3340,7 @@ meta_display_begin_grab_op (MetaDisplay *display, g_source_remove (display->grab_resize_timeout_id); display->grab_resize_timeout_id = 0; } - + if (display->grab_window) { meta_window_get_client_root_coords (display->grab_window, @@ -3348,16 +3348,16 @@ meta_display_begin_grab_op (MetaDisplay *display, display->grab_anchor_window_pos = display->grab_initial_window_pos; display->grab_wireframe_active = - (meta_prefs_get_reduced_resources () && !meta_prefs_get_gnome_accessibility ()) && + (meta_prefs_get_reduced_resources () && !meta_prefs_get_gnome_accessibility ()) && (meta_grab_op_is_resizing (display->grab_op) || meta_grab_op_is_moving (display->grab_op)); - + if (display->grab_wireframe_active) { meta_window_calc_showing (display->grab_window); meta_window_begin_wireframe (window); } - + #ifdef HAVE_XSYNC if (!display->grab_wireframe_active && meta_grab_op_is_resizing (display->grab_op) && @@ -3372,29 +3372,29 @@ meta_display_begin_grab_op (MetaDisplay *display, * responses to the client messages will always trigger * a PositiveTransition */ - + XSyncIntToValue (&init, 0); XSyncSetCounter (display->xdisplay, display->grab_window->sync_request_counter, init); - + display->grab_window->sync_request_serial = 0; display->grab_window->sync_request_time.tv_sec = 0; display->grab_window->sync_request_time.tv_usec = 0; - + values.trigger.counter = display->grab_window->sync_request_counter; values.trigger.value_type = XSyncAbsolute; values.trigger.test_type = XSyncPositiveTransition; XSyncIntToValue (&values.trigger.wait_value, display->grab_window->sync_request_serial + 1); - + /* After triggering, increment test_value by this. * (NOT wait_value above) */ XSyncIntToValue (&values.delta, 1); - + /* we want events (on by default anyway) */ values.events = True; - + display->grab_sync_request_alarm = XSyncCreateAlarm (display->xdisplay, XSyncCACounter | XSyncCAValueType | @@ -3413,7 +3413,7 @@ meta_display_begin_grab_op (MetaDisplay *display, } #endif } - + meta_topic (META_DEBUG_WINDOW_OPS, "Grab op %u on window %s successful\n", display->grab_op, window ? window->desc : "(null)"); @@ -3424,7 +3424,7 @@ meta_display_begin_grab_op (MetaDisplay *display, /* If this is a move or resize, cache the window edges for * resistance/snapping */ - if (meta_grab_op_is_resizing (display->grab_op) || + if (meta_grab_op_is_resizing (display->grab_op) || meta_grab_op_is_moving (display->grab_op)) { meta_topic (META_DEBUG_WINDOW_OPS, @@ -3439,7 +3439,7 @@ meta_display_begin_grab_op (MetaDisplay *display, meta_topic (META_DEBUG_WINDOW_OPS, "Saving old stack positions; old pointer was %p.\n", display->grab_old_window_stacking); - display->grab_old_window_stacking = + display->grab_old_window_stacking = meta_stack_get_positions (screen->stack); } @@ -3476,7 +3476,7 @@ meta_display_begin_grab_op (MetaDisplay *display, meta_screen_ensure_tab_popup (screen, META_TAB_LIST_GROUP, META_TAB_SHOW_INSTANTLY); - + case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING: meta_screen_ensure_workspace_popup (screen); break; @@ -3489,7 +3489,7 @@ meta_display_begin_grab_op (MetaDisplay *display, { meta_window_refresh_resize_popup (display->grab_window); } - + return TRUE; } @@ -3499,7 +3499,7 @@ meta_display_end_grab_op (MetaDisplay *display, { meta_topic (META_DEBUG_WINDOW_OPS, "Ending grab op %u at time %u\n", display->grab_op, timestamp); - + if (display->grab_op == META_GRAB_OP_NONE) return; @@ -3537,9 +3537,9 @@ meta_display_end_grab_op (MetaDisplay *display, */ display->ungrab_should_not_cause_focus_window = display->grab_xwindow; } - + /* If this was a move or resize clear out the edge cache */ - if (meta_grab_op_is_resizing (display->grab_op) || + if (meta_grab_op_is_resizing (display->grab_op) || meta_grab_op_is_moving (display->grab_op)) { meta_topic (META_DEBUG_WINDOW_OPS, @@ -3580,13 +3580,13 @@ meta_display_end_grab_op (MetaDisplay *display, if (display->compositor && display->grab_window && - grab_op_is_mouse (display->grab_op) && + grab_op_is_mouse (display->grab_op) && meta_grab_op_is_moving (display->grab_op)) { meta_compositor_end_move (display->compositor, display->grab_window); } - + if (display->grab_have_pointer) { meta_topic (META_DEBUG_WINDOW_OPS, @@ -3666,9 +3666,9 @@ meta_change_button_grab (MetaDisplay *display, grab ? "Grabbing" : "Ungrabbing", xwindow, sync, button, modmask); - + meta_error_trap_push (display); - + ignored_mask = 0; while (ignored_mask <= display->ignored_modifier_mask) { @@ -3685,11 +3685,11 @@ meta_change_button_grab (MetaDisplay *display, meta_error_trap_push_with_return (display); /* GrabModeSync means freeze until XAllowEvents */ - + if (grab) XGrabButton (display->xdisplay, button, modmask | ignored_mask, xwindow, False, - ButtonPressMask | ButtonReleaseMask | + ButtonPressMask | ButtonReleaseMask | PointerMotionMask | PointerMotionHintMask, sync ? GrabModeSync : GrabModeAsync, GrabModeAsync, @@ -3701,15 +3701,15 @@ meta_change_button_grab (MetaDisplay *display, if (meta_is_debugging ()) { int result; - + result = meta_error_trap_pop_with_return (display, FALSE); - + if (result != Success) meta_verbose ("Failed to %s button %d with mask 0x%x for window 0x%lx error code %d\n", grab ? "grab" : "ungrab", button, modmask | ignored_mask, xwindow, result); } - + ++ignored_mask; } @@ -3719,14 +3719,14 @@ meta_change_button_grab (MetaDisplay *display, void meta_display_grab_window_buttons (MetaDisplay *display, Window xwindow) -{ +{ /* Grab Alt + button1 for moving window. * Grab Alt + button2 for resizing window. * Grab Alt + button3 for popping up window menu. * Grab Alt + Shift + button1 for snap-moving window. */ meta_verbose ("Grabbing window buttons for 0x%lx\n", xwindow); - + /* FIXME If we ignored errors here instead of spewing, we could * put one big error trap around the loop and avoid a bunch of * XSync() @@ -3741,8 +3741,8 @@ meta_display_grab_window_buttons (MetaDisplay *display, meta_change_button_grab (display, xwindow, TRUE, FALSE, - i, display->window_grab_modifiers); - + i, display->window_grab_modifiers); + /* This is for debugging, since I end up moving the Xnest * otherwise ;-) */ @@ -3775,7 +3775,7 @@ meta_display_ungrab_window_buttons (MetaDisplay *display, if (display->window_grab_modifiers == 0) return; - + debug = g_getenv ("METACITY_DEBUG_BUTTON_GRABS") != NULL; i = 1; while (i < 4) @@ -3783,11 +3783,11 @@ meta_display_ungrab_window_buttons (MetaDisplay *display, meta_change_button_grab (display, xwindow, FALSE, FALSE, i, display->window_grab_modifiers); - + if (debug) meta_change_button_grab (display, xwindow, FALSE, FALSE, i, ControlMask); - + ++i; } } @@ -3815,18 +3815,18 @@ meta_display_grab_focus_window_button (MetaDisplay *display, return; } #endif - + if (window->have_focus_click_grab) { meta_verbose (" (well, not grabbing since we already have the grab)\n"); return; } - + /* FIXME If we ignored errors here instead of spewing, we could * put one big error trap around the loop and avoid a bunch of * XSync() */ - + { int i = 1; while (i < MAX_FOCUS_BUTTON) @@ -3835,7 +3835,7 @@ meta_display_grab_focus_window_button (MetaDisplay *display, window->xwindow, TRUE, TRUE, i, 0); - + ++i; } @@ -3851,14 +3851,14 @@ meta_display_ungrab_focus_window_button (MetaDisplay *display, if (!window->have_focus_click_grab) return; - + { int i = 1; while (i < MAX_FOCUS_BUTTON) { meta_change_button_grab (display, window->xwindow, FALSE, FALSE, i, 0); - + ++i; } @@ -3887,19 +3887,19 @@ void meta_display_update_active_window_hint (MetaDisplay *display) { GSList *tmp; - + gulong data[1]; if (display->focus_window) data[0] = display->focus_window->xwindow; else data[0] = None; - + tmp = display->screens; while (tmp != NULL) { MetaScreen *screen = tmp->data; - + meta_error_trap_push (display); XChangeProperty (display->xdisplay, screen->xroot, display->atom__NET_ACTIVE_WINDOW, @@ -3923,15 +3923,15 @@ meta_display_queue_retheme_all_windows (MetaDisplay *display) while (tmp != NULL) { MetaWindow *window = tmp->data; - + meta_window_queue (window, META_QUEUE_MOVE_RESIZE); if (window->frame) { window->frame->need_reapply_frame_shape = TRUE; - + meta_frame_queue_draw (window->frame); } - + tmp = tmp->next; } @@ -3944,11 +3944,11 @@ meta_display_retheme_all (void) meta_display_queue_retheme_all_windows (meta_get_display ()); } -void -meta_display_set_cursor_theme (const char *theme, +void +meta_display_set_cursor_theme (const char *theme, int size) { -#ifdef HAVE_XCURSOR +#ifdef HAVE_XCURSOR GSList *tmp; MetaDisplay *display = meta_get_display (); @@ -3960,7 +3960,7 @@ meta_display_set_cursor_theme (const char *theme, while (tmp != NULL) { MetaScreen *screen = tmp->data; - + meta_screen_update_cursor (screen); tmp = tmp->next; @@ -4041,7 +4041,7 @@ meta_display_ping_timeout (gpointer data) meta_topic (META_DEBUG_PING, "Ping %u on window %lx timed out\n", ping_data->timestamp, ping_data->xwindow); - + (* ping_data->ping_timeout_func) (ping_data->display, ping_data->xwindow, ping_data->timestamp, ping_data->user_data); @@ -4049,7 +4049,7 @@ meta_display_ping_timeout (gpointer data) g_slist_remove (ping_data->display->pending_pings, ping_data); ping_data_free (ping_data); - + return FALSE; } @@ -4101,7 +4101,7 @@ meta_display_ping_window (MetaDisplay *display, return; } - + ping_data = g_new (MetaPingData, 1); ping_data->display = display; ping_data->xwindow = window->xwindow; @@ -4112,7 +4112,7 @@ meta_display_ping_window (MetaDisplay *display, ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY, meta_display_ping_timeout, ping_data); - + display->pending_pings = g_slist_prepend (display->pending_pings, ping_data); meta_topic (META_DEBUG_PING, @@ -4205,15 +4205,15 @@ process_pong_message (MetaDisplay *display, meta_topic (META_DEBUG_PING, "Received a pong with timestamp %u\n", timestamp); - + for (tmp = display->pending_pings; tmp; tmp = tmp->next) { MetaPingData *ping_data = tmp->data; - + if (timestamp == ping_data->timestamp) { meta_topic (META_DEBUG_PING, - "Matching ping found for pong %u\n", + "Matching ping found for pong %u\n", ping_data->timestamp); /* Remove the ping data from the list */ @@ -4226,13 +4226,13 @@ process_pong_message (MetaDisplay *display, g_source_remove (ping_data->ping_timeout_id); ping_data->ping_timeout_id = 0; } - + /* Call callback */ - (* ping_data->ping_reply_func) (display, + (* ping_data->ping_reply_func) (display, ping_data->xwindow, - ping_data->timestamp, + ping_data->timestamp, ping_data->user_data); - + ping_data_free (ping_data); break; @@ -4264,7 +4264,7 @@ meta_display_window_has_pending_pings (MetaDisplay *display, { MetaPingData *ping_data = tmp->data; - if (ping_data->xwindow == window->xwindow) + if (ping_data->xwindow == window->xwindow) return TRUE; } @@ -4287,7 +4287,7 @@ get_focussed_group (MetaDisplay *display) static MetaWindow* find_tab_forward (MetaDisplay *display, MetaTabList type, - MetaScreen *screen, + MetaScreen *screen, MetaWorkspace *workspace, GList *start, gboolean skip_first) @@ -4321,7 +4321,7 @@ find_tab_forward (MetaDisplay *display, return window; tmp = tmp->next; - } + } return NULL; } @@ -4329,7 +4329,7 @@ find_tab_forward (MetaDisplay *display, static MetaWindow* find_tab_backward (MetaDisplay *display, MetaTabList type, - MetaScreen *screen, + MetaScreen *screen, MetaWorkspace *workspace, GList *start, gboolean skip_last) @@ -4340,7 +4340,7 @@ find_tab_backward (MetaDisplay *display, g_return_val_if_fail (workspace != NULL, NULL); tmp = start; - if (skip_last) + if (skip_last) tmp = tmp->prev; while (tmp != NULL) { @@ -4382,35 +4382,35 @@ meta_display_get_tab_list (MetaDisplay *display, */ { GList *tmp; - + tab_list = NULL; tmp = workspace->mru_list; while (tmp != NULL) { MetaWindow *window = tmp->data; - + if (!window->minimized && window->screen == screen && IN_TAB_CHAIN (window, type)) tab_list = g_list_prepend (tab_list, window); - + tmp = tmp->next; } } { GList *tmp; - + tmp = workspace->mru_list; while (tmp != NULL) { MetaWindow *window = tmp->data; - + if (window->minimized && window->screen == screen && IN_TAB_CHAIN (window, type)) tab_list = g_list_prepend (tab_list, window); - + tmp = tmp->next; } } @@ -4430,9 +4430,9 @@ meta_display_get_tab_list (MetaDisplay *display, l_window=tmp->data; /* Check to see if it demands attention */ - if (l_window->wm_state_demands_attention && + if (l_window->wm_state_demands_attention && l_window->workspace!=workspace && - IN_TAB_CHAIN (l_window, type)) + IN_TAB_CHAIN (l_window, type)) { /* if it does, add it to the popup */ tab_list = g_list_prepend (tab_list, l_window); @@ -4443,7 +4443,7 @@ meta_display_get_tab_list (MetaDisplay *display, g_slist_free (windows); } - + return tab_list; } @@ -4465,11 +4465,11 @@ meta_display_get_tab_next (MetaDisplay *display, if (tab_list == NULL) return NULL; - + if (window != NULL) { g_assert (window->display == display); - + if (backward) ret = find_tab_backward (display, type, screen, workspace, g_list_find (tab_list, @@ -4483,7 +4483,7 @@ meta_display_get_tab_next (MetaDisplay *display, } else { - skip = display->focus_window != NULL && + skip = display->focus_window != NULL && tab_list->data == display->focus_window; if (backward) ret = find_tab_backward (display, type, screen, workspace, @@ -4506,7 +4506,7 @@ meta_display_get_tab_current (MetaDisplay *display, MetaWindow *window; window = display->focus_window; - + if (window != NULL && window->screen == screen && IN_TAB_CHAIN (window, type) && @@ -4521,7 +4521,7 @@ int meta_resize_gravity_from_grab_op (MetaGrabOp op) { int gravity; - + gravity = -1; switch (op) { @@ -4571,18 +4571,18 @@ static MetaScreen* find_screen_for_selection (MetaDisplay *display, Window owner, Atom selection) -{ - GSList *tmp; - +{ + GSList *tmp; + tmp = display->screens; while (tmp != NULL) { MetaScreen *screen = tmp->data; - + if (screen->wm_sn_selection_window == owner && screen->wm_sn_atom == selection) return screen; - + tmp = tmp->next; } @@ -4624,7 +4624,7 @@ convert_property (MetaDisplay *display, meta_error_trap_pop_with_return (display, FALSE); return FALSE; } - + if (meta_error_trap_pop_with_return (display, FALSE) != Success) return FALSE; @@ -4653,20 +4653,20 @@ process_selection_request (MetaDisplay *display, if (screen == NULL) { char *str; - + meta_error_trap_push (display); str = XGetAtomName (display->xdisplay, event->xselectionrequest.selection); meta_error_trap_pop (display, TRUE); - + meta_verbose ("Selection request with selection %s window 0x%lx not a WM_Sn selection we recognize\n", str ? str : "(bad atom)", event->xselectionrequest.owner); - + meta_XFree (str); return; } - + reply.type = SelectionNotify; reply.display = display->xdisplay; reply.requestor = event->xselectionrequest.requestor; @@ -4694,9 +4694,9 @@ process_selection_request (MetaDisplay *display, meta_error_trap_pop_with_return (display, TRUE); return; } - + if (meta_error_trap_pop_with_return (display, TRUE) == Success) - { + { /* FIXME: to be 100% correct, should deal with rest > 0, * but since we have 4 possible targets, we will hardly ever * meet multiple requests with a length > 8 @@ -4727,7 +4727,7 @@ process_selection_request (MetaDisplay *display, { if (event->xselectionrequest.property == None) event->xselectionrequest.property = event->xselectionrequest.target; - + if (convert_property (display, screen, event->xselectionrequest.requestor, event->xselectionrequest.target, @@ -4752,25 +4752,25 @@ process_selection_clear (MetaDisplay *display, screen = find_screen_for_selection (display, event->xselectionclear.window, event->xselectionclear.selection); - + if (screen != NULL) { meta_verbose ("Got selection clear for screen %d on display %s\n", screen->number, display->name); - - meta_display_unmanage_screen (display, + + meta_display_unmanage_screen (display, screen, event->xselectionclear.time); /* display and screen may both be invalid memory... */ - + return; } { char *str; - + meta_error_trap_push (display); str = XGetAtomName (display->xdisplay, event->xselectionclear.selection); @@ -4790,9 +4790,9 @@ meta_display_unmanage_screen (MetaDisplay *display, { meta_verbose ("Unmanaging screen %d on display %s\n", screen->number, display->name); - + g_return_if_fail (g_slist_find (display->screens, screen) != NULL); - + meta_screen_free (screen, timestamp); display->screens = g_slist_remove (display->screens, screen); @@ -4816,7 +4816,7 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display, while (tmp != NULL) { meta_window_free (tmp->data, timestamp); - + tmp = tmp->next; } g_slist_free (winlist); @@ -4846,7 +4846,7 @@ meta_display_devirtualize_modifiers (MetaDisplay *display, unsigned int *mask) { *mask = 0; - + if (modifiers & META_VIRTUAL_SHIFT_MASK) *mask |= ShiftMask; if (modifiers & META_VIRTUAL_CONTROL_MASK) @@ -4866,20 +4866,20 @@ meta_display_devirtualize_modifiers (MetaDisplay *display, if (modifiers & META_VIRTUAL_MOD4_MASK) *mask |= Mod4Mask; if (modifiers & META_VIRTUAL_MOD5_MASK) - *mask |= Mod5Mask; + *mask |= Mod5Mask; } static void update_window_grab_modifiers (MetaDisplay *display) - + { MetaVirtualModifier virtual_mods; unsigned int mods; - + virtual_mods = meta_prefs_get_mouse_button_mods (); meta_display_devirtualize_modifiers (display, virtual_mods, &mods); - + display->window_grab_modifiers = mods; } @@ -4888,7 +4888,7 @@ prefs_changed_callback (MetaPreference pref, void *data) { MetaDisplay *display = data; - + /* It may not be obvious why we regrab on focus mode * change; it's because we handle focus clicks a * bit differently for the different focus modes. @@ -4899,9 +4899,9 @@ prefs_changed_callback (MetaPreference pref, MetaDisplay *display = data; GSList *windows; GSList *tmp; - + windows = meta_display_list_windows (display); - + /* Ungrab all */ tmp = windows; while (tmp != NULL) @@ -4980,13 +4980,13 @@ meta_display_increment_focus_sentinel (MetaDisplay *display) unsigned long data[1]; data[0] = meta_display_get_current_time (display); - + XChangeProperty (display->xdisplay, ((MetaScreen*) display->screens->data)->xroot, display->atom__METACITY_SENTINEL, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); - + display->sentinel_counter += 1; } @@ -5035,7 +5035,7 @@ sanity_check_timestamps (MetaDisplay *display, while (tmp != NULL) { MetaWindow *window = tmp->data; - + if (XSERVER_TIME_IS_BEFORE (timestamp, window->net_wm_user_time)) { meta_warning ("%s appears to be one of the offending windows " @@ -5043,7 +5043,7 @@ sanity_check_timestamps (MetaDisplay *display, window->desc, window->net_wm_user_time); window->net_wm_user_time = timestamp; } - + tmp = tmp->next; } @@ -5058,7 +5058,7 @@ timestamp_too_old (MetaDisplay *display, { /* FIXME: If Soeren's suggestion in bug 151984 is implemented, it will allow * us to sanity check the timestamp here and ensure it doesn't correspond to - * a future time (though we would want to rename to + * a future time (though we would want to rename to * timestamp_too_old_or_in_future). */ @@ -5104,7 +5104,7 @@ timestamp_too_old (MetaDisplay *display, } void -meta_display_set_input_focus_window (MetaDisplay *display, +meta_display_set_input_focus_window (MetaDisplay *display, MetaWindow *window, gboolean focus_frame, guint32 timestamp) @@ -5128,7 +5128,7 @@ meta_display_set_input_focus_window (MetaDisplay *display, } void -meta_display_focus_the_no_focus_window (MetaDisplay *display, +meta_display_focus_the_no_focus_window (MetaDisplay *display, MetaScreen *screen, guint32 timestamp) { @@ -5199,7 +5199,7 @@ meta_display_get_focus_window (MetaDisplay *display) } #ifdef HAVE_COMPOSITE_EXTENSIONS -int +int meta_display_get_damage_event_base (MetaDisplay *display) { return display->damage_event_base; diff --git a/src/core/edge-resistance.c b/src/core/edge-resistance.c index bd2d551d..20032df0 100644 --- a/src/core/edge-resistance.c +++ b/src/core/edge-resistance.c @@ -2,9 +2,9 @@ /* Edge resistance for move/resize operations */ -/* +/* * Copyright (C) 2005, 2006 Elijah Newren - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -244,8 +244,8 @@ find_nearest_position (const GArray *edges, { edge = g_array_index (edges, MetaEdge*, i); compare = horizontal ? edge->rect.x : edge->rect.y; - - edges_align = horizontal ? + + edges_align = horizontal ? meta_rectangle_vert_overlap (&edge->rect, new_rect) : meta_rectangle_horiz_overlap (&edge->rect, new_rect); @@ -268,8 +268,8 @@ find_nearest_position (const GArray *edges, { edge = g_array_index (edges, MetaEdge*, i); compare = horizontal ? edge->rect.x : edge->rect.y; - - edges_align = horizontal ? + + edges_align = horizontal ? meta_rectangle_vert_overlap (&edge->rect, new_rect) : meta_rectangle_horiz_overlap (&edge->rect, new_rect); @@ -432,7 +432,7 @@ apply_edge_resistance (MetaWindow *window, if (!resistance_data->timeout_setup && timeout_length_ms != 0) { - resistance_data->timeout_id = + resistance_data->timeout_id = g_timeout_add (timeout_length_ms, edge_resistance_timeout, resistance_data); @@ -533,7 +533,7 @@ apply_edge_snapping (int old_pos, * display->grab_edge_resistance_data MUST already be setup or calling this * function will cause a crash. */ -static gboolean +static gboolean apply_edge_resistance_to_each_side (MetaDisplay *display, MetaWindow *window, const MetaRectangle *old_outer, @@ -653,7 +653,7 @@ apply_edge_resistance_to_each_side (MetaDisplay *display, } /* Determine whether anything changed, and save the changes */ - modified_rect = meta_rect (new_left, + modified_rect = meta_rect (new_left, new_top, new_right - new_left, new_bottom - new_top); @@ -748,7 +748,7 @@ meta_display_cleanup_edges (MetaDisplay *display) } static int -stupid_sort_requiring_extra_pointer_dereference (gconstpointer a, +stupid_sort_requiring_extra_pointer_dereference (gconstpointer a, gconstpointer b) { const MetaEdge * const *a_edge = a; @@ -773,7 +773,7 @@ cache_edges (MetaDisplay *display, #ifdef WITH_VERBOSE_MODE if (meta_is_verbose()) { - int max_edges = MAX (MAX( g_list_length (window_edges), + int max_edges = MAX (MAX( g_list_length (window_edges), g_list_length (xinerama_edges)), g_list_length (screen_edges)); char big_buffer[(EDGE_LENGTH+2)*max_edges]; @@ -910,13 +910,13 @@ cache_edges (MetaDisplay *display, * avoided this sort by sticking them into the array with some simple * merging of the lists). */ - g_array_sort (display->grab_edge_resistance_data->left_edges, + g_array_sort (display->grab_edge_resistance_data->left_edges, stupid_sort_requiring_extra_pointer_dereference); - g_array_sort (display->grab_edge_resistance_data->right_edges, + g_array_sort (display->grab_edge_resistance_data->right_edges, stupid_sort_requiring_extra_pointer_dereference); - g_array_sort (display->grab_edge_resistance_data->top_edges, + g_array_sort (display->grab_edge_resistance_data->top_edges, stupid_sort_requiring_extra_pointer_dereference); - g_array_sort (display->grab_edge_resistance_data->bottom_edges, + g_array_sort (display->grab_edge_resistance_data->bottom_edges, stupid_sort_requiring_extra_pointer_dereference); } @@ -953,7 +953,7 @@ meta_display_compute_resistance_and_snapping_edges (MetaDisplay *display) /* * 1st: Get the list of relevant windows, from bottom to top */ - stacked_windows = + stacked_windows = meta_stack_list_windows (display->grab_screen->stack, display->grab_screen->active_workspace); @@ -975,7 +975,7 @@ meta_display_compute_resistance_and_snapping_edges (MetaDisplay *display) new_rect = g_new (MetaRectangle, 1); meta_window_get_outer_rect (cur_window, new_rect); obscuring_windows = g_slist_prepend (obscuring_windows, new_rect); - window_stacking = + window_stacking = g_slist_prepend (window_stacking, GINT_TO_POINTER (stack_position)); } @@ -1015,7 +1015,7 @@ meta_display_compute_resistance_and_snapping_edges (MetaDisplay *display) * is offscreen (we also don't care about parts of edges covered * by other windows or DOCKS, but that's handled below). */ - meta_rectangle_intersect (&cur_rect, + meta_rectangle_intersect (&cur_rect, &display->grab_screen->rect, &reduced); @@ -1041,7 +1041,7 @@ meta_display_compute_resistance_and_snapping_edges (MetaDisplay *display) new_edge->side_type = META_SIDE_LEFT; new_edge->edge_type = META_EDGE_WINDOW; new_edges = g_list_prepend (new_edges, new_edge); - + /* Top side of this window is resistance for the bottom edge of * the window being moved. */ @@ -1066,7 +1066,7 @@ meta_display_compute_resistance_and_snapping_edges (MetaDisplay *display) /* Update the remaining windows to only those at a higher * stacking position than this one. */ - while (rem_win_stacking && + while (rem_win_stacking && stack_position >= GPOINTER_TO_INT (rem_win_stacking->data)) { rem_windows = rem_windows->next; @@ -1074,7 +1074,7 @@ meta_display_compute_resistance_and_snapping_edges (MetaDisplay *display) } /* Remove edge portions overlapped by rem_windows and rem_docks */ - new_edges = + new_edges = meta_rectangle_remove_intersections_with_boxes_from_edges ( new_edges, rem_windows); @@ -1096,7 +1096,7 @@ meta_display_compute_resistance_and_snapping_edges (MetaDisplay *display) /* FIXME: Shouldn't there be a helper function to make this one line of code * to free a list instead of four ugly ones? */ - g_slist_foreach (obscuring_windows, + g_slist_foreach (obscuring_windows, (void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */ NULL); g_slist_free (obscuring_windows); @@ -1203,7 +1203,7 @@ meta_window_edge_resistance_for_move (MetaWindow *window, else smaller_y_change = bottom_change; - *new_x = old_x + smaller_x_change + + *new_x = old_x + smaller_x_change + (BOX_LEFT (*reference) - BOX_LEFT (old_outer)); *new_y = old_y + smaller_y_change + (BOX_TOP (*reference) - BOX_TOP (old_outer)); @@ -1247,7 +1247,7 @@ meta_window_edge_resistance_for_resize (MetaWindow *window, } proposed_outer_width = old_outer.width + (*new_width - old_width); proposed_outer_height = old_outer.height + (*new_height - old_height); - meta_rectangle_resize_with_gravity (&old_outer, + meta_rectangle_resize_with_gravity (&old_outer, &new_outer, gravity, proposed_outer_width, diff --git a/src/core/edge-resistance.h b/src/core/edge-resistance.h index c8584902..caf56bb8 100644 --- a/src/core/edge-resistance.h +++ b/src/core/edge-resistance.h @@ -2,9 +2,9 @@ /* Edge resistance for move/resize operations */ -/* +/* * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/effects.c b/src/core/effects.c index 532cdda0..87235098 100644 --- a/src/core/effects.c +++ b/src/core/effects.c @@ -2,7 +2,7 @@ /** * \file effects.c "Special effects" other than compositor effects. - * + * * Before we had a serious compositor, we supported swooping * rectangles for minimising and so on. These are still supported * today, even when the compositor is enabled. The file contains two @@ -36,9 +36,9 @@ * In svn r3769 this was made explicit. */ -/* +/* * Copyright (C) 2001 Anders Carlsson, Havoc Pennington - * + * * 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; either version 2 of the @@ -48,7 +48,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -95,7 +95,7 @@ typedef struct MetaRectangle start_rect; MetaRectangle end_rect; - + } BoxAnimationContext; /** @@ -129,7 +129,7 @@ struct MetaEffect MetaMinimizeEffect minimize; /* ... and theoretically anything else */ } u; - + MetaEffectPriv *priv; }; @@ -181,7 +181,7 @@ effect_free (MetaEffect *effect) { if (effect->priv->finished) effect->priv->finished (effect->priv->finished_data); - + g_free (effect->priv); g_free (effect); } @@ -196,7 +196,7 @@ meta_effect_run_focus (MetaWindow *window, g_return_if_fail (window != NULL); effect = create_effect (META_EFFECT_FOCUS, window, finished, data); - + run_handler (effect); } @@ -211,7 +211,7 @@ meta_effect_run_minimize (MetaWindow *window, g_return_if_fail (window != NULL); g_return_if_fail (icon_rect != NULL); - + effect = create_effect (META_EFFECT_MINIMIZE, window, finished, data); effect->u.minimize.window_rect = *window_rect; @@ -231,7 +231,7 @@ meta_effect_run_unminimize (MetaWindow *window, g_return_if_fail (window != NULL); g_return_if_fail (icon_rect != NULL); - + effect = create_effect (META_EFFECT_UNMINIMIZE, window, finished, data); effect->u.minimize.window_rect = *window_rect; @@ -246,7 +246,7 @@ meta_effect_run_close (MetaWindow *window, gpointer data) { MetaEffect *effect; - + g_return_if_fail (window != NULL); effect = create_effect (META_EFFECT_CLOSE, window, @@ -258,7 +258,7 @@ meta_effect_run_close (MetaWindow *window, /* old ugly minimization effect */ -#ifdef HAVE_SHAPE +#ifdef HAVE_SHAPE static void update_wireframe_window (MetaDisplay *display, Window xwindow, @@ -270,14 +270,14 @@ update_wireframe_window (MetaDisplay *display, rect->width, rect->height); #define OUTLINE_WIDTH 3 - + if (rect->width > OUTLINE_WIDTH * 2 && rect->height > OUTLINE_WIDTH * 2) { XRectangle xrect; Region inner_xregion; Region outer_xregion; - + inner_xregion = XCreateRegion (); outer_xregion = XCreateRegion (); @@ -285,21 +285,21 @@ update_wireframe_window (MetaDisplay *display, xrect.y = 0; xrect.width = rect->width; xrect.height = rect->height; - + XUnionRectWithRegion (&xrect, outer_xregion, outer_xregion); - + xrect.x += OUTLINE_WIDTH; xrect.y += OUTLINE_WIDTH; xrect.width -= OUTLINE_WIDTH * 2; - xrect.height -= OUTLINE_WIDTH * 2; - + xrect.height -= OUTLINE_WIDTH * 2; + XUnionRectWithRegion (&xrect, inner_xregion, inner_xregion); XSubtractRegion (outer_xregion, inner_xregion, outer_xregion); XShapeCombineRegion (display->xdisplay, xwindow, ShapeBounding, 0, 0, outer_xregion, ShapeSet); - + XDestroyRegion (outer_xregion); XDestroyRegion (inner_xregion); } @@ -320,7 +320,7 @@ static void graphics_sync (BoxAnimationContext *context) { XImage *image; - + image = XGetImage (context->screen->display->xdisplay, context->screen->xroot, 0, 0, 1, 1, @@ -336,7 +336,7 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context) GTimeVal current_time; MetaRectangle draw_rect; double fraction; - + #ifndef HAVE_SHAPE if (!context->first_time) { @@ -353,12 +353,12 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context) #endif /* !HAVE_SHAPE */ g_get_current_time (¤t_time); - + /* We use milliseconds for all times */ elapsed = ((((double)current_time.tv_sec - context->start_time.tv_sec) * G_USEC_PER_SEC + (current_time.tv_usec - context->start_time.tv_usec))) / 1000.0; - + if (elapsed < 0) { /* Probably the system clock was set backwards? */ @@ -380,22 +380,22 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context) #endif /* !HAVE_SHAPE */ graphics_sync (context); - + g_free (context); return FALSE; } g_assert (context->millisecs_duration > 0.0); fraction = elapsed / context->millisecs_duration; - + draw_rect = context->start_rect; - + /* Now add a delta proportional to elapsed time. */ draw_rect.x += (context->end_rect.x - context->start_rect.x) * fraction; draw_rect.y += (context->end_rect.y - context->start_rect.y) * fraction; draw_rect.width += (context->end_rect.width - context->start_rect.width) * fraction; draw_rect.height += (context->end_rect.height - context->start_rect.height) * fraction; - + /* don't confuse X or gdk-pixbuf with bogus rectangles */ if (draw_rect.width < 1) draw_rect.width = 1; @@ -415,15 +415,15 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context) context->gc, draw_rect.x, draw_rect.y, draw_rect.width, draw_rect.height); - + #endif /* !HAVE_SHAPE */ /* kick changes onto the server */ graphics_sync (context); - + return TRUE; } - + void draw_box_animation (MetaScreen *screen, MetaRectangle *initial_rect, @@ -437,12 +437,12 @@ draw_box_animation (MetaScreen *screen, #else XGCValues gc_values; #endif - + g_return_if_fail (seconds_duration > 0.0); if (g_getenv ("METACITY_DEBUG_EFFECTS")) seconds_duration *= 10; /* slow things down */ - + /* Create the animation context */ context = g_new0 (BoxAnimationContext, 1); @@ -489,7 +489,7 @@ draw_box_animation (MetaScreen *screen, screen->xroot, GCSubwindowMode | GCFunction, &gc_values); - + /* Grab the X server to avoid screen dirt */ meta_display_grab (context->screen->display); meta_ui_push_delay_exposes (context->screen->ui); @@ -499,7 +499,7 @@ draw_box_animation (MetaScreen *screen, * so that the animation doesn't get truncated. */ g_get_current_time (&context->start_time); - + /* Add the timeout - a short one, could even use an idle, * but this is maybe more CPU-friendly. */ @@ -508,7 +508,7 @@ draw_box_animation (MetaScreen *screen, context); /* kick changes onto the server */ - XFlush (context->screen->display->xdisplay); + XFlush (context->screen->display->xdisplay); } void @@ -519,9 +519,9 @@ meta_effects_begin_wireframe (MetaScreen *screen, { /* Grab the X server to avoid screen dirt */ meta_display_grab (screen->display); - meta_ui_push_delay_exposes (screen->ui); + meta_ui_push_delay_exposes (screen->ui); - meta_effects_update_wireframe (screen, + meta_effects_update_wireframe (screen, NULL, -1, -1, rect, width, height); } @@ -539,7 +539,7 @@ draw_xor_rect (MetaScreen *screen, XSegment segments[8]; MetaRectangle shrunk_rect; int i; - + #define LINE_WIDTH META_WIREFRAME_XOR_LINE_WIDTH /* We don't want the wireframe going outside the window area. @@ -569,14 +569,14 @@ draw_xor_rect (MetaScreen *screen, XGCValues gc_values = { 0 }; if (XGetGCValues (screen->display->xdisplay, - screen->root_xor_gc, + screen->root_xor_gc, GCFont, &gc_values)) { char *text; int text_length; XFontStruct *font_struct; - int text_width, text_height; + int text_width, text_height; int box_x, box_y; int box_width, box_height; @@ -589,7 +589,7 @@ draw_xor_rect (MetaScreen *screen, text_length = strlen (text); text_width = text_length * font_struct->max_bounds.width; - text_height = font_struct->max_bounds.descent + + text_height = font_struct->max_bounds.descent + font_struct->max_bounds.ascent; box_width = text_width + 2 * LINE_WIDTH; @@ -607,7 +607,7 @@ draw_xor_rect (MetaScreen *screen, screen->root_xor_gc, box_x, box_y, box_width, box_height); - XDrawString (screen->display->xdisplay, + XDrawString (screen->display->xdisplay, screen->xroot, screen->root_xor_gc, box_x + LINE_WIDTH, @@ -632,7 +632,7 @@ draw_xor_rect (MetaScreen *screen, segments[0].x1 = shrunk_rect.x + shrunk_rect.width / 3; segments[0].y1 = shrunk_rect.y + LINE_WIDTH / 2 + LINE_WIDTH % 2; segments[0].x2 = segments[0].x1; - segments[0].y2 = shrunk_rect.y + shrunk_rect.height - LINE_WIDTH / 2; + segments[0].y2 = shrunk_rect.y + shrunk_rect.height - LINE_WIDTH / 2; segments[1] = segments[0]; segments[1].x1 = shrunk_rect.x + (shrunk_rect.width / 3) * 2; @@ -650,7 +650,7 @@ draw_xor_rect (MetaScreen *screen, segments[3] = segments[2]; segments[3].x1 = segments[2].x2 + LINE_WIDTH; segments[3].x2 = segments[1].x1 - LINE_WIDTH / 2; - + segments[4] = segments[3]; segments[4].x1 = segments[3].x2 + LINE_WIDTH; segments[4].x2 = shrunk_rect.x + shrunk_rect.width - LINE_WIDTH / 2; @@ -666,7 +666,7 @@ draw_xor_rect (MetaScreen *screen, segments[i].y2 = segments[i].y1; ++i; } - + XDrawSegments (screen->display->xdisplay, screen->xroot, screen->root_xor_gc, @@ -685,10 +685,10 @@ meta_effects_update_wireframe (MetaScreen *screen, { if (old_rect) draw_xor_rect (screen, old_rect, old_width, old_height); - + if (new_rect) draw_xor_rect (screen, new_rect, new_width, new_height); - + XFlush (screen->display->xdisplay); } @@ -698,10 +698,10 @@ meta_effects_end_wireframe (MetaScreen *screen, int old_width, int old_height) { - meta_effects_update_wireframe (screen, + meta_effects_update_wireframe (screen, old_rect, old_width, old_height, NULL, -1, -1); - + meta_display_ungrab (screen->display); meta_ui_pop_delay_exposes (screen->ui); } diff --git a/src/core/effects.h b/src/core/effects.h index 9d0052e1..d0d01931 100644 --- a/src/core/effects.h +++ b/src/core/effects.h @@ -2,7 +2,7 @@ /** * \file effects.h "Special effects" other than compositor effects. - * + * * Before we had a serious compositor, we supported swooping * rectangles for minimising and so on. These are still supported * today, even when the compositor is enabled. The file contains two @@ -23,9 +23,9 @@ * it can be found in svn r3769. */ -/* +/* * Copyright (C) 2001 Anders Carlsson, Havoc Pennington - * + * * 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; either version 2 of the @@ -35,7 +35,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/errors.c b/src/core/errors.c index 692d8fc7..d1b8a234 100644 --- a/src/core/errors.c +++ b/src/core/errors.c @@ -2,10 +2,10 @@ /* Metacity X error handling */ -/* +/* * Copyright (C) 2001 Havoc Pennington, error trapping inspired by GDK * code copyrighted by the GTK team. - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/eventqueue.c b/src/core/eventqueue.c index fc943e10..501d7d7b 100644 --- a/src/core/eventqueue.c +++ b/src/core/eventqueue.c @@ -2,10 +2,10 @@ /* Metacity X event source for main loop */ -/* +/* * Copyright (C) 2001 Havoc Pennington (based on GDK code (C) Owen * Taylor, Red Hat Inc.) - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -55,7 +55,7 @@ meta_event_queue_new (Display *display, MetaEventQueueFunc func, gpointer data) source = g_source_new (&eq_funcs, sizeof (MetaEventQueue)); eq = (MetaEventQueue*) source; - + eq->connection_fd = ConnectionNumber (display); eq->poll_fd.fd = eq->connection_fd; eq->poll_fd.events = G_IO_IN; @@ -63,13 +63,13 @@ meta_event_queue_new (Display *display, MetaEventQueueFunc func, gpointer data) eq->events = g_queue_new (); eq->display = display; - + g_source_set_priority (source, G_PRIORITY_DEFAULT); g_source_add_poll (source, &eq->poll_fd); g_source_set_can_recurse (source, TRUE); g_source_set_callback (source, (GSourceFunc) func, data, NULL); - + g_source_attach (source, NULL); g_source_unref (source); @@ -82,7 +82,7 @@ meta_event_queue_free (MetaEventQueue *eq) GSource *source; source = (GSource*) eq; - + g_source_destroy (source); } @@ -100,7 +100,7 @@ eq_queue_events (MetaEventQueue *eq) while (XPending (eq->display)) { XEvent *copy; - + XNextEvent (eq->display, &xevent); copy = g_new (XEvent, 1); @@ -110,20 +110,20 @@ eq_queue_events (MetaEventQueue *eq) } } -static gboolean +static gboolean eq_prepare (GSource *source, gint *timeout) { MetaEventQueue *eq; eq = (MetaEventQueue*) source; - + *timeout = -1; return eq_events_pending (eq); } -static gboolean -eq_check (GSource *source) +static gboolean +eq_check (GSource *source) { MetaEventQueue *eq; @@ -135,13 +135,13 @@ eq_check (GSource *source) return FALSE; } -static gboolean +static gboolean eq_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { MetaEventQueue *eq; eq = (MetaEventQueue*) source; - + eq_queue_events (eq); if (eq->events->length > 0) @@ -151,12 +151,12 @@ eq_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) event = g_queue_pop_head (eq->events); func = (MetaEventQueueFunc) callback; - + (* func) (event, user_data); g_free (event); } - + return TRUE; } @@ -170,7 +170,7 @@ eq_destroy (GSource *source) while (eq->events->length > 0) { XEvent *event; - + event = g_queue_pop_head (eq->events); g_free (event); diff --git a/src/core/eventqueue.h b/src/core/eventqueue.h index ebe4cb0d..db4036f5 100644 --- a/src/core/eventqueue.h +++ b/src/core/eventqueue.h @@ -2,9 +2,9 @@ /* Metacity X event source for main loop */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/frame-private.h b/src/core/frame-private.h index 5518cd7d..fe9cdb77 100644 --- a/src/core/frame-private.h +++ b/src/core/frame-private.h @@ -2,9 +2,9 @@ /* Metacity X window decorations */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/frame.c b/src/core/frame.c index 117b75ac..968f0153 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -2,11 +2,11 @@ /* Metacity X window decorations */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2003, 2004 Red Hat, Inc. * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -46,13 +46,13 @@ meta_window_ensure_frame (MetaWindow *window) MetaFrame *frame; XSetWindowAttributes attrs; Visual *visual; - + if (window->frame) return; - + /* See comment below for why this is required. */ meta_display_grab (window->display); - + frame = g_new (MetaFrame, 1); frame->window = window; @@ -68,7 +68,7 @@ meta_window_ensure_frame (MetaWindow *window) frame->mapped = FALSE; frame->need_reapply_frame_shape = TRUE; frame->is_flashing = FALSE; - + meta_verbose ("Framing window %s: visual %s default, depth %d default depth %d\n", window->desc, XVisualIDFromVisual (window->xvisual) == @@ -78,7 +78,7 @@ meta_window_ensure_frame (MetaWindow *window) meta_verbose ("Frame geometry %d,%d %dx%d\n", frame->rect.x, frame->rect.y, frame->rect.width, frame->rect.height); - + /* Default depth/visual handles clients with weird visuals; they can * always be children of the root depth/visual obviously, but * e.g. DRI games can't be children of a parent that has the same @@ -87,7 +87,7 @@ meta_window_ensure_frame (MetaWindow *window) * We look for an ARGB visual if we can find one, otherwise use * the default of NULL. */ - + /* Special case for depth 32 windows (assumed to be ARGB), * we use the window's visual. Otherwise we just use the system visual. */ @@ -95,7 +95,7 @@ meta_window_ensure_frame (MetaWindow *window) visual = window->xvisual; else visual = NULL; - + frame->xwindow = meta_ui_create_frame_window (window->screen->ui, window->display->xdisplay, visual, @@ -109,7 +109,7 @@ meta_window_ensure_frame (MetaWindow *window) attrs.event_mask = EVENT_MASK; XChangeWindowAttributes (window->display->xdisplay, frame->xwindow, CWEventMask, &attrs); - + meta_display_register_x_window (window->display, &frame->xwindow, window); /* Now that frame->xwindow is registered with window, we can set its @@ -146,10 +146,10 @@ meta_window_ensure_frame (MetaWindow *window) window->rect.y); /* FIXME handle this error */ meta_error_trap_pop (window->display, FALSE); - + /* stick frame to the window */ window->frame = frame; - + if (window->title) meta_ui_set_frame_title (window->screen->ui, window->frame->xwindow, @@ -165,7 +165,7 @@ meta_window_ensure_frame (MetaWindow *window) frame->rect.height, frame->window->has_shape); frame->need_reapply_frame_shape = FALSE; - + meta_display_ungrab (window->display); } @@ -173,16 +173,16 @@ void meta_window_destroy_frame (MetaWindow *window) { MetaFrame *frame; - + if (window->frame == NULL) return; meta_verbose ("Unframing window %s\n", window->desc); - + frame = window->frame; - + meta_bell_notify_frame_destroy (frame); - + /* Unparent the client window; it may be destroyed, * thus the error trap. */ @@ -212,14 +212,14 @@ meta_window_destroy_frame (MetaWindow *window) meta_display_unregister_x_window (window->display, frame->xwindow); - + window->frame = NULL; /* Move keybindings to window instead of frame */ meta_window_grab_keys (window); - + g_free (frame); - + /* Put our state back where it should be */ meta_window_queue (window, META_QUEUE_CALC_SHOWING); meta_window_queue (window, META_QUEUE_MOVE_RESIZE); @@ -242,20 +242,20 @@ meta_frame_get_flags (MetaFrame *frame) else { flags |= META_FRAME_ALLOWS_MENU; - + if (frame->window->has_close_func) flags |= META_FRAME_ALLOWS_DELETE; - + if (frame->window->has_maximize_func) flags |= META_FRAME_ALLOWS_MAXIMIZE; - + if (frame->window->has_minimize_func) flags |= META_FRAME_ALLOWS_MINIMIZE; - + if (frame->window->has_shade_func) flags |= META_FRAME_ALLOWS_SHADE; - } - + } + if (META_WINDOW_ALLOWS_MOVE (frame->window)) flags |= META_FRAME_ALLOWS_MOVE; @@ -264,7 +264,7 @@ meta_frame_get_flags (MetaFrame *frame) if (META_WINDOW_ALLOWS_VERTICAL_RESIZE (frame->window)) flags |= META_FRAME_ALLOWS_VERTICAL_RESIZE; - + if (meta_window_appears_focused (frame->window)) flags |= META_FRAME_HAS_FOCUS; @@ -294,7 +294,7 @@ meta_frame_get_flags (MetaFrame *frame) if (frame->window->wm_state_above) flags |= META_FRAME_ABOVE; - + return flags; } @@ -372,7 +372,7 @@ meta_frame_sync_to_window (MetaFrame *frame, * shaped, which might be more visible. */ update_shape (frame); - + meta_ui_move_resize_frame (frame->window->screen->ui, frame->xwindow, frame->rect.x, @@ -413,7 +413,7 @@ meta_frame_set_screen_cursor (MetaFrame *frame, if (cursor == META_CURSOR_DEFAULT) XUndefineCursor (frame->window->display->xdisplay, frame->xwindow); else - { + { xcursor = meta_display_create_x_cursor (frame->window->display, cursor); XDefineCursor (frame->window->display->xdisplay, frame->xwindow, xcursor); XFlush (frame->window->display->xdisplay); diff --git a/src/core/group-private.h b/src/core/group-private.h index ab6cf2ec..55322c3e 100644 --- a/src/core/group-private.h +++ b/src/core/group-private.h @@ -2,9 +2,9 @@ /* Metacity window group private header */ -/* +/* * Copyright (C) 2002 Red Hat Inc. - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/group-props.c b/src/core/group-props.c index 521ffbd6..6cc17818 100644 --- a/src/core/group-props.c +++ b/src/core/group-props.c @@ -2,9 +2,9 @@ /* MetaGroup property handling */ -/* +/* * Copyright (C) 2002 Red Hat, Inc. - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -65,16 +65,16 @@ meta_group_reload_properties (MetaGroup *group, g_return_if_fail (properties != NULL); g_return_if_fail (n_properties > 0); - + values = g_new0 (MetaPropValue, n_properties); - + i = 0; while (i < n_properties) { init_prop_value (group->display, properties[i], &values[i]); ++i; } - + meta_prop_get_values (group->display, group->group_leader, values, n_properties); @@ -82,12 +82,12 @@ meta_group_reload_properties (MetaGroup *group, while (i < n_properties) { reload_prop_value (group, &values[i]); - + ++i; } meta_prop_free_values (values, n_properties); - + g_free (values); } @@ -97,11 +97,11 @@ init_prop_value (MetaDisplay *display, Atom property, MetaPropValue *value) { - MetaGroupPropHooks *hooks; + MetaGroupPropHooks *hooks; value->type = META_PROP_VALUE_INVALID; value->atom = None; - + hooks = find_hooks (display, property); if (hooks && hooks->init_func != NULL) (* hooks->init_func) (display, property, value); @@ -111,8 +111,8 @@ static void reload_prop_value (MetaGroup *group, MetaPropValue *value) { - MetaGroupPropHooks *hooks; - + MetaGroupPropHooks *hooks; + hooks = find_hooks (group->display, value->atom); if (hooks && hooks->reload_func != NULL) (* hooks->reload_func) (group, value); @@ -133,7 +133,7 @@ reload_wm_client_machine (MetaGroup *group, { g_free (group->wm_client_machine); group->wm_client_machine = NULL; - + if (value->type != META_PROP_VALUE_INVALID) group->wm_client_machine = g_strdup (value->v.str); @@ -156,10 +156,10 @@ reload_net_startup_id (MetaGroup *group, { g_free (group->startup_id); group->startup_id = NULL; - + if (value->type != META_PROP_VALUE_INVALID) group->startup_id = g_strdup (value->v.str); - + meta_verbose ("Group has startup id \"%s\"\n", group->startup_id ? group->startup_id : "unset"); } @@ -171,12 +171,12 @@ meta_display_init_group_prop_hooks (MetaDisplay *display) { int i; MetaGroupPropHooks *hooks; - + g_assert (display->group_prop_hooks == NULL); - display->group_prop_hooks = g_new0 (MetaGroupPropHooks, N_HOOKS); + display->group_prop_hooks = g_new0 (MetaGroupPropHooks, N_HOOKS); hooks = display->group_prop_hooks; - + i = 0; hooks[i].property = display->atom_WM_CLIENT_MACHINE; @@ -193,7 +193,7 @@ meta_display_init_group_prop_hooks (MetaDisplay *display) hooks[i].init_func = init_net_startup_id; hooks[i].reload_func = reload_net_startup_id; ++i; - + if (i != N_HOOKS) { g_error ("Initialized %d group hooks should have been %d\n", i, N_HOOKS); @@ -204,7 +204,7 @@ void meta_display_free_group_prop_hooks (MetaDisplay *display) { g_assert (display->group_prop_hooks != NULL); - + g_free (display->group_prop_hooks); display->group_prop_hooks = NULL; } @@ -218,13 +218,13 @@ find_hooks (MetaDisplay *display, /* FIXME we could sort the array and do binary search or * something */ - + i = 0; while (i < N_HOOKS) { if (display->group_prop_hooks[i].property == property) return &display->group_prop_hooks[i]; - + ++i; } diff --git a/src/core/group-props.h b/src/core/group-props.h index 6c264e2e..9ae84d2a 100644 --- a/src/core/group-props.h +++ b/src/core/group-props.h @@ -2,9 +2,9 @@ /* MetaGroup property handling */ -/* +/* * Copyright (C) 2002 Red Hat, Inc. - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/group.c b/src/core/group.c index aed11b5b..66aee174 100644 --- a/src/core/group.c +++ b/src/core/group.c @@ -2,10 +2,10 @@ /* Metacity window groups */ -/* +/* * Copyright (C) 2002 Red Hat Inc. * Copyright (C) 2003 Rob Adams - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -34,16 +34,16 @@ meta_group_new (MetaDisplay *display, #define N_INITIAL_PROPS 3 Atom initial_props[N_INITIAL_PROPS]; int i; - + g_assert (N_INITIAL_PROPS == (int) G_N_ELEMENTS (initial_props)); - + group = g_new0 (MetaGroup, 1); group->display = display; group->windows = NULL; group->group_leader = group_leader; group->refcount = 1; /* owned by caller, hash table has only weak ref */ - + if (display->groups_by_leader == NULL) display->groups_by_leader = g_hash_table_new (meta_unsigned_long_hash, meta_unsigned_long_equal); @@ -60,13 +60,13 @@ meta_group_new (MetaDisplay *display, initial_props[i++] = display->atom__NET_WM_PID; initial_props[i++] = display->atom__NET_STARTUP_ID; g_assert (N_INITIAL_PROPS == i); - + meta_group_reload_properties (group, initial_props, N_INITIAL_PROPS); meta_topic (META_DEBUG_GROUPS, "Created new group with leader 0x%lx\n", group->group_leader); - + return group; } @@ -80,10 +80,10 @@ meta_group_unref (MetaGroup *group) { meta_topic (META_DEBUG_GROUPS, "Destroying group with leader 0x%lx\n", - group->group_leader); - + group->group_leader); + g_assert (group->display->groups_by_leader != NULL); - + g_hash_table_remove (group->display->groups_by_leader, &group->group_leader); @@ -96,7 +96,7 @@ meta_group_unref (MetaGroup *group) g_free (group->wm_client_machine); g_free (group->startup_id); - + g_free (group); } } @@ -117,9 +117,9 @@ meta_window_compute_group (MetaWindow* window) MetaWindow *ancestor; /* use window->xwindow if no window->xgroup_leader */ - + group = NULL; - + /* Determine the ancestor of the window; its group setting will override the * normal grouping rules; see bug 328211. */ @@ -136,7 +136,7 @@ meta_window_compute_group (MetaWindow* window) group = g_hash_table_lookup (window->display->groups_by_leader, &window->xwindow); } - + if (group != NULL) { window->group = group; @@ -153,7 +153,7 @@ meta_window_compute_group (MetaWindow* window) else group = meta_group_new (window->display, window->xwindow); - + window->group = group; } @@ -173,7 +173,7 @@ remove_window_from_group (MetaWindow *window) meta_topic (META_DEBUG_GROUPS, "Removing %s from group with leader 0x%lx\n", window->desc, window->group->group_leader); - + window->group->windows = g_slist_remove (window->group->windows, window); @@ -200,9 +200,9 @@ meta_display_lookup_group (MetaDisplay *display, Window group_leader) { MetaGroup *group; - + group = NULL; - + if (display->groups_by_leader) group = g_hash_table_lookup (display->groups_by_leader, &group_leader); @@ -221,7 +221,7 @@ meta_group_update_layers (MetaGroup *group) { GSList *tmp; GSList *frozen_stacks; - + if (group->windows == NULL) return; @@ -240,7 +240,7 @@ meta_group_update_layers (MetaGroup *group) meta_stack_update_layer (window->screen->stack, window); - + tmp = tmp->next; } diff --git a/src/core/group.h b/src/core/group.h index 253d2eff..05ceb17a 100644 --- a/src/core/group.h +++ b/src/core/group.h @@ -2,9 +2,9 @@ /* Metacity window groups */ -/* +/* * Copyright (C) 2002 Red Hat Inc. - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/iconcache.c b/src/core/iconcache.c index 70af354c..f8ee61ee 100644 --- a/src/core/iconcache.c +++ b/src/core/iconcache.c @@ -436,7 +436,7 @@ try_pixmap_and_mask (MetaDisplay *display, GDK_INTERP_BILINEAR); g_object_unref (G_OBJECT (unscaled)); - + if (*iconp && *mini_iconp) return TRUE; else @@ -534,7 +534,7 @@ clear_icon_cache (MetaIconCache *icon_cache, g_object_unref (G_OBJECT (icon_cache->mini_icon)); icon_cache->mini_icon = NULL; #endif - + icon_cache->origin = USING_NO_ICON; if (dirty_all) @@ -620,13 +620,13 @@ scaled_from_pixdata (guchar *pixdata, { GdkPixbuf *src; GdkPixbuf *dest; - + src = gdk_pixbuf_new_from_data (pixdata, GDK_COLORSPACE_RGB, TRUE, 8, w, h, w * 4, - free_pixels, + free_pixels, NULL); if (src == NULL) @@ -638,7 +638,7 @@ scaled_from_pixdata (guchar *pixdata, int size; size = MAX (w, h); - + tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, size, size); if (tmp) @@ -647,16 +647,16 @@ scaled_from_pixdata (guchar *pixdata, gdk_pixbuf_copy_area (src, 0, 0, w, h, tmp, (size - w) / 2, (size - h) / 2); - + g_object_unref (src); src = tmp; } } - + if (w != new_w || h != new_h) { dest = gdk_pixbuf_scale_simple (src, new_w, new_h, GDK_INTERP_BILINEAR); - + g_object_unref (G_OBJECT (src)); } else @@ -706,7 +706,7 @@ meta_read_icons (MetaScreen *screen, icon_cache->ideal_mini_width = ideal_mini_width; icon_cache->ideal_mini_height = ideal_mini_height; #endif - + if (!meta_icon_cache_get_icon_invalidated (icon_cache)) return FALSE; /* we have no new info to use */ @@ -743,7 +743,7 @@ meta_read_icons (MetaScreen *screen, { replace_cache (icon_cache, USING_NET_WM_ICON, *iconp, *mini_iconp); - + return TRUE; } else @@ -827,7 +827,7 @@ meta_read_icons (MetaScreen *screen, replace_cache (icon_cache, USING_FALLBACK_ICON, *iconp, *mini_iconp); - + return TRUE; } diff --git a/src/core/iconcache.h b/src/core/iconcache.h index a8630b6a..e0bf9944 100644 --- a/src/core/iconcache.h +++ b/src/core/iconcache.h @@ -2,9 +2,9 @@ /* Metacity window icons */ -/* +/* * Copyright (C) 2002 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 44c586d3..6582bef4 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1,12 +1,12 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* Metacity Keybindings */ -/* +/* Metacity Keybindings */ +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat Inc. * Copyright (C) 2003 Rob Adams * Copyright (C) 2004-2006 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -144,7 +144,7 @@ reload_keymap (MetaDisplay *display) display->min_keycode, display->max_keycode - display->min_keycode + 1, - &display->keysyms_per_keycode); + &display->keysyms_per_keycode); } static void @@ -153,7 +153,7 @@ reload_modmap (MetaDisplay *display) XModifierKeymap *modmap; int map_size; int i; - + if (display->modmap) XFreeModifiermap (display->modmap); @@ -168,7 +168,7 @@ reload_modmap (MetaDisplay *display) display->meta_mask = 0; display->hyper_mask = 0; display->super_mask = 0; - + /* there are 8 modifiers, and the first 3 are shift, shift lock, * and control */ @@ -180,7 +180,7 @@ reload_modmap (MetaDisplay *display) * see if its keysym is one we're interested in */ int keycode = modmap->modifiermap[i]; - + if (keycode >= display->min_keycode && keycode <= display->max_keycode) { @@ -193,21 +193,21 @@ reload_modmap (MetaDisplay *display) if (syms[j] != 0) { const char *str; - + str = XKeysymToString (syms[j]); meta_topic (META_DEBUG_KEYBINDINGS, "Keysym %s bound to modifier 0x%x\n", str ? str : "none", (1 << ( i / modmap->max_keypermod))); } - + if (syms[j] == XK_Num_Lock) { /* Mod1Mask is 1 << 3 for example, i.e. the * fourth modifier, i / keyspermod is the modifier * index */ - + display->num_lock_mask |= (1 << ( i / modmap->max_keypermod)); } else if (syms[j] == XK_Scroll_Lock) @@ -223,17 +223,17 @@ reload_modmap (MetaDisplay *display) syms[j] == XK_Hyper_R) { display->hyper_mask |= (1 << ( i / modmap->max_keypermod)); - } + } else if (syms[j] == XK_Meta_L || syms[j] == XK_Meta_R) { display->meta_mask |= (1 << ( i / modmap->max_keypermod)); } - + ++j; } } - + ++i; } @@ -270,7 +270,7 @@ reload_keycodes (MetaDisplay *display) if (display->key_bindings) { int i; - + i = 0; while (i < display->n_key_bindings) { @@ -279,7 +279,7 @@ reload_keycodes (MetaDisplay *display) display->key_bindings[i].keycode = keysym_to_keycode (display, display->key_bindings[i].keysym); } - + ++i; } } @@ -290,11 +290,11 @@ reload_modifiers (MetaDisplay *display) { meta_topic (META_DEBUG_KEYBINDINGS, "Reloading keycodes for binding tables\n"); - + if (display->key_bindings) { int i; - + i = 0; while (i < display->n_key_bindings) { @@ -306,8 +306,8 @@ reload_modifiers (MetaDisplay *display) " Devirtualized mods 0x%x -> 0x%x (%s)\n", display->key_bindings[i].modifiers, display->key_bindings[i].mask, - display->key_bindings[i].name); - + display->key_bindings[i].name); + ++i; } } @@ -342,7 +342,7 @@ count_bindings (const MetaKeyPref *prefs, tmp = tmp->next; } - + ++i; } @@ -377,7 +377,7 @@ rebuild_binding_table (MetaDisplay *display, { int n_bindings; int src, dest; - + n_bindings = count_bindings (prefs, n_prefs); g_free (*bindings_p); *bindings_p = g_new0 (MetaKeyBinding, n_bindings); @@ -402,7 +402,7 @@ rebuild_binding_table (MetaDisplay *display, (*bindings_p)[dest].keycode = combo->keycode; (*bindings_p)[dest].modifiers = combo->modifiers; (*bindings_p)[dest].mask = 0; - + ++dest; if (prefs[src].add_shift && @@ -411,7 +411,7 @@ rebuild_binding_table (MetaDisplay *display, meta_topic (META_DEBUG_KEYBINDINGS, "Binding %s also needs Shift grabbed\n", prefs[src].name); - + (*bindings_p)[dest].name = prefs[src].name; (*bindings_p)[dest].handler = handler; (*bindings_p)[dest].keysym = combo->keysym; @@ -419,19 +419,19 @@ rebuild_binding_table (MetaDisplay *display, (*bindings_p)[dest].modifiers = combo->modifiers | META_VIRTUAL_SHIFT_MASK; (*bindings_p)[dest].mask = 0; - + ++dest; } } - + tmp = tmp->next; } - + ++src; } g_assert (dest == n_bindings); - + *n_bindings_p = dest; meta_topic (META_DEBUG_KEYBINDINGS, @@ -444,10 +444,10 @@ rebuild_key_binding_table (MetaDisplay *display) { const MetaKeyPref *prefs; int n_prefs; - + meta_topic (META_DEBUG_KEYBINDINGS, "Rebuilding key binding table from preferences\n"); - + meta_prefs_get_key_bindings (&prefs, &n_prefs); rebuild_binding_table (display, &display->key_bindings, @@ -462,7 +462,7 @@ regrab_key_bindings (MetaDisplay *display) GSList *windows; meta_error_trap_push (display); /* for efficiency push outer trap */ - + tmp = display->screens; while (tmp != NULL) { @@ -479,10 +479,10 @@ regrab_key_bindings (MetaDisplay *display) while (tmp != NULL) { MetaWindow *w = tmp->data; - + meta_window_ungrab_keys (w); meta_window_grab_keys (w); - + tmp = tmp->next; } meta_error_trap_pop (display, FALSE); @@ -507,7 +507,7 @@ display_get_keybinding_action (MetaDisplay *display, { return meta_prefs_get_keybinding_action (display->key_bindings[i].name); } - + --i; } @@ -517,7 +517,7 @@ display_get_keybinding_action (MetaDisplay *display, void meta_display_process_mapping_event (MetaDisplay *display, XEvent *event) -{ +{ gboolean keymap_changed = FALSE; gboolean modmap_changed = FALSE; @@ -575,7 +575,7 @@ bindings_changed_callback (MetaPreference pref, MetaDisplay *display; display = data; - + switch (pref) { case META_PREF_KEYBINDINGS: @@ -624,9 +624,9 @@ meta_display_init_keys (MetaDisplay *display) reload_keycodes (display); reload_modifiers (display); - + /* Keys are actually grabbed in meta_screen_grab_keys() */ - + meta_prefs_add_listener (bindings_changed_callback, display); #ifdef HAVE_XKB @@ -642,12 +642,12 @@ void meta_display_shutdown_keys (MetaDisplay *display) { /* Note that display->xdisplay is invalid in this function */ - + meta_prefs_remove_listener (bindings_changed_callback, display); if (display->keymap) meta_XFree (display->keymap); - + if (display->modmap) XFreeModifiermap (display->modmap); g_free (display->key_bindings); @@ -657,7 +657,7 @@ static const char* keysym_name (int keysym) { const char *name; - + name = XKeysymToString (keysym); if (name == NULL) name = "(unknown)"; @@ -689,7 +689,7 @@ meta_change_keygrab (MetaDisplay *display, /* efficiency, avoid so many XSync() */ meta_error_trap_push (display); - + ignored_mask = 0; while (ignored_mask <= display->ignored_modifier_mask) { @@ -718,11 +718,11 @@ meta_change_keygrab (MetaDisplay *display, if (meta_is_debugging ()) { int result; - + result = meta_error_trap_pop_with_return (display, FALSE); - + if (grab && result != Success) - { + { if (result == BadAccess) meta_warning (_("Some other program is already using the key %s with modifiers %x as a binding\n"), keysym_name (keysym), modmask | ignored_mask); else @@ -760,7 +760,7 @@ grab_keys (MetaKeyBinding *bindings, g_assert (n_bindings == 0 || bindings != NULL); meta_error_trap_push (display); - + i = 0; while (i < n_bindings) { @@ -773,7 +773,7 @@ grab_keys (MetaKeyBinding *bindings, bindings[i].keycode, bindings[i].mask); } - + ++i; } @@ -795,10 +795,10 @@ ungrab_all_keys (MetaDisplay *display, if (meta_is_debugging ()) { int result; - + result = meta_error_trap_pop_with_return (display, FALSE); - - if (result != Success) + + if (result != Success) meta_topic (META_DEBUG_KEYBINDINGS, "Ungrabbing all keys on 0x%lx failed\n", xwindow); } @@ -852,7 +852,7 @@ meta_window_grab_keys (MetaWindow *window) window->keys_grabbed = FALSE; return; } - + if (window->keys_grabbed) { if (window->frame && !window->grab_on_frame) @@ -863,7 +863,7 @@ meta_window_grab_keys (MetaWindow *window) else return; /* already all good */ } - + grab_keys (window->display->key_bindings, window->display->n_key_bindings, window->display, @@ -920,7 +920,7 @@ grab_keyboard (MetaDisplay *display, { int result; int grab_status; - + /* Grab the keyboard, so we get key releases and all key * presses */ @@ -930,7 +930,7 @@ grab_keyboard (MetaDisplay *display, xwindow, True, GrabModeAsync, GrabModeAsync, timestamp); - + if (grab_status != GrabSuccess) { meta_error_trap_pop_with_return (display, TRUE); @@ -950,9 +950,9 @@ grab_keyboard (MetaDisplay *display, return FALSE; } } - + meta_topic (META_DEBUG_KEYBINDINGS, "Grabbed all keys\n"); - + return TRUE; } @@ -975,7 +975,7 @@ meta_screen_grab_all_keys (MetaScreen *screen, guint32 timestamp) if (screen->all_keys_grabbed) return FALSE; - + if (screen->keys_grabbed) meta_screen_ungrab_keys (screen); @@ -1011,10 +1011,10 @@ meta_window_grab_all_keys (MetaWindow *window, { Window grabwindow; gboolean retval; - + if (window->all_keys_grabbed) return FALSE; - + if (window->keys_grabbed) meta_window_ungrab_keys (window); @@ -1025,7 +1025,7 @@ meta_window_grab_all_keys (MetaWindow *window, "Focusing %s because we're grabbing all its keys\n", window->desc); meta_window_focus (window, timestamp); - + grabwindow = window->frame ? window->frame->xwindow : window->xwindow; meta_topic (META_DEBUG_KEYBINDINGS, @@ -1057,16 +1057,16 @@ meta_window_ungrab_all_keys (MetaWindow *window, guint32 timestamp) } } -static gboolean +static gboolean is_modifier (MetaDisplay *display, unsigned int keycode) { int i; int map_size; - gboolean retval = FALSE; + gboolean retval = FALSE; g_assert (display->modmap); - + map_size = 8 * display->modmap->max_keypermod; i = 0; while (i < map_size) @@ -1078,7 +1078,7 @@ is_modifier (MetaDisplay *display, } ++i; } - + return retval; } @@ -1093,7 +1093,7 @@ is_modifier (MetaDisplay *display, * mod5 = 7 */ -static gboolean +static gboolean is_specific_modifier (MetaDisplay *display, unsigned int keycode, unsigned int mask) @@ -1102,13 +1102,13 @@ is_specific_modifier (MetaDisplay *display, int end; gboolean retval = FALSE; int mod_index; - + g_assert (display->modmap); meta_topic (META_DEBUG_KEYBINDINGS, "Checking whether code 0x%x is bound to modifier 0x%x\n", keycode, mask); - + mod_index = 0; mask = mask >> 1; while (mask != 0) @@ -1119,7 +1119,7 @@ is_specific_modifier (MetaDisplay *display, meta_topic (META_DEBUG_KEYBINDINGS, "Modifier has index %d\n", mod_index); - + end = (mod_index + 1) * display->modmap->max_keypermod; i = mod_index * display->modmap->max_keypermod; while (i < end) @@ -1131,7 +1131,7 @@ is_specific_modifier (MetaDisplay *display, } ++i; } - + return retval; } @@ -1150,7 +1150,7 @@ get_primary_modifier (MetaDisplay *display, ShiftMask, LockMask }; int i; - + i = 0; while (i < (int) G_N_ELEMENTS (masks)) { @@ -1172,7 +1172,7 @@ keycode_is_primary_modifier (MetaDisplay *display, meta_topic (META_DEBUG_KEYBINDINGS, "Checking whether code 0x%x is the primary modifier of mask 0x%x\n", keycode, entire_binding_mask); - + primary_modifier = get_primary_modifier (display, entire_binding_mask); if (primary_modifier != 0) return is_specific_modifier (display, keycode, primary_modifier); @@ -1190,9 +1190,9 @@ primary_modifier_still_pressed (MetaDisplay *display, guint mask; MetaScreen *random_screen; Window random_xwindow; - + primary_modifier = get_primary_modifier (display, entire_binding_mask); - + random_screen = display->screens->data; random_xwindow = random_screen->no_focus_window; XQueryPointer (display->xdisplay, @@ -1205,7 +1205,7 @@ primary_modifier_still_pressed (MetaDisplay *display, meta_topic (META_DEBUG_KEYBINDINGS, "Primary modifier 0x%x full grab mask 0x%x current state 0x%x\n", primary_modifier, entire_binding_mask, mask); - + if ((mask & primary_modifier) == 0) return FALSE; else @@ -1243,7 +1243,7 @@ process_event (MetaKeyBinding *bindings, ((event->xkey.state & 0xff & ~(display->ignored_modifier_mask)) != bindings[i].mask)) continue; - + /* * window must be non-NULL for on_window to be true, * and so also window must be non-NULL if we get here and @@ -1261,7 +1261,7 @@ process_event (MetaKeyBinding *bindings, meta_topic (META_DEBUG_KEYBINDINGS, "Running handler for %s\n", bindings[i].name); - + /* Global keybindings count as a let-the-terminal-lose-focus * due to new window mapping until the user starts * interacting with the terminal again. @@ -1307,10 +1307,10 @@ meta_display_process_key_event (MetaDisplay *display, event->xkey.time); if (all_bindings_disabled) return; - + /* if key event was on root window, we have a shortcut */ screen = meta_display_screen_for_root (display, event->xkey.window); - + /* else round-trip to server */ if (screen == NULL) screen = meta_display_screen_for_xwindow (display, @@ -1318,12 +1318,12 @@ meta_display_process_key_event (MetaDisplay *display, if (screen == NULL) return; /* event window is destroyed */ - + /* ignore key events on popup menus and such. */ if (window == NULL && meta_ui_window_is_widget (screen->ui, event->xany.window)) return; - + /* window may be NULL */ #ifdef HAVE_XKB keysym = XkbKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0, 0); @@ -1356,8 +1356,8 @@ meta_display_process_key_event (MetaDisplay *display, { case META_GRAB_OP_MOVING: case META_GRAB_OP_RESIZING_SE: - case META_GRAB_OP_RESIZING_S: - case META_GRAB_OP_RESIZING_SW: + case META_GRAB_OP_RESIZING_S: + case META_GRAB_OP_RESIZING_SW: case META_GRAB_OP_RESIZING_N: case META_GRAB_OP_RESIZING_NE: case META_GRAB_OP_RESIZING_NW: @@ -1369,7 +1369,7 @@ meta_display_process_key_event (MetaDisplay *display, keep_grab = process_mouse_move_resize_grab (display, screen, window, event, keysym); break; - + case META_GRAB_OP_KEYBOARD_MOVING: meta_topic (META_DEBUG_KEYBINDINGS, "Processing event for keyboard move\n"); @@ -1377,7 +1377,7 @@ meta_display_process_key_event (MetaDisplay *display, keep_grab = process_keyboard_move_grab (display, screen, window, event, keysym); break; - + case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN: case META_GRAB_OP_KEYBOARD_RESIZING_S: case META_GRAB_OP_KEYBOARD_RESIZING_N: @@ -1386,14 +1386,14 @@ meta_display_process_key_event (MetaDisplay *display, case META_GRAB_OP_KEYBOARD_RESIZING_SE: case META_GRAB_OP_KEYBOARD_RESIZING_NE: case META_GRAB_OP_KEYBOARD_RESIZING_SW: - case META_GRAB_OP_KEYBOARD_RESIZING_NW: + case META_GRAB_OP_KEYBOARD_RESIZING_NW: meta_topic (META_DEBUG_KEYBINDINGS, "Processing event for keyboard resize\n"); g_assert (window != NULL); keep_grab = process_keyboard_resize_grab (display, screen, window, event, keysym); break; - + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: case META_GRAB_OP_KEYBOARD_TABBING_DOCK: case META_GRAB_OP_KEYBOARD_TABBING_GROUP: @@ -1404,13 +1404,13 @@ meta_display_process_key_event (MetaDisplay *display, "Processing event for keyboard tabbing/cycling\n"); keep_grab = process_tab_grab (display, screen, event, keysym); break; - + case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING: meta_topic (META_DEBUG_KEYBINDINGS, "Processing event for keyboard workspace switching\n"); keep_grab = process_workspace_switch_grab (display, screen, event, keysym); break; - + default: break; } @@ -1489,7 +1489,7 @@ process_keyboard_move_grab (MetaDisplay *display, int x, y; int incr; gboolean smart_snap; - + handled = FALSE; /* don't care about releases, but eat them, don't end grab */ @@ -1511,7 +1511,7 @@ process_keyboard_move_grab (MetaDisplay *display, } smart_snap = (event->xkey.state & ShiftMask) != 0; - + #define SMALL_INCREMENT 1 #define NORMAL_INCREMENT 10 @@ -1545,7 +1545,7 @@ process_keyboard_move_grab (MetaDisplay *display, else display->grab_was_cancelled = TRUE; } - + /* When moving by increments, we still snap to edges if the move * to the edge is smaller than the increment. This is because * Shift + arrow to snap is sort of a hidden feature. This way @@ -1568,7 +1568,7 @@ process_keyboard_move_grab (MetaDisplay *display, handled = TRUE; break; } - + switch (keysym) { case XK_KP_Home: @@ -1599,7 +1599,7 @@ process_keyboard_move_grab (MetaDisplay *display, else meta_window_get_client_root_coords (window, &old_rect); - meta_window_edge_resistance_for_move (window, + meta_window_edge_resistance_for_move (window, old_rect.x, old_rect.y, &x, @@ -1618,7 +1618,7 @@ process_keyboard_move_grab (MetaDisplay *display, { meta_window_move (window, TRUE, x, y); } - + meta_window_update_keyboard_move (window); } @@ -1642,7 +1642,7 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display, { case XK_Up: case XK_KP_Up: - display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N; + display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N; handled = TRUE; break; case XK_Down: @@ -1662,7 +1662,7 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display, break; } break; - + case META_GRAB_OP_KEYBOARD_RESIZING_S: switch (keysym) { @@ -1694,13 +1694,13 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display, break; } break; - + case META_GRAB_OP_KEYBOARD_RESIZING_W: switch (keysym) { case XK_Up: case XK_KP_Up: - display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N; + display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N; handled = TRUE; break; case XK_Down: @@ -1716,7 +1716,7 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display, { case XK_Up: case XK_KP_Up: - display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N; + display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N; handled = TRUE; break; case XK_Down: @@ -1726,7 +1726,7 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display, break; } break; - + case META_GRAB_OP_KEYBOARD_RESIZING_SE: case META_GRAB_OP_KEYBOARD_RESIZING_NE: case META_GRAB_OP_KEYBOARD_RESIZING_SW: @@ -1741,7 +1741,7 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display, if (handled) { meta_window_update_keyboard_resize (window, TRUE); - return TRUE; + return TRUE; } return FALSE; @@ -1760,7 +1760,7 @@ process_keyboard_resize_grab (MetaDisplay *display, int width, height; gboolean smart_snap; int gravity; - + handled = FALSE; /* don't care about releases, but eat them, don't end grab */ @@ -1792,7 +1792,7 @@ process_keyboard_resize_grab (MetaDisplay *display, return FALSE; } - if (process_keyboard_resize_grab_op_change (display, screen, window, + if (process_keyboard_resize_grab_op_change (display, screen, window, event, keysym)) return TRUE; @@ -1810,7 +1810,7 @@ process_keyboard_resize_grab (MetaDisplay *display, gravity = meta_resize_gravity_from_grab_op (display->grab_op); smart_snap = (event->xkey.state & ShiftMask) != 0; - + #define SMALL_INCREMENT 1 #define NORMAL_INCREMENT 10 @@ -1823,7 +1823,7 @@ process_keyboard_resize_grab (MetaDisplay *display, { width_inc = SMALL_INCREMENT; height_inc = SMALL_INCREMENT; - } + } else { width_inc = NORMAL_INCREMENT; @@ -1837,7 +1837,7 @@ process_keyboard_resize_grab (MetaDisplay *display, width_inc = window->size_hints.width_inc; if (window->size_hints.height_inc > 1) height_inc = window->size_hints.height_inc; - + switch (keysym) { case XK_Up: @@ -1864,7 +1864,7 @@ process_keyboard_resize_grab (MetaDisplay *display, g_assert_not_reached (); break; } - + handled = TRUE; break; @@ -1892,10 +1892,10 @@ process_keyboard_resize_grab (MetaDisplay *display, g_assert_not_reached (); break; } - + handled = TRUE; break; - + case XK_Left: case XK_KP_Left: switch (gravity) @@ -1920,10 +1920,10 @@ process_keyboard_resize_grab (MetaDisplay *display, g_assert_not_reached (); break; } - + handled = TRUE; break; - + case XK_Right: case XK_KP_Right: switch (gravity) @@ -1948,10 +1948,10 @@ process_keyboard_resize_grab (MetaDisplay *display, g_assert_not_reached (); break; } - + handled = TRUE; break; - + default: break; } @@ -1961,7 +1961,7 @@ process_keyboard_resize_grab (MetaDisplay *display, height = 1; if (width < 1) width = 1; - + if (handled) { MetaRectangle old_rect; @@ -1969,7 +1969,7 @@ process_keyboard_resize_grab (MetaDisplay *display, "Computed new window size due to keypress: " "%dx%d, gravity %s\n", width, height, meta_gravity_to_string (gravity)); - + if (display->grab_wireframe_active) old_rect = display->grab_wireframe_rect; else @@ -1989,15 +1989,15 @@ process_keyboard_resize_grab (MetaDisplay *display, if (display->grab_wireframe_active) { MetaRectangle new_position; - meta_rectangle_resize_with_gravity (&display->grab_wireframe_rect, + meta_rectangle_resize_with_gravity (&display->grab_wireframe_rect, &new_position, gravity, width, height); - meta_window_update_wireframe (window, + meta_window_update_wireframe (window, new_position.x, new_position.y, - new_position.width, + new_position.width, new_position.height); } else @@ -2006,7 +2006,7 @@ process_keyboard_resize_grab (MetaDisplay *display, * are actually different from what we had before. */ if (window->rect.width != width || window->rect.height != height) - meta_window_resize_with_gravity (window, + meta_window_resize_with_gravity (window, TRUE, width, height, @@ -2027,9 +2027,9 @@ end_keyboard_grab (MetaDisplay *display, { unsigned int primary_modifier; XkbStateRec state; - + primary_modifier = get_primary_modifier (display, display->grab_mask); - + XkbGetState (display->xdisplay, XkbUseCoreKbd, &state); if (!(primary_modifier & state.mods)) @@ -2077,7 +2077,7 @@ process_tab_grab (MetaDisplay *display, meta_topic (META_DEBUG_KEYBINDINGS, "Ending tab operation, primary modifier released\n"); - + if (target_window) { target_window->tab_unminimized = FALSE; @@ -2097,10 +2097,10 @@ process_tab_grab (MetaDisplay *display, return TRUE; /* we already ended the grab */ } - + return FALSE; /* end grab */ } - + /* don't care about other releases, but eat them, don't end grab */ if (event->type == KeyRelease) return TRUE; @@ -2180,7 +2180,7 @@ process_tab_grab (MetaDisplay *display, default: return FALSE; } - + break; default: break; @@ -2192,7 +2192,7 @@ process_tab_grab (MetaDisplay *display, * of course). * See _{SWITCH,CYCLE}_GROUP.@@@ */ - + popup_not_showing = FALSE; key_used = FALSE; backward = FALSE; @@ -2228,7 +2228,7 @@ process_tab_grab (MetaDisplay *display, default: break; } - + if (key_used) { meta_topic (META_DEBUG_KEYBINDINGS, @@ -2241,7 +2241,7 @@ process_tab_grab (MetaDisplay *display, meta_ui_tab_popup_backward (screen->tab_popup); else meta_ui_tab_popup_forward (screen->tab_popup); - + if (popup_not_showing) { /* We can't actually change window focus, due to the grab. @@ -2257,7 +2257,7 @@ process_tab_grab (MetaDisplay *display, (Window) meta_ui_tab_popup_get_selected (screen->tab_popup); target_window = meta_display_lookup_x_window (display, target_xwindow); - + if (prev_window && prev_window->tab_unminimized) { prev_window->tab_unminimized = FALSE; @@ -2278,7 +2278,7 @@ process_tab_grab (MetaDisplay *display, meta_topic (META_DEBUG_KEYBINDINGS, "Ending tabbing/cycling, uninteresting key pressed\n"); - meta_topic (META_DEBUG_KEYBINDINGS, + meta_topic (META_DEBUG_KEYBINDINGS, "Syncing to old stack positions.\n"); meta_stack_set_positions (screen->stack, screen->display->grab_old_window_stacking); @@ -2289,7 +2289,7 @@ process_tab_grab (MetaDisplay *display, prev_window->tab_unminimized = FALSE; } } - + return key_used; } @@ -2302,7 +2302,7 @@ handle_switch_to_workspace (MetaDisplay *display, { gint which = binding->handler->data; MetaWorkspace *workspace; - + if (which < 0) { /* Negative workspace numbers are directions with respect to the @@ -2320,7 +2320,7 @@ handle_switch_to_workspace (MetaDisplay *display, } workspace = meta_screen_get_workspace_by_index (screen, which); - + if (workspace) { meta_workspace_activate (workspace, event->xkey.time); @@ -2556,7 +2556,7 @@ process_workspace_switch_grab (MetaDisplay *display, meta_topic (META_DEBUG_KEYBINDINGS, "Focusing default window on target workspace\n"); - meta_workspace_focus_default_window (target_workspace, + meta_workspace_focus_default_window (target_workspace, NULL, event->xkey.time); @@ -2565,10 +2565,10 @@ process_workspace_switch_grab (MetaDisplay *display, /* Workspace switching should have already occurred on KeyPress */ meta_warning ("target_workspace != active_workspace. Some other event must have occurred.\n"); - + return FALSE; /* end grab */ } - + /* don't care about other releases, but eat them, don't end grab */ if (event->type == KeyRelease) return TRUE; @@ -2580,7 +2580,7 @@ process_workspace_switch_grab (MetaDisplay *display, /* select the next workspace in the tabpopup */ workspace = (MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->tab_popup); - + if (workspace) { MetaWorkspace *target_workspace; @@ -2653,7 +2653,7 @@ handle_show_desktop (MetaDisplay *display, if (screen->active_workspace->showing_desktop) { meta_screen_unshow_desktop (screen); - meta_workspace_focus_default_window (screen->active_workspace, + meta_workspace_focus_default_window (screen->active_workspace, NULL, event->xkey.time); } @@ -2685,7 +2685,7 @@ handle_panel (MetaDisplay *display, default: return; } - + ev.type = ClientMessage; ev.window = screen->xroot; ev.message_type = display->atom__GNOME_PANEL_ACTION; @@ -2725,7 +2725,7 @@ handle_activate_window_menu (MetaDisplay *display, meta_window_get_position (display->focus_window, &x, &y); - + if (meta_ui_get_direction() == META_UI_DIRECTION_RTL) x += display->focus_window->rect.width; @@ -2750,7 +2750,7 @@ tab_op_from_tab_type (MetaTabList type) } g_assert_not_reached (); - + return 0; } @@ -2768,7 +2768,7 @@ cycle_op_from_tab_type (MetaTabList type) } g_assert_not_reached (); - + return 0; } @@ -2786,11 +2786,11 @@ do_choose_window (MetaDisplay *display, meta_topic (META_DEBUG_KEYBINDINGS, "Tab list = %u show_popup = %d\n", type, show_popup); - + /* reverse direction if shift is down */ if (event->xkey.state & ShiftMask) backward = !backward; - + initial_selection = meta_display_get_tab_next (display, type, screen, @@ -2803,10 +2803,10 @@ do_choose_window (MetaDisplay *display, initial_selection = meta_display_get_tab_current (display, type, screen, screen->active_workspace); - + meta_topic (META_DEBUG_KEYBINDINGS, "Initially selecting window %s\n", - initial_selection ? initial_selection->desc : "(none)"); + initial_selection ? initial_selection->desc : "(none)"); if (initial_selection != NULL) { @@ -2842,7 +2842,7 @@ do_choose_window (MetaDisplay *display, * before we establish the grab. must end grab * prior to trying to focus a window. */ - meta_topic (META_DEBUG_FOCUS, + meta_topic (META_DEBUG_FOCUS, "Ending grab, activating %s, and turning off " "mouse_mode due to switch/cycle windows where " "modifier was released prior to grab\n", @@ -2855,14 +2855,14 @@ do_choose_window (MetaDisplay *display, { meta_ui_tab_popup_select (screen->tab_popup, (MetaTabEntryKey) initial_selection->xwindow); - + if (show_popup) meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE); else { meta_window_raise (initial_selection); - initial_selection->tab_unminimized = + initial_selection->tab_unminimized = initial_selection->minimized; meta_window_unminimize (initial_selection); } @@ -3057,7 +3057,7 @@ handle_move_to_workspace (MetaDisplay *display, gint which = binding->handler->data; gboolean flip = (which < 0); MetaWorkspace *workspace; - + /* If which is zero or positive, it's a workspace number, and the window * should move to the workspace with that number. * @@ -3068,10 +3068,10 @@ handle_move_to_workspace (MetaDisplay *display, if (window->always_sticky) return; - + workspace = NULL; if (flip) - { + { workspace = meta_workspace_get_neighbor (screen->active_workspace, which); } @@ -3079,7 +3079,7 @@ handle_move_to_workspace (MetaDisplay *display, { workspace = meta_screen_get_workspace_by_index (screen, which); } - + if (workspace) { /* Activate second, so the window is never unmapped */ @@ -3098,10 +3098,10 @@ handle_move_to_workspace (MetaDisplay *display, else { /* We could offer to create it I suppose */ - } + } } -static void +static void handle_raise_or_lower (MetaDisplay *display, MetaScreen *screen, MetaWindow *window, @@ -3109,29 +3109,29 @@ handle_raise_or_lower (MetaDisplay *display, MetaKeyBinding *binding) { /* Get window at pointer */ - + MetaWindow *above = NULL; - + /* Check if top */ if (meta_stack_get_top (window->screen->stack) == window) { meta_window_lower (window); return; } - + /* else check if windows in same layer are intersecting it */ - - above = meta_stack_get_above (window->screen->stack, window, TRUE); + + above = meta_stack_get_above (window->screen->stack, window, TRUE); while (above) { MetaRectangle tmp, win_rect, above_rect; - + if (above->mapped) { meta_window_get_outer_rect (window, &win_rect); meta_window_get_outer_rect (above, &above_rect); - + /* Check if obscured */ if (meta_rectangle_intersect (&win_rect, &above_rect, &tmp)) { @@ -3139,8 +3139,8 @@ handle_raise_or_lower (MetaDisplay *display, return; } } - - above = meta_stack_get_above (window->screen->stack, above, TRUE); + + above = meta_stack_get_above (window->screen->stack, above, TRUE); } /* window is not obscured */ @@ -3176,8 +3176,8 @@ handle_workspace_switch (MetaDisplay *display, { gint motion = binding->handler->data; unsigned int grab_mask; - - g_assert (motion < 0); + + g_assert (motion < 0); /* Don't show the ws switcher if we get just one ws */ if (meta_screen_get_n_workspaces(screen) == 1) @@ -3188,7 +3188,7 @@ handle_workspace_switch (MetaDisplay *display, /* FIXME should we use binding->mask ? */ grab_mask = event->xkey.state & ~(display->ignored_modifier_mask); - + if (meta_display_begin_grab_op (display, screen, NULL, @@ -3202,12 +3202,12 @@ handle_workspace_switch (MetaDisplay *display, { MetaWorkspace *next; gboolean grabbed_before_release; - + next = meta_workspace_get_neighbor (screen->active_workspace, motion); - g_assert (next); + g_assert (next); grabbed_before_release = primary_modifier_still_pressed (display, grab_mask); - + meta_topic (META_DEBUG_KEYBINDINGS, "Activating target workspace\n"); @@ -3220,13 +3220,13 @@ handle_workspace_switch (MetaDisplay *display, */ meta_display_end_grab_op (display, event->xkey.time); } - + meta_workspace_activate (next, event->xkey.time); if (grabbed_before_release) { meta_ui_tab_popup_select (screen->tab_popup, (MetaTabEntryKey) next); - + /* only after selecting proper space */ meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE); } diff --git a/src/core/keybindings.h b/src/core/keybindings.h index d0c70cd4..d1078bde 100644 --- a/src/core/keybindings.h +++ b/src/core/keybindings.h @@ -7,9 +7,9 @@ * the one to close a window. It also deals with incoming key events. */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -19,7 +19,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -36,7 +36,7 @@ void meta_screen_grab_keys (MetaScreen *screen); void meta_screen_ungrab_keys (MetaScreen *screen); gboolean meta_screen_grab_all_keys (MetaScreen *screen, guint32 timestamp); -void meta_screen_ungrab_all_keys (MetaScreen *screen, +void meta_screen_ungrab_all_keys (MetaScreen *screen, guint32 timestamp); void meta_window_grab_keys (MetaWindow *window); void meta_window_ungrab_keys (MetaWindow *window); diff --git a/src/core/main.c b/src/core/main.c index 8a2f796a..6758ae7d 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2,10 +2,10 @@ /* Metacity main() */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2006 Elijah Newren - * + * * 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; either version 2 of the @@ -15,13 +15,13 @@ * 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, see <http://www.gnu.org/licenses/>. */ /** - * \file + * \file * Program startup. * Functions which parse the command-line arguments, create the display, * kick everything off and then close down Metacity when it's time to go. @@ -206,7 +206,7 @@ meta_print_self_identity (void) g_date_strftime (buf, sizeof (buf), "%x", &d); meta_verbose ("Metacity version %s running on %s\n", VERSION, buf); - + /* Locale and encoding. */ g_get_charset (&charset); meta_verbose ("Running in locale \"%s\" with encoding \"%s\"\n", @@ -455,7 +455,7 @@ main (int argc, char **argv) g_get_home_dir ()); meta_print_self_identity (); - + bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); @@ -469,16 +469,16 @@ main (int argc, char **argv) version (); meta_select_display (meta_args.display_name); - + if (meta_args.replace_wm) meta_set_replace_current_wm (TRUE); if (meta_args.save_file && meta_args.client_id) meta_fatal ("Can't specify both SM save file and SM client id\n"); - + meta_main_loop = g_main_loop_new (NULL, FALSE); - - meta_ui_init (&argc, &argv); + + meta_ui_init (&argc, &argv); /* must be after UI init so we can override GDK handlers */ meta_errors_init (); @@ -499,7 +499,7 @@ main (int argc, char **argv) if (g_getenv ("METACITY_G_FATAL_WARNINGS") != NULL) g_log_set_always_fatal (G_LOG_LEVEL_MASK); - + meta_ui_set_current_theme (meta_prefs_get_theme (), FALSE); /* Try to find some theme that'll work if the theme preference @@ -508,34 +508,34 @@ main (int argc, char **argv) */ if (!meta_ui_have_a_theme ()) meta_ui_set_current_theme ("Simple", FALSE); - + if (!meta_ui_have_a_theme ()) { const char *dir_entry = NULL; GError *err = NULL; GDir *themes_dir = NULL; - + if (!(themes_dir = g_dir_open (METACITY_DATADIR"/themes", 0, &err))) { meta_fatal (_("Failed to scan themes directory: %s\n"), err->message); g_error_free (err); - } - else + } + else { - while (((dir_entry = g_dir_read_name (themes_dir)) != NULL) && + while (((dir_entry = g_dir_read_name (themes_dir)) != NULL) && (!meta_ui_have_a_theme ())) { meta_ui_set_current_theme (dir_entry, FALSE); } - + g_dir_close (themes_dir); } } - + if (!meta_ui_have_a_theme ()) meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes.\n"), METACITY_DATADIR"/themes"); - + /* Connect to SM as late as possible - but before managing display, * or we might try to manage a window before we have the session * info @@ -545,9 +545,9 @@ main (int argc, char **argv) if (meta_args.client_id == NULL) { const gchar *desktop_autostart_id; - + desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID"); - + if (desktop_autostart_id != NULL) meta_args.client_id = g_strdup (desktop_autostart_id); } @@ -573,7 +573,7 @@ main (int argc, char **argv) if (!meta_display_open ()) meta_exit (META_EXIT_ERROR); - + g_main_loop_run (meta_main_loop); meta_finalize (); @@ -598,7 +598,7 @@ main (int argc, char **argv) meta_exit_code = META_EXIT_ERROR; } } - + return meta_exit_code; } diff --git a/src/core/metacity-Xatomtype.h b/src/core/metacity-Xatomtype.h index d14d3ab7..1731e923 100644 --- a/src/core/metacity-Xatomtype.h +++ b/src/core/metacity-Xatomtype.h @@ -39,13 +39,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL diff --git a/src/core/place.c b/src/core/place.c index 72e20e2f..8eb6f3a6 100644 --- a/src/core/place.c +++ b/src/core/place.c @@ -2,12 +2,12 @@ /* Metacity window placement */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002, 2003 Red Hat, Inc. * Copyright (C) 2003 Rob Adams * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -17,7 +17,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -72,11 +72,11 @@ northwestcmp (gconstpointer a, gconstpointer b) bx = bw->rect.x; by = bw->rect.y; } - + /* probably there's a fast good-enough-guess we could use here. */ from_origin_a = sqrt (ax * ax + ay * ay); from_origin_b = sqrt (bx * bx + by * by); - + if (from_origin_a < from_origin_b) return -1; else if (from_origin_a > from_origin_b) @@ -103,16 +103,16 @@ find_next_cascade (MetaWindow *window, int cascade_stage; MetaRectangle work_area; const MetaXineramaScreenInfo* current; - + sorted = g_list_copy (windows); sorted = g_list_sort (sorted, northwestcmp); - /* This is a "fuzzy" cascade algorithm. + /* This is a "fuzzy" cascade algorithm. * For each window in the list, we find where we'd cascade a * new window after it. If a window is already nearly at that * position, we move on. */ - + /* arbitrary-ish threshold, honors user attempts to * manually cascade. */ @@ -127,7 +127,7 @@ find_next_cascade (MetaWindow *window, x_threshold = CASCADE_FUZZ; y_threshold = CASCADE_FUZZ; } - + /* Find furthest-SE origin of all workspaces. * cascade_x, cascade_y are the target position * of NW corner of window frame. @@ -138,19 +138,19 @@ find_next_cascade (MetaWindow *window, cascade_x = MAX (0, work_area.x); cascade_y = MAX (0, work_area.y); - + /* Find first cascade position that's not used. */ - + window_width = window->frame ? window->frame->rect.width : window->rect.width; window_height = window->frame ? window->frame->rect.height : window->rect.height; - + cascade_stage = 0; tmp = sorted; while (tmp != NULL) { MetaWindow *w; int wx, wy; - + w = tmp->data; /* we want frame position, not window position */ @@ -164,7 +164,7 @@ find_next_cascade (MetaWindow *window, wx = w->rect.x; wy = w->rect.y; } - + if (ABS (wx - cascade_x) < x_threshold && ABS (wy - cascade_y) < y_threshold) { @@ -175,7 +175,7 @@ find_next_cascade (MetaWindow *window, meta_window_get_position (w, &wx, &wy); cascade_x = wx; cascade_y = wy; - + /* If we go off the screen, start over with a new cascade */ if (((cascade_x + window_width) > (work_area.x + work_area.width)) || @@ -184,11 +184,11 @@ find_next_cascade (MetaWindow *window, { cascade_x = MAX (0, work_area.x); cascade_y = MAX (0, work_area.y); - + #define CASCADE_INTERVAL 50 /* space between top-left corners of cascades */ cascade_stage += 1; cascade_x += CASCADE_INTERVAL * cascade_stage; - + /* start over with a new cascade translated to the right, unless * we are out of space */ @@ -210,14 +210,14 @@ find_next_cascade (MetaWindow *window, { /* Keep searching for a further-down-the-diagonal window. */ } - + tmp = tmp->next; } /* cascade_x and cascade_y will match the last window in the list * that was "in the way" (in the approximate cascade diagonal) */ - + g_list_free (sorted); /* Convert coords to position of window, not position of frame. */ @@ -378,12 +378,12 @@ rectangle_overlaps_some_window (MetaRectangle *rect, { GList *tmp; MetaRectangle dest; - + tmp = windows; while (tmp != NULL) { MetaWindow *other = tmp->data; - MetaRectangle other_rect; + MetaRectangle other_rect; switch (other->type) { @@ -399,12 +399,12 @@ rectangle_overlaps_some_window (MetaRectangle *rect, case META_WINDOW_TOOLBAR: case META_WINDOW_MENU: meta_window_get_outer_rect (other, &other_rect); - + if (meta_rectangle_intersect (rect, &other_rect, &dest)) return TRUE; break; } - + tmp = tmp->next; } @@ -510,29 +510,29 @@ find_first_fit (MetaWindow *window, * the bottom of each existing window, and then to the right * of each existing window, aligned with the left/top of the * existing window in each of those cases. - */ + */ int retval; GList *below_sorted; GList *right_sorted; GList *tmp; MetaRectangle rect; MetaRectangle work_area; - + retval = FALSE; /* Below each window */ below_sorted = g_list_copy (windows); below_sorted = g_list_sort (below_sorted, leftmost_cmp); - below_sorted = g_list_sort (below_sorted, topmost_cmp); + below_sorted = g_list_sort (below_sorted, topmost_cmp); /* To the right of each window */ right_sorted = g_list_copy (windows); right_sorted = g_list_sort (right_sorted, topmost_cmp); right_sorted = g_list_sort (right_sorted, leftmost_cmp); - + rect.width = window->rect.width; rect.height = window->rect.height; - + if (borders) { rect.width += borders->visible.left + borders->visible.right; @@ -564,9 +564,9 @@ find_first_fit (MetaWindow *window, *new_x += borders->visible.left; *new_y += borders->visible.top; } - + retval = TRUE; - + goto out; } @@ -578,10 +578,10 @@ find_first_fit (MetaWindow *window, MetaRectangle outer_rect; meta_window_get_outer_rect (w, &outer_rect); - + rect.x = outer_rect.x; rect.y = outer_rect.y + outer_rect.height; - + if (meta_rectangle_contains_rect (&work_area, &rect) && !rectangle_overlaps_some_window (&rect, below_sorted)) { @@ -592,9 +592,9 @@ find_first_fit (MetaWindow *window, *new_x += borders->visible.left; *new_y += borders->visible.top; } - + retval = TRUE; - + goto out; } @@ -607,12 +607,12 @@ find_first_fit (MetaWindow *window, { MetaWindow *w = tmp->data; MetaRectangle outer_rect; - + meta_window_get_outer_rect (w, &outer_rect); - + rect.x = outer_rect.x + outer_rect.width; rect.y = outer_rect.y; - + if (meta_rectangle_contains_rect (&work_area, &rect) && !rectangle_overlaps_some_window (&rect, right_sorted)) { @@ -623,15 +623,15 @@ find_first_fit (MetaWindow *window, *new_x += borders->visible.left; *new_y += borders->visible.top; } - + retval = TRUE; - + goto out; } tmp = tmp->next; } - + out: g_list_free (below_sorted); @@ -748,11 +748,11 @@ meta_window_place (MetaWindow *window, * NEVER have side effects other than computing the * placement coordinates. */ - + meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc); windows = NULL; - + switch (window->type) { /* Run placement algorithm on these. */ @@ -761,7 +761,7 @@ meta_window_place (MetaWindow *window, case META_WINDOW_MODAL_DIALOG: case META_WINDOW_SPLASHSCREEN: break; - + /* Assume the app knows best how to place these, no placement * algorithm ever (other than "leave them as-is") */ @@ -772,7 +772,7 @@ meta_window_place (MetaWindow *window, case META_WINDOW_UTILITY: goto done_no_constraints; } - + if (meta_prefs_get_disable_workarounds ()) { switch (window->type) @@ -796,7 +796,7 @@ meta_window_place (MetaWindow *window, case META_WINDOW_MODAL_DIALOG: case META_WINDOW_SPLASHSCREEN: break; - + /* Assume the app knows best how to place these. */ case META_WINDOW_DESKTOP: case META_WINDOW_DOCK: @@ -815,7 +815,7 @@ meta_window_place (MetaWindow *window, else { /* workarounds enabled */ - + if ((window->size_hints.flags & PPosition) || (window->size_hints.flags & USPosition)) { @@ -825,7 +825,7 @@ meta_window_place (MetaWindow *window, goto done_no_constraints; } } - + if ((window->type == META_WINDOW_DIALOG || window->type == META_WINDOW_MODAL_DIALOG) && window->xtransient_for != None) @@ -833,7 +833,7 @@ meta_window_place (MetaWindow *window, /* Center horizontally, at top of parent vertically */ MetaWindow *parent; - + parent = meta_display_lookup_x_window (window->display, window->xtransient_for); @@ -861,17 +861,17 @@ meta_window_place (MetaWindow *window, meta_topic (META_DEBUG_PLACEMENT, "Centered window %s over transient parent\n", window->desc); - + avoid_being_obscured_as_second_modal_dialog (window, borders, &x, &y); goto done; } } - + /* FIXME UTILITY with transient set should be stacked up * on the sides of the parent window or something. */ - + if (window->type == META_WINDOW_DIALOG || window->type == META_WINDOW_MODAL_DIALOG || window->type == META_WINDOW_SPLASHSCREEN) @@ -890,13 +890,13 @@ meta_window_place (MetaWindow *window, x += xi->rect.x; y += xi->rect.y; - + meta_topic (META_DEBUG_PLACEMENT, "Centered window %s on screen %d xinerama %d\n", window->desc, window->screen->number, xi->number); goto done_check_denied_focus; } - + /* Find windows that matter (not minimized, on same workspace * as placed window, may be shaded - if shaded we pretend it isn't * for placement purposes) @@ -904,7 +904,7 @@ meta_window_place (MetaWindow *window, { GSList *all_windows; GSList *tmp; - + all_windows = meta_display_list_windows (window->display); tmp = all_windows; @@ -913,7 +913,7 @@ meta_window_place (MetaWindow *window, MetaWindow *w = tmp->data; if (meta_window_showing_on_its_workspace (w) && - w != window && + w != window && (window->workspace == w->workspace || window->on_all_workspaces || w->on_all_workspaces)) windows = g_list_prepend (windows, w); @@ -926,7 +926,7 @@ meta_window_place (MetaWindow *window, /* Warning, this is a round trip! */ xi = meta_screen_get_current_xinerama (window->screen); - + /* "Origin" placement algorithm */ x = xi->rect.x; y = xi->rect.y; @@ -938,7 +938,7 @@ meta_window_place (MetaWindow *window, /* Maximize windows if they are too big for their work area (bit of * a hack here). Assume undecorated windows probably don't intend to - * be maximized. + * be maximized. */ if (window->has_maximize_func && window->decorated && !window->fullscreen) @@ -948,9 +948,9 @@ meta_window_place (MetaWindow *window, meta_window_get_work_area_for_xinerama (window, xi->number, - &workarea); + &workarea); meta_window_get_outer_rect (window, &outer); - + /* If the window is bigger than the screen, then automaximize. Do NOT * auto-maximize the directions independently. See #419810. */ @@ -961,10 +961,10 @@ meta_window_place (MetaWindow *window, } } - /* If no placement has been done, revert to cascade to avoid + /* If no placement has been done, revert to cascade to avoid * fully overlapping window (e.g. starting multiple terminals) * */ - if (x == xi->rect.x && y == xi->rect.y) + if (x == xi->rect.x && y == xi->rect.y) find_next_cascade (window, borders, windows, x, y, &x, &y); done_check_denied_focus: @@ -1011,10 +1011,10 @@ meta_window_place (MetaWindow *window, if (!found_fit) find_most_freespace (window, borders, focus_window, x, y, &x, &y); } - + done: g_list_free (windows); - + done_no_constraints: *new_x = x; diff --git a/src/core/place.h b/src/core/place.h index 55bf6907..2a5ea599 100644 --- a/src/core/place.h +++ b/src/core/place.h @@ -2,9 +2,9 @@ /* Metacity window placement */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/prefs.c b/src/core/prefs.c index 21ebb64e..ea16c04d 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -2,7 +2,7 @@ /* Metacity preferences */ -/* +/* * Copyright (C) 2001 Havoc Pennington, Copyright (C) 2002 Red Hat Inc. * Copyright (C) 2006 Elijah Newren * Copyright (C) 2008 Thomas Thurman @@ -17,7 +17,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -521,7 +521,7 @@ handle_preference_init_int (void) { MetaIntPreference *cursor = preferences_int; - + while (cursor->base.key != NULL) { if (cursor->target) @@ -690,7 +690,7 @@ meta_prefs_remove_listener (MetaPrefsChangedFunc func, return; } - + tmp = tmp->next; } @@ -705,9 +705,9 @@ emit_changed (MetaPreference pref) meta_topic (META_DEBUG_PREFS, "Notifying listeners that pref %s changed\n", meta_preference_to_string (pref)); - + copy = g_list_copy (listeners); - + tmp = copy; while (tmp != NULL) @@ -729,24 +729,24 @@ changed_idle_handler (gpointer data) GList *copy; changed_idle = 0; - + copy = g_list_copy (changes); /* reentrancy paranoia */ g_list_free (changes); changes = NULL; - + tmp = copy; while (tmp != NULL) { MetaPreference pref = GPOINTER_TO_INT (tmp->data); emit_changed (pref); - + tmp = tmp->next; } g_list_free (copy); - + return FALSE; } @@ -754,7 +754,7 @@ static void queue_changed (MetaPreference pref) { meta_topic (META_DEBUG_PREFS, "Queueing change of pref %s\n", - meta_preference_to_string (pref)); + meta_preference_to_string (pref)); if (g_list_find (changes, GINT_TO_POINTER (pref)) == NULL) changes = g_list_prepend (changes, GINT_TO_POINTER (pref)); @@ -895,7 +895,7 @@ static void maybe_give_disable_workarounds_warning (void) { static gboolean first_disable = TRUE; - + if (first_disable && disable_workarounds) { first_disable = FALSE; @@ -1039,7 +1039,7 @@ mouse_button_mods_handler (GVariant *value, { meta_topic (META_DEBUG_KEYBINDINGS, "Failed to parse new GSettings value\n"); - + meta_warning (_("\"%s\" found in configuration database is " "not a valid value for mouse button modifier\n"), string_value); @@ -1063,7 +1063,7 @@ mouse_button_mods_handler (GVariant *value, static gboolean button_layout_equal (const MetaButtonLayout *a, const MetaButtonLayout *b) -{ +{ int i; i = 0; @@ -1104,7 +1104,7 @@ button_function_from_string (const char *str) return META_BUTTON_FUNCTION_ABOVE; else if (strcmp (str, "stick") == 0) return META_BUTTON_FUNCTION_STICK; - else + else /* don't know; give up */ return META_BUTTON_FUNCTION_LAST; } @@ -1231,7 +1231,7 @@ button_layout_handler (GVariant *value, new_layout.right_buttons_has_spacer[i] = FALSE; i++; } - + buttons = g_strsplit (sides[1], ",", -1); i = 0; b = 0; @@ -1267,7 +1267,7 @@ button_layout_handler (GVariant *value, buttons[b]); } } - + ++b; } @@ -1286,7 +1286,7 @@ button_layout_handler (GVariant *value, { MetaButtonLayout rtl_layout; int j; - + for (i = 0; new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST; i++); for (j = 0; j < i; j++) { @@ -1298,7 +1298,7 @@ button_layout_handler (GVariant *value, } rtl_layout.right_buttons[j] = META_BUTTON_FUNCTION_LAST; rtl_layout.right_buttons_has_spacer[j] = FALSE; - + for (i = 0; new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++); for (j = 0; j < i; j++) { @@ -1342,7 +1342,7 @@ gboolean meta_prefs_get_application_based (void) { return FALSE; /* For now, we never want this to do anything */ - + return application_based; } @@ -1373,7 +1373,7 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_RAISE_ON_CLICK: return "RAISE_ON_CLICK"; - + case META_PREF_THEME: return "THEME"; @@ -1403,7 +1403,7 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_AUTO_RAISE: return "AUTO_RAISE"; - + case META_PREF_AUTO_RAISE_DELAY: return "AUTO_RAISE_DELAY"; @@ -1517,7 +1517,7 @@ update_binding (MetaKeyPref *binding, g_slist_foreach (binding->bindings, (GFunc) g_free, NULL); g_slist_free (binding->bindings); binding->bindings = NULL; - + for (i = 0; strokes && strokes[i]; i++) { keysym = 0; @@ -1654,7 +1654,7 @@ meta_prefs_change_workspace_name (int num, { GVariantBuilder builder; int n_workspace_names, i; - + g_return_if_fail (num >= 0); meta_topic (META_DEBUG_PREFS, @@ -1723,7 +1723,7 @@ void meta_prefs_get_key_bindings (const MetaKeyPref **bindings, int *n_bindings) { - + *bindings = key_bindings; *n_bindings = (int) G_N_ELEMENTS (key_bindings) - 1; } @@ -1792,7 +1792,7 @@ meta_prefs_get_keybinding_action (const char *name) { if (strcmp (key_bindings[i].name, name) == 0) return (MetaKeyBindingAction) i; - + --i; } @@ -1836,7 +1836,7 @@ meta_prefs_get_window_binding (const char *name, *keysym = *modifiers = 0; return; } - + --i; } diff --git a/src/core/screen-private.h b/src/core/screen-private.h index f85e0a83..8b9f619c 100644 --- a/src/core/screen-private.h +++ b/src/core/screen-private.h @@ -9,11 +9,11 @@ * which the rest of the world is allowed to use.) */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2003 Rob Adams * Copyright (C) 2004-2006 Elijah Newren - * + * * 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; either version 2 of the @@ -23,7 +23,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -87,7 +87,7 @@ struct _MetaScreen * any actual clients */ Window no_focus_window; - + GList *workspaces; MetaStack *stack; @@ -99,7 +99,7 @@ struct _MetaScreen Window wm_sn_selection_window; Atom wm_sn_atom; guint32 wm_sn_timestamp; - + MetaXineramaScreenInfo *xinerama_infos; int n_xinerama_infos; @@ -123,10 +123,10 @@ struct _MetaScreen int columns_of_workspaces; MetaScreenCorner starting_corner; guint vertical_workspaces : 1; - + guint keys_grabbed : 1; guint all_keys_grabbed : 1; - + int closing; /* gc for XOR on root window */ diff --git a/src/core/screen.c b/src/core/screen.c index 1785bdbe..2256bdd3 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -2,14 +2,14 @@ /* Metacity X screen handler */ -/* +/* * Copyright (C) 2001, 2002 Havoc Pennington * Copyright (C) 2002, 2003 Red Hat Inc. * Some ICCCM manager selection code derived from fvwm2, * Copyright (C) 2001 Dominik Vogt, Matthias Clasen, and fvwm2 team * Copyright (C) 2003 Rob Adams * Copyright (C) 2004-2006 Elijah Newren - * + * * 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; either version 2 of the @@ -19,7 +19,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -73,7 +73,7 @@ set_wm_check_hint (MetaScreen *screen) unsigned long data[1]; g_return_val_if_fail (screen->display->leader_window != None, 0); - + data[0] = screen->display->leader_window; XChangeProperty (screen->display->xdisplay, screen->xroot, @@ -87,7 +87,7 @@ set_wm_check_hint (MetaScreen *screen) static void unset_wm_check_hint (MetaScreen *screen) { - XDeleteProperty (screen->display->xdisplay, screen->xroot, + XDeleteProperty (screen->display->xdisplay, screen->xroot, screen->display->atom__NET_SUPPORTING_WM_CHECK); } @@ -107,7 +107,7 @@ set_supported_hint (MetaScreen *screen) XA_ATOM, 32, PropModeReplace, (guchar*) atoms, G_N_ELEMENTS(atoms)); - + return Success; } @@ -136,7 +136,7 @@ set_wm_icon_size_hint (MetaScreen *screen) screen->display->atom_WM_ICON_SIZE, XA_CARDINAL, 32, PropModeReplace, (guchar*) vals, N_VALS); - + return Success; #undef N_VALS } @@ -155,29 +155,29 @@ reload_xinerama_infos (MetaScreen *screen) MetaWorkspace *space = tmp->data; meta_workspace_invalidate_work_area (space); - + tmp = tmp->next; } } display = screen->display; - + if (screen->xinerama_infos) g_free (screen->xinerama_infos); - + screen->xinerama_infos = NULL; screen->n_xinerama_infos = 0; screen->last_xinerama_index = 0; screen->display->xinerama_cache_invalidated = TRUE; - + #ifdef HAVE_XFREE_XINERAMA if (XineramaIsActive (display->xdisplay)) { XineramaScreenInfo *infos; int n_infos; int i; - + n_infos = 0; infos = XineramaQueryScreens (display->xdisplay, &n_infos); @@ -189,7 +189,7 @@ reload_xinerama_infos (MetaScreen *screen) { screen->xinerama_infos = g_new (MetaXineramaScreenInfo, n_infos); screen->n_xinerama_infos = n_infos; - + i = 0; while (i < n_infos) { @@ -206,11 +206,11 @@ reload_xinerama_infos (MetaScreen *screen) screen->xinerama_infos[i].rect.y, screen->xinerama_infos[i].rect.width, screen->xinerama_infos[i].rect.height); - + ++i; } } - + meta_XFree (infos); } else @@ -241,16 +241,16 @@ reload_xinerama_infos (MetaScreen *screen) screen->number, monitors, hints, &n_monitors); - /* Yes I know it should be Success but the current implementation + /* Yes I know it should be Success but the current implementation * returns the num of monitor */ if (result > 0) { g_assert (n_monitors > 0); - + screen->xinerama_infos = g_new (MetaXineramaScreenInfo, n_monitors); screen->n_xinerama_infos = n_monitors; - + i = 0; while (i < n_monitors) { @@ -266,8 +266,8 @@ reload_xinerama_infos (MetaScreen *screen) screen->xinerama_infos[i].rect.x, screen->xinerama_infos[i].rect.y, screen->xinerama_infos[i].rect.width, - screen->xinerama_infos[i].rect.height); - + screen->xinerama_infos[i].rect.height); + ++i; } } @@ -283,7 +283,7 @@ reload_xinerama_infos (MetaScreen *screen) "Metacity compiled without Solaris Xinerama support\n"); #endif /* HAVE_SOLARIS_XINERAMA */ - + /* If no Xinerama, fill in the single screen info so * we can use the field unconditionally */ @@ -293,10 +293,10 @@ reload_xinerama_infos (MetaScreen *screen) { meta_topic (META_DEBUG_XINERAMA, "Pretending a single monitor has two Xinerama screens\n"); - + screen->xinerama_infos = g_new (MetaXineramaScreenInfo, 2); screen->n_xinerama_infos = 2; - + screen->xinerama_infos[0].number = 0; screen->xinerama_infos[0].rect = screen->rect; screen->xinerama_infos[0].rect.width = screen->rect.width / 2; @@ -310,10 +310,10 @@ reload_xinerama_infos (MetaScreen *screen) { meta_topic (META_DEBUG_XINERAMA, "No Xinerama screens, using default screen info\n"); - + screen->xinerama_infos = g_new (MetaXineramaScreenInfo, 1); screen->n_xinerama_infos = 1; - + screen->xinerama_infos[0].number = 0; screen->xinerama_infos[0].rect = screen->rect; } @@ -339,16 +339,16 @@ meta_screen_new (MetaDisplay *display, char buf[128]; guint32 manager_timestamp; gulong current_workspace; - + replace_current_wm = meta_get_replace_current_wm (); - + /* Only display->name, display->xdisplay, and display->error_traps * can really be used in this function, since normally screens are * created from the MetaDisplay constructor */ - + xdisplay = display->xdisplay; - + meta_verbose ("Trying screen %d on display '%s'\n", number, display->name); @@ -365,14 +365,14 @@ meta_screen_new (MetaDisplay *display, } sprintf (buf, "WM_S%d", number); - wm_sn_atom = XInternAtom (xdisplay, buf, False); - + wm_sn_atom = XInternAtom (xdisplay, buf, False); + current_wm_sn_owner = XGetSelectionOwner (xdisplay, wm_sn_atom); if (current_wm_sn_owner != None) { XSetWindowAttributes attrs; - + if (!replace_current_wm) { meta_warning (_("Screen %d on display \"%s\" already has a window manager; try using the --replace option to replace the current window manager.\n"), @@ -396,7 +396,7 @@ meta_screen_new (MetaDisplay *display, new_wm_sn_owner = meta_create_offscreen_window (xdisplay, xroot, NoEventMask); manager_timestamp = timestamp; - + XSetSelectionOwner (xdisplay, wm_sn_atom, new_wm_sn_owner, manager_timestamp); @@ -406,14 +406,14 @@ meta_screen_new (MetaDisplay *display, number, display->name); XDestroyWindow (xdisplay, new_wm_sn_owner); - + return NULL; } - + { /* Send client message indicating that we are now the WM */ XClientMessageEvent ev; - + ev.type = ClientMessage; ev.window = xroot; ev.message_type = display->atom_MANAGER; @@ -430,7 +430,7 @@ meta_screen_new (MetaDisplay *display, XEvent event; /* We sort of block infinitely here which is probably lame. */ - + meta_verbose ("Waiting for old window manager to exit\n"); do { @@ -439,7 +439,7 @@ meta_screen_new (MetaDisplay *display, } while (event.type != DestroyNotify); } - + /* select our root window events */ meta_error_trap_push_with_return (display); @@ -464,13 +464,13 @@ meta_screen_new (MetaDisplay *display, number, display->name); XDestroyWindow (xdisplay, new_wm_sn_owner); - + return NULL; } - + screen = g_new (MetaScreen, 1); screen->closing = 0; - + screen->display = display; screen->number = number; screen->screen_name = get_screen_name (display, number); @@ -489,8 +489,8 @@ meta_screen_new (MetaDisplay *display, screen->wm_sn_timestamp = manager_timestamp; #ifdef HAVE_COMPOSITE_EXTENSIONS - screen->wm_cm_selection_window = meta_create_offscreen_window (xdisplay, - xroot, + screen->wm_cm_selection_window = meta_create_offscreen_window (xdisplay, + xroot, NoEventMask); #endif screen->work_area_idle = 0; @@ -507,7 +507,7 @@ meta_screen_new (MetaDisplay *display, XFontStruct *font_info; XGCValues gc_values; gulong value_mask = 0; - + gc_values.subwindow_mode = IncludeInferiors; value_mask |= GCSubwindowMode; gc_values.function = GXinvert; @@ -531,27 +531,27 @@ meta_screen_new (MetaDisplay *display, value_mask, &gc_values); } - + screen->xinerama_infos = NULL; screen->n_xinerama_infos = 0; - screen->last_xinerama_index = 0; - + screen->last_xinerama_index = 0; + reload_xinerama_infos (screen); - + meta_screen_set_cursor (screen, META_CURSOR_DEFAULT); - /* Handle creating a no_focus_window for this screen */ + /* Handle creating a no_focus_window for this screen */ screen->no_focus_window = meta_create_offscreen_window (display->xdisplay, screen->xroot, FocusChangeMask|KeyPressMask|KeyReleaseMask); XMapWindow (display->xdisplay, screen->no_focus_window); /* Done with no_focus_window stuff */ - + set_wm_icon_size_hint (screen); - + set_supported_hint (screen); - + set_wm_check_hint (screen); set_desktop_viewport_hint (screen); @@ -570,13 +570,13 @@ meta_screen_new (MetaDisplay *display, (int) current_workspace); else meta_verbose ("No _NET_CURRENT_DESKTOP present\n"); - + /* Screens must have at least one workspace at all times, * so create that required workspace. */ meta_workspace_activate (meta_workspace_new (screen), timestamp); update_num_workspaces (screen, timestamp); - + set_workspace_names (screen); screen->all_keys_grabbed = FALSE; @@ -609,17 +609,17 @@ meta_screen_new (MetaDisplay *display, /* Switch to the _NET_CURRENT_DESKTOP workspace */ { MetaWorkspace *space; - + space = meta_screen_get_workspace_by_index (screen, current_workspace); - + if (space != NULL) meta_workspace_activate (space, timestamp); } meta_verbose ("Added screen %d ('%s') root 0x%lx\n", screen->number, screen->screen_name, screen->xroot); - + return screen; } @@ -633,7 +633,7 @@ meta_screen_free (MetaScreen *screen, display = screen->display; screen->closing += 1; - + meta_display_grab (display); if (screen->display->compositor) @@ -641,11 +641,11 @@ meta_screen_free (MetaScreen *screen, meta_compositor_unmanage_screen (screen->display->compositor, screen); } - + meta_display_unmanage_windows_for_screen (display, screen, timestamp); - + meta_prefs_remove_listener (prefs_changed_callback, screen); - + meta_screen_ungrab_keys (screen); #ifdef HAVE_STARTUP_NOTIFICATION @@ -665,7 +665,7 @@ meta_screen_free (MetaScreen *screen, screen->sn_context = NULL; } #endif - + meta_ui_free (screen->ui); meta_stack_free (screen->stack); @@ -680,7 +680,7 @@ meta_screen_free (MetaScreen *screen, XDestroyWindow (screen->display->xdisplay, screen->wm_sn_selection_window); - + if (screen->work_area_idle != 0) g_source_remove (screen->work_area_idle); @@ -696,7 +696,7 @@ meta_screen_free (MetaScreen *screen, XFreeGC (screen->display->xdisplay, screen->root_xor_gc); - + if (screen->xinerama_infos) g_free (screen->xinerama_infos); @@ -737,7 +737,7 @@ list_windows (MetaScreen *screen) WindowInfo *info = g_new0 (WindowInfo, 1); meta_error_trap_push_with_return (screen->display); - + XGetWindowAttributes (screen->display->xdisplay, children[i], &info->attrs); @@ -768,7 +768,7 @@ meta_screen_manage_all_windows (MetaScreen *screen) GList *list; meta_display_grab (screen->display); - + windows = list_windows (screen); meta_stack_freeze (screen->stack); @@ -845,12 +845,12 @@ MetaScreen* meta_screen_for_x_screen (Screen *xscreen) { MetaDisplay *display; - + display = meta_display_for_x_display (DisplayOfScreen (xscreen)); if (display == NULL) return NULL; - + return meta_display_screen_for_x_screen (display, xscreen); } @@ -859,13 +859,13 @@ prefs_changed_callback (MetaPreference pref, gpointer data) { MetaScreen *screen = data; - + if (pref == META_PREF_NUM_WORKSPACES) { /* GSettings doesn't provide timestamps, but luckily update_num_workspaces * often doesn't need it... */ - guint32 timestamp = + guint32 timestamp = meta_display_get_current_time_roundtrip (screen->display); update_num_workspaces (screen, timestamp); } @@ -887,7 +887,7 @@ get_screen_name (MetaDisplay *display, char *p; char *dname; char *scr; - + /* DisplayString gives us a sort of canonical display, * vs. the user-entered name from XDisplayName() */ @@ -902,7 +902,7 @@ get_screen_name (MetaDisplay *display, if (p) *p = '\0'; } - + scr = g_strdup_printf ("%s.%d", dname, number); g_free (dname); @@ -925,7 +925,7 @@ static void listify_func (gpointer key, gpointer value, gpointer data) { GSList **listp; - + listp = data; *listp = g_slist_prepend (*listp, value); @@ -942,14 +942,14 @@ meta_screen_foreach_window (MetaScreen *screen, /* If we end up doing this often, just keeping a list * of windows might be sensible. */ - + winlist = NULL; g_hash_table_foreach (screen->display->window_ids, listify_func, &winlist); - + winlist = g_slist_sort (winlist, ptrcmp); - + tmp = winlist; while (tmp != NULL) { @@ -964,7 +964,7 @@ meta_screen_foreach_window (MetaScreen *screen, if (window->screen == screen) (* func) (screen, window, data); } - + tmp = tmp->next; } g_slist_free (winlist); @@ -1011,7 +1011,7 @@ meta_screen_get_workspace_by_index (MetaScreen *screen, /* should be robust, idx is maybe from an app */ if (idx < 0) return NULL; - + i = 0; tmp = screen->workspaces; while (tmp != NULL) @@ -1104,7 +1104,7 @@ update_num_workspaces (MetaScreen *screen, GList *extras; MetaWorkspace *last_remaining; gboolean need_change_space; - + new_num = meta_prefs_get_num_workspaces (); g_assert (new_num > 0); @@ -1121,13 +1121,13 @@ update_num_workspaces (MetaScreen *screen, extras = g_list_prepend (extras, w); else last_remaining = w; - + ++i; tmp = tmp->next; } g_assert (last_remaining); - + /* Get rid of the extra workspaces by moving all their windows * to last_remaining, then activating last_remaining if * one of the removed workspaces was active. This will be a bit @@ -1140,11 +1140,11 @@ update_num_workspaces (MetaScreen *screen, { MetaWorkspace *w = tmp->data; - meta_workspace_relocate_windows (w, last_remaining); + meta_workspace_relocate_windows (w, last_remaining); if (w == screen->active_workspace) need_change_space = TRUE; - + tmp = tmp->next; } @@ -1159,12 +1159,12 @@ update_num_workspaces (MetaScreen *screen, g_assert (w->windows == NULL); meta_workspace_free (w); - + tmp = tmp->next; } - + g_list_free (extras); - + while (i < new_num) { meta_workspace_new (screen); @@ -1192,7 +1192,7 @@ meta_screen_set_cursor (MetaScreen *screen, return; screen->current_cursor = cursor; - + xcursor = meta_display_create_x_cursor (screen->display, cursor); XDefineCursor (screen->display->xdisplay, screen->xroot, xcursor); XFlush (screen->display->xdisplay); @@ -1204,7 +1204,7 @@ meta_screen_update_cursor (MetaScreen *screen) { Cursor xcursor; - xcursor = meta_display_create_x_cursor (screen->display, + xcursor = meta_display_create_x_cursor (screen->display, screen->current_cursor); XDefineCursor (screen->display->xdisplay, screen->xroot, xcursor); XFlush (screen->display->xdisplay); @@ -1229,14 +1229,14 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, list_type, screen, screen->active_workspace); - + len = g_list_length (tab_list); entries = g_new (MetaTabEntry, len + 1); entries[len].key = NULL; entries[len].title = NULL; entries[len].icon = NULL; - + i = 0; tmp = tab_list; while (i < len) @@ -1263,12 +1263,12 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, entries[i].blank = FALSE; entries[i].hidden = !meta_window_showing_on_its_workspace (window); entries[i].demands_attention = window->wm_state_demands_attention; - + if (show_type == META_TAB_SHOW_INSTANTLY || !entries[i].hidden || !meta_window_get_icon_geometry (window, &r)) meta_window_get_outer_rect (window, &r); - + entries[i].rect = r; /* Find inside of highlight rectangle to be used when window is @@ -1294,19 +1294,19 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, tmp = tmp->next; } - screen->tab_popup = meta_ui_tab_popup_new (entries, + screen->tab_popup = meta_ui_tab_popup_new (entries, screen->number, len, 5, /* FIXME */ TRUE); - for (i = 0; i < len; i++) + for (i = 0; i < len; i++) g_object_unref (entries[i].icon); g_free (entries); g_list_free (tab_list); - + /* don't show tab popup, since proper window isn't selected yet */ } @@ -1319,7 +1319,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen) MetaWorkspaceLayout layout; int n_workspaces; int current_workspace; - + if (screen->tab_popup) return; @@ -1330,7 +1330,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen) current_workspace, &layout); len = layout.grid_area; - + entries = g_new (MetaTabEntry, len + 1); entries[len].key = NULL; entries[len].title = NULL; @@ -1342,15 +1342,15 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen) if (layout.grid[i] >= 0) { MetaWorkspace *workspace; - + workspace = meta_screen_get_workspace_by_index (screen, layout.grid[i]); - + entries[i].key = (MetaTabEntryKey) workspace; entries[i].title = meta_workspace_get_name (workspace); entries[i].icon = NULL; entries[i].blank = FALSE; - + g_assert (entries[i].title != NULL); } else @@ -1366,11 +1366,11 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen) ++i; } - screen->tab_popup = meta_ui_tab_popup_new (entries, + screen->tab_popup = meta_ui_tab_popup_new (entries, screen->number, len, layout.cols, - FALSE); + FALSE); g_free (entries); meta_screen_free_workspace_layout (&layout); @@ -1470,7 +1470,7 @@ meta_screen_get_mouse_window (MetaScreen *screen, int root_x_return, root_y_return; int win_x_return, win_y_return; unsigned int mask_return; - + if (not_this_one) meta_topic (META_DEBUG_FOCUS, "Focusing mouse window excluding %s\n", not_this_one->desc); @@ -1533,13 +1533,13 @@ meta_screen_get_xinerama_for_window (MetaScreen *screen, MetaWindow *window) { MetaRectangle window_rect; - + meta_window_get_outer_rect (window, &window_rect); return meta_screen_get_xinerama_for_rect (screen, &window_rect); } -const MetaXineramaScreenInfo* +const MetaXineramaScreenInfo* meta_screen_get_xinerama_neighbor (MetaScreen *screen, int which_xinerama, MetaScreenDirection direction) @@ -1552,23 +1552,23 @@ meta_screen_get_xinerama_neighbor (MetaScreen *screen, { current = screen->xinerama_infos + i; - if ((direction == META_SCREEN_RIGHT && + if ((direction == META_SCREEN_RIGHT && current->rect.x == input->rect.x + input->rect.width && meta_rectangle_vert_overlap(¤t->rect, &input->rect)) || - (direction == META_SCREEN_LEFT && + (direction == META_SCREEN_LEFT && input->rect.x == current->rect.x + current->rect.width && meta_rectangle_vert_overlap(¤t->rect, &input->rect)) || - (direction == META_SCREEN_UP && + (direction == META_SCREEN_UP && input->rect.y == current->rect.y + current->rect.height && meta_rectangle_horiz_overlap(¤t->rect, &input->rect)) || - (direction == META_SCREEN_DOWN && + (direction == META_SCREEN_DOWN && current->rect.y == input->rect.y + input->rect.height && meta_rectangle_horiz_overlap(¤t->rect, &input->rect))) { return current; } } - + return NULL; } @@ -1608,7 +1608,7 @@ meta_screen_get_natural_xinerama_list (MetaScreen *screen, while (!g_queue_is_empty (xinerama_queue)) { - current = (const MetaXineramaScreenInfo*) + current = (const MetaXineramaScreenInfo*) g_queue_pop_head (xinerama_queue); (*xineramas_list)[cur++] = current->number; @@ -1672,10 +1672,10 @@ meta_screen_get_current_xinerama (MetaScreen *screen) { if (screen->n_xinerama_infos == 1) return &screen->xinerama_infos[0]; - + /* Sadly, we have to do it this way. Yuck. */ - + if (screen->display->xinerama_cache_invalidated) { Window root_return, child_return; @@ -1683,9 +1683,9 @@ meta_screen_get_current_xinerama (MetaScreen *screen) unsigned int mask_return; int i; MetaRectangle pointer_position; - + screen->display->xinerama_cache_invalidated = FALSE; - + pointer_position.width = pointer_position.height = 1; XQueryPointer (screen->display->xdisplay, screen->xroot, @@ -1707,7 +1707,7 @@ meta_screen_get_current_xinerama (MetaScreen *screen) break; } } - + meta_topic (META_DEBUG_XINERAMA, "Rechecked current Xinerama, now %d\n", screen->last_xinerama_index); @@ -1729,7 +1729,7 @@ meta_screen_update_workspace_layout (MetaScreen *screen) { gulong *list; int n_items; - + list = NULL; n_items = 0; @@ -1741,7 +1741,7 @@ meta_screen_update_workspace_layout (MetaScreen *screen) if (n_items == 3 || n_items == 4) { int cols, rows; - + switch (list[0]) { case _NET_WM_ORIENTATION_HORZ: @@ -1768,7 +1768,7 @@ meta_screen_update_workspace_layout (MetaScreen *screen) screen->rows_of_workspaces = rows; else screen->rows_of_workspaces = -1; - + if (cols > 0) screen->columns_of_workspaces = cols; else @@ -1841,10 +1841,10 @@ set_workspace_names (MetaScreen *screen) strlen (name) + 1); else g_string_append_len (flattened, "", 1); - + ++i; } - + meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, @@ -1853,7 +1853,7 @@ set_workspace_names (MetaScreen *screen) 8, PropModeReplace, (unsigned char *)flattened->str, flattened->len); meta_error_trap_pop (screen->display, FALSE); - + g_string_free (flattened, TRUE); } @@ -1867,7 +1867,7 @@ meta_screen_update_workspace_names (MetaScreen *screen) /* this updates names in prefs when the root window property changes, * iff the new property contents don't match what's already in prefs */ - + names = NULL; n_names = 0; if (!meta_prop_get_utf8_list (screen->display, @@ -1887,10 +1887,10 @@ meta_screen_update_workspace_names (MetaScreen *screen) "Setting workspace %d name to \"%s\" due to _NET_DESKTOP_NAMES change\n", i, names[i] ? names[i] : "null"); meta_prefs_change_workspace_name (i, names[i]); - + ++i; } - + g_strfreev (names); } @@ -1907,7 +1907,7 @@ meta_create_offscreen_window (Display *xdisplay, */ attrs.override_redirect = True; attrs.event_mask = valuemask; - + return XCreateWindow (xdisplay, parent, -100, -100, 1, 1, @@ -1926,12 +1926,12 @@ set_work_area_hint (MetaScreen *screen) GList *tmp_list; unsigned long *data, *tmp; MetaRectangle area; - + num_workspaces = meta_screen_get_n_workspaces (screen); data = g_new (unsigned long, num_workspaces * 4); tmp_list = screen->workspaces; tmp = data; - + while (tmp_list != NULL) { MetaWorkspace *workspace = tmp_list->data; @@ -1946,10 +1946,10 @@ set_work_area_hint (MetaScreen *screen) tmp += 4; } - + tmp_list = tmp_list->next; } - + meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, screen->display->atom__NET_WORKAREA, @@ -1964,11 +1964,11 @@ set_work_area_idle_func (MetaScreen *screen) { meta_topic (META_DEBUG_WORKAREA, "Running work area idle function\n"); - + screen->work_area_idle = 0; - + set_work_area_hint (screen); - + return FALSE; } @@ -2020,7 +2020,7 @@ meta_screen_calc_workspace_layout (MetaScreen *screen, int *grid; int i, r, c; int current_row, current_col; - + rows = screen->rows_of_workspaces; cols = screen->columns_of_workspaces; if (rows <= 0 && cols <= 0) @@ -2038,58 +2038,58 @@ meta_screen_calc_workspace_layout (MetaScreen *screen, cols = 1; g_assert (rows != 0 && cols != 0); - + grid_area = rows * cols; - + meta_verbose ("Getting layout rows = %d cols = %d current = %d " "num_spaces = %d vertical = %s corner = %s\n", rows, cols, current_space, num_workspaces, screen->vertical_workspaces ? "(true)" : "(false)", meta_screen_corner_to_string (screen->starting_corner)); - - /* ok, we want to setup the distances in the workspace array to go - * in each direction. Remember, there are many ways that a workspace - * array can be setup. - * see http://www.freedesktop.org/standards/wm-spec/1.2/html/x109.html - * and look at the _NET_DESKTOP_LAYOUT section for details. + + /* ok, we want to setup the distances in the workspace array to go + * in each direction. Remember, there are many ways that a workspace + * array can be setup. + * see http://www.freedesktop.org/standards/wm-spec/1.2/html/x109.html + * and look at the _NET_DESKTOP_LAYOUT section for details. * For instance: */ - /* starting_corner = META_SCREEN_TOPLEFT + /* starting_corner = META_SCREEN_TOPLEFT * vertical_workspaces = 0 vertical_workspaces=1 - * 1234 1357 - * 5678 2468 - * - * starting_corner = META_SCREEN_TOPRIGHT + * 1234 1357 + * 5678 2468 + * + * starting_corner = META_SCREEN_TOPRIGHT * vertical_workspaces = 0 vertical_workspaces=1 - * 4321 7531 - * 8765 8642 - * - * starting_corner = META_SCREEN_BOTTOMLEFT + * 4321 7531 + * 8765 8642 + * + * starting_corner = META_SCREEN_BOTTOMLEFT * vertical_workspaces = 0 vertical_workspaces=1 - * 5678 2468 - * 1234 1357 - * - * starting_corner = META_SCREEN_BOTTOMRIGHT + * 5678 2468 + * 1234 1357 + * + * starting_corner = META_SCREEN_BOTTOMRIGHT * vertical_workspaces = 0 vertical_workspaces=1 - * 8765 8642 - * 4321 7531 + * 8765 8642 + * 4321 7531 * */ /* keep in mind that we could have a ragged layout, e.g. the "8" * in the above grids could be missing */ - + grid = g_new (int, grid_area); current_row = -1; current_col = -1; i = 0; - - switch (screen->starting_corner) + + switch (screen->starting_corner) { case META_SCREEN_TOPLEFT: - if (screen->vertical_workspaces) + if (screen->vertical_workspaces) { c = 0; while (c < cols) @@ -2121,7 +2121,7 @@ meta_screen_calc_workspace_layout (MetaScreen *screen, } break; case META_SCREEN_TOPRIGHT: - if (screen->vertical_workspaces) + if (screen->vertical_workspaces) { c = cols - 1; while (c >= 0) @@ -2153,7 +2153,7 @@ meta_screen_calc_workspace_layout (MetaScreen *screen, } break; case META_SCREEN_BOTTOMLEFT: - if (screen->vertical_workspaces) + if (screen->vertical_workspaces) { c = 0; while (c < cols) @@ -2185,7 +2185,7 @@ meta_screen_calc_workspace_layout (MetaScreen *screen, } break; case META_SCREEN_BOTTOMRIGHT: - if (screen->vertical_workspaces) + if (screen->vertical_workspaces) { c = cols - 1; while (c >= 0) @@ -2216,12 +2216,12 @@ meta_screen_calc_workspace_layout (MetaScreen *screen, } } break; - } + } if (i != grid_area) meta_bug ("did not fill in the whole workspace grid in %s (%d filled)\n", G_STRFUNC, i); - + current_row = 0; current_col = 0; r = 0; @@ -2302,13 +2302,13 @@ void meta_screen_resize (MetaScreen *screen, int width, int height) -{ +{ screen->rect.width = width; screen->rect.height = height; reload_xinerama_infos (screen); set_desktop_geometry_hint (screen); - + /* Queue a resize on all the windows */ meta_screen_foreach_window (screen, meta_screen_resize_func, 0); } @@ -2319,7 +2319,7 @@ meta_screen_update_showing_desktop_hint (MetaScreen *screen) unsigned long data[1]; data[0] = screen->active_workspace->showing_desktop ? 1 : 0; - + meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, screen->display->atom__NET_SHOWING_DESKTOP, @@ -2347,7 +2347,7 @@ queue_windows_showing (MetaScreen *screen) if (w->screen == screen) meta_window_queue (w, META_QUEUE_CALC_SHOWING); - + tmp = tmp->next; } @@ -2362,32 +2362,32 @@ meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen, GList *tmp; windows = screen->active_workspace->windows; - + tmp = windows; while (tmp != NULL) { MetaWindow *w = tmp->data; - + if (w->screen == screen && w->has_minimize_func && w != keep) meta_window_minimize (w); - + tmp = tmp->next; } } void -meta_screen_show_desktop (MetaScreen *screen, +meta_screen_show_desktop (MetaScreen *screen, guint32 timestamp) { GList *windows; if (screen->active_workspace->showing_desktop) return; - + screen->active_workspace->showing_desktop = TRUE; - + queue_windows_showing (screen); /* Focus the most recently used META_WINDOW_DESKTOP window, if there is one; @@ -2397,18 +2397,18 @@ meta_screen_show_desktop (MetaScreen *screen, while (windows != NULL) { MetaWindow *w = windows->data; - - if (w->screen == screen && + + if (w->screen == screen && w->type == META_WINDOW_DESKTOP) { meta_window_focus (w, timestamp); break; } - + windows = windows->next; } - + meta_screen_update_showing_desktop_hint (screen); } @@ -2475,11 +2475,11 @@ remove_sequence (MetaScreen *screen, meta_topic (META_DEBUG_STARTUP, "Removing sequence %s\n", sn_startup_sequence_get_id (sequence)); - + screen->startup_sequences = g_slist_remove (screen->startup_sequences, sequence); sn_startup_sequence_unref (sequence); - + if (screen->startup_sequences == NULL && screen->startup_sequence_timeout != 0) { @@ -2511,7 +2511,7 @@ collect_timed_out_foreach (void *element, SnStartupSequence *sequence = element; long tv_sec, tv_usec; double elapsed; - + sn_startup_sequence_get_last_active_time (sequence, &tv_sec, &tv_usec); elapsed = @@ -2522,7 +2522,7 @@ collect_timed_out_foreach (void *element, "Sequence used %g seconds vs. %g max: %s\n", elapsed, (double) STARTUP_TIMEOUT, sn_startup_sequence_get_id (sequence)); - + if (elapsed > STARTUP_TIMEOUT) ctod->list = g_slist_prepend (ctod->list, sequence); } @@ -2533,7 +2533,7 @@ startup_sequence_timeout (void *data) MetaScreen *screen = data; CollectTimedOutData ctod; GSList *tmp; - + ctod.list = NULL; g_get_current_time (&ctod.now); g_slist_foreach (screen->startup_sequences, @@ -2548,14 +2548,14 @@ startup_sequence_timeout (void *data) meta_topic (META_DEBUG_STARTUP, "Timed out sequence %s\n", sn_startup_sequence_get_id (sequence)); - + sn_startup_sequence_complete (sequence); - + tmp = tmp->next; } g_slist_free (ctod.list); - + if (screen->startup_sequences != NULL) { return TRUE; @@ -2574,11 +2574,11 @@ meta_screen_sn_event (SnMonitorEvent *event, { MetaScreen *screen; SnStartupSequence *sequence; - + screen = user_data; sequence = sn_monitor_event_get_startup_sequence (event); - + switch (sn_monitor_event_get_type (event)) { case SN_MONITOR_EVENT_INITIATED: @@ -2586,7 +2586,7 @@ meta_screen_sn_event (SnMonitorEvent *event, const char *wmclass; wmclass = sn_startup_sequence_get_wmclass (sequence); - + meta_topic (META_DEBUG_STARTUP, "Received startup initiated for %s wmclass %s\n", sn_startup_sequence_get_id (sequence), @@ -2636,7 +2636,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, const char *startup_id; GSList *tmp; SnStartupSequence *sequence; - + /* Does the window have a startup ID stored? */ startup_id = meta_window_get_startup_id (window); @@ -2644,7 +2644,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, "Applying startup props to %s id \"%s\"\n", window->desc, startup_id ? startup_id : "(none)"); - + sequence = NULL; if (startup_id == NULL) { @@ -2675,11 +2675,11 @@ meta_screen_apply_startup_properties (MetaScreen *screen, "Ending legacy sequence %s due to window %s\n", sn_startup_sequence_get_id (sequence), window->desc); - + sn_startup_sequence_complete (sequence); break; } - + tmp = tmp->next; } } @@ -2687,7 +2687,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, /* Still no startup ID? Bail. */ if (startup_id == NULL) return FALSE; - + /* We might get this far and not know the sequence ID (if the window * already had a startup ID stored), so let's look for one if we don't * already know it. @@ -2698,15 +2698,15 @@ meta_screen_apply_startup_properties (MetaScreen *screen, while (tmp != NULL) { const char *id; - + id = sn_startup_sequence_get_id (tmp->data); - + if (strcmp (id, startup_id) == 0) { sequence = tmp->data; break; } - + tmp = tmp->next; } } @@ -2714,7 +2714,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, if (sequence != NULL) { gboolean changed_something = FALSE; - + meta_topic (META_DEBUG_STARTUP, "Found startup sequence for window %s ID \"%s\"\n", window->desc, startup_id); @@ -2727,7 +2727,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, meta_topic (META_DEBUG_STARTUP, "Setting initial window workspace to %d based on startup info\n", space); - + window->initial_workspace_set = TRUE; window->initial_workspace = space; changed_something = TRUE; @@ -2740,7 +2740,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, meta_topic (META_DEBUG_STARTUP, "Setting initial window timestamp to %u based on startup info\n", timestamp); - + window->initial_timestamp_set = TRUE; window->initial_timestamp = timestamp; changed_something = TRUE; @@ -2754,7 +2754,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, "Did not find startup sequence for window %s ID \"%s\"\n", window->desc, startup_id); } - + #endif /* HAVE_STARTUP_NOTIFICATION */ return FALSE; @@ -2778,7 +2778,7 @@ meta_screen_get_xroot (MetaScreen *screen) return screen->xroot; } -void +void meta_screen_get_size (MetaScreen *screen, int *width, int *height) @@ -2813,7 +2813,7 @@ meta_screen_set_cm_selection (MetaScreen *screen) g_snprintf (selection, sizeof(selection), "_NET_WM_CM_S%d", screen->number); meta_verbose ("Setting selection: %s\n", selection); a = XInternAtom (screen->display->xdisplay, selection, FALSE); - XSetSelectionOwner (screen->display->xdisplay, a, + XSetSelectionOwner (screen->display->xdisplay, a, screen->wm_cm_selection_window, screen->wm_cm_timestamp); } diff --git a/src/core/session.c b/src/core/session.c index ab6b54e2..0c943a40 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -2,11 +2,11 @@ /* Metacity Session Management */ -/* +/* * Copyright (C) 2001 Havoc Pennington (some code in here from * libgnomeui, (C) Tom Tromey, Carsten Schaar) * Copyright (C) 2004, 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -74,7 +74,7 @@ meta_window_release_saved_state (const MetaWindowSessionInfo *info) static void ice_io_error_handler (IceConn connection); -static void new_ice_connection (IceConn connection, IcePointer client_data, +static void new_ice_connection (IceConn connection, IcePointer client_data, Bool opening, IcePointer *watch_data); static void save_state (void); @@ -104,7 +104,7 @@ process_ice_messages (GIOChannel *channel, #if 0 IcePointer context = IceGetConnectionContext (connection); #endif - + /* We were disconnected; close our connection to the * session manager, this will result in the ICE connection * being cleaned up, since it is owned by libSM. @@ -114,7 +114,7 @@ process_ice_messages (GIOChannel *channel, return FALSE; } - + return TRUE; } @@ -132,22 +132,22 @@ new_ice_connection (IceConn connection, IcePointer client_data, Bool opening, * exec'ed children */ GIOChannel *channel; - + fcntl (IceConnectionNumber (connection), F_SETFD, fcntl (IceConnectionNumber (connection), F_GETFD, 0) | FD_CLOEXEC); channel = g_io_channel_unix_new (IceConnectionNumber (connection)); - + input_id = g_io_add_watch (channel, G_IO_IN | G_IO_ERR, process_ice_messages, connection); g_io_channel_unref (channel); - + *watch_data = (IcePointer) GUINT_TO_POINTER (input_id); } - else + else { input_id = GPOINTER_TO_UINT ((gpointer) *watch_data); @@ -157,14 +157,14 @@ new_ice_connection (IceConn connection, IcePointer client_data, Bool opening, static IceIOErrorHandler ice_installed_handler; -/* We call any handler installed before (or after) gnome_ice_init but +/* We call any handler installed before (or after) gnome_ice_init but avoid calling the default libICE handler which does an exit() */ static void ice_io_error_handler (IceConn connection) { if (ice_installed_handler) (*ice_installed_handler) (connection); -} +} static void ice_init (void) @@ -233,7 +233,7 @@ meta_session_init (const char *previous_client_id, unsigned long mask; SmcCallbacks callbacks; char *saved_client_id; - + meta_topic (META_DEBUG_SM, "Initializing session with save file '%s'\n", previous_save_file ? previous_save_file : "(none)"); @@ -252,24 +252,24 @@ meta_session_init (const char *previous_client_id, { saved_client_id = NULL; } - + ice_init (); - + mask = SmcSaveYourselfProcMask | SmcDieProcMask | SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask; - + callbacks.save_yourself.callback = save_yourself_callback; callbacks.save_yourself.client_data = NULL; - + callbacks.die.callback = die_callback; callbacks.die.client_data = NULL; - + callbacks.save_complete.callback = save_complete_callback; callbacks.save_complete.client_data = NULL; - + callbacks.shutdown_cancelled.callback = shutdown_cancelled_callback; callbacks.shutdown_cancelled.client_data = NULL; - + session_connection = SmcOpenConnection (NULL, /* use SESSION_MANAGER env */ NULL, /* means use existing ICE connection */ @@ -280,10 +280,10 @@ meta_session_init (const char *previous_client_id, (char*) previous_client_id, &client_id, 255, buf); - + if (session_connection == NULL) { - meta_topic (META_DEBUG_SM, + meta_topic (META_DEBUG_SM, "Failed to a open connection to a session manager, so window positions will not be saved: %s\n", buf); @@ -300,14 +300,14 @@ meta_session_init (const char *previous_client_id, current_state = STATE_IDLE; else current_state = STATE_REGISTERING; - + { SmProp prop1, prop2, prop3, prop4, prop5, prop6, *props[6]; SmPropValue prop1val, prop2val, prop3val, prop4val, prop5val, prop6val; char pid[32]; char hint = SmRestartImmediately; char priority = 20; /* low to run before other apps */ - + prop1.name = SmProgram; prop1.type = SmARRAY8; prop1.num_vals = 1; @@ -324,7 +324,7 @@ meta_session_init (const char *previous_client_id, prop2.vals = &prop2val; prop2val.value = (char*) g_get_user_name (); prop2val.length = strlen (prop2val.value); - + prop3.name = SmRestartStyleHint; prop3.type = SmCARD8; prop3.num_vals = 1; @@ -338,7 +338,7 @@ meta_session_init (const char *previous_client_id, prop4.num_vals = 1; prop4.vals = &prop4val; prop4val.value = pid; - prop4val.length = strlen (prop4val.value); + prop4val.length = strlen (prop4val.value); /* Always start in home directory */ prop5.name = SmCurrentDirectory; @@ -354,14 +354,14 @@ meta_session_init (const char *previous_client_id, prop6.vals = &prop6val; prop6val.value = &priority; prop6val.length = 1; - + props[0] = &prop1; props[1] = &prop2; props[2] = &prop3; props[3] = &prop4; props[4] = &prop5; props[5] = &prop6; - + SmcSetProperties (session_connection, 6, props); } @@ -373,7 +373,7 @@ void meta_session_shutdown (void) { /* Change our restart mode to IfRunning */ - + SmProp prop1; SmPropValue prop1val; SmProp *props[1]; @@ -381,16 +381,16 @@ meta_session_shutdown (void) if (session_connection == NULL) return; - + prop1.name = SmRestartStyleHint; prop1.type = SmCARD8; prop1.num_vals = 1; prop1.vals = &prop1val; prop1val.value = &hint; prop1val.length = 1; - + props[0] = &prop1; - + SmcSetProperties (session_connection, 1, props); } @@ -409,11 +409,11 @@ save_yourself_possibly_done (gboolean shutdown, meta_topic (META_DEBUG_SM, "save possibly done shutdown = %d success = %d\n", shutdown, successful); - + if (current_state == STATE_SAVING_PHASE_1) { Status status; - + status = SmcRequestSaveYourselfPhase2 (session_connection, save_phase_2_callback, GINT_TO_POINTER (shutdown)); @@ -444,17 +444,17 @@ save_yourself_possibly_done (gboolean shutdown, meta_topic (META_DEBUG_SM, "Requested interact, status = %d\n", status); } - + if (current_state == STATE_SAVING_PHASE_1 || current_state == STATE_SAVING_PHASE_2 || current_state == STATE_DONE_WITH_INTERACT || current_state == STATE_SKIPPING_GLOBAL_SAVE) { meta_topic (META_DEBUG_SM, "Sending SaveYourselfDone\n"); - + SmcSaveYourselfDone (session_connection, successful); - + if (shutdown) current_state = STATE_FROZEN; else @@ -462,19 +462,19 @@ save_yourself_possibly_done (gboolean shutdown, } } -static void +static void save_phase_2_callback (SmcConn smc_conn, SmPointer client_data) { gboolean shutdown; meta_topic (META_DEBUG_SM, "Phase 2 save"); - + shutdown = GPOINTER_TO_INT (client_data); - + current_state = STATE_SAVING_PHASE_2; save_state (); - + save_yourself_possibly_done (shutdown, TRUE); } @@ -489,9 +489,9 @@ save_yourself_callback (SmcConn smc_conn, gboolean successful; meta_topic (META_DEBUG_SM, "SaveYourself received"); - + successful = TRUE; - + /* The first SaveYourself after registering for the first time * is a special case (SM specs 7.2). */ @@ -501,8 +501,8 @@ save_yourself_callback (SmcConn smc_conn, { current_state = STATE_IDLE; /* Double check that this is a section 7.2 SaveYourself: */ - - if (save_style == SmSaveLocal && + + if (save_style == SmSaveLocal && interact_style == SmInteractStyleNone && !shutdown && !fast) { @@ -514,7 +514,7 @@ save_yourself_callback (SmcConn smc_conn, #endif /* ignore Global style saves - * + * * This interpretaion of the Local/Global/Both styles * was discussed extensively on the xdg-list. See: * @@ -528,11 +528,11 @@ save_yourself_callback (SmcConn smc_conn, } interaction_allowed = interact_style != SmInteractStyleNone; - + current_state = STATE_SAVING_PHASE_1; regenerate_save_file (); - + set_clone_restart_commands (); save_yourself_possibly_done (shutdown, successful); @@ -558,7 +558,7 @@ static void shutdown_cancelled_callback (SmcConn smc_conn, SmPointer client_data) { meta_topic (META_DEBUG_SM, "Shutdown cancelled received\n"); - + if (session_connection != NULL && (current_state != STATE_IDLE && current_state != STATE_FROZEN)) { @@ -567,14 +567,14 @@ shutdown_cancelled_callback (SmcConn smc_conn, SmPointer client_data) } } -static void +static void interact_callback (SmcConn smc_conn, SmPointer client_data) { /* nothing */ gboolean shutdown; meta_topic (META_DEBUG_SM, "Interaction permission received\n"); - + shutdown = GPOINTER_TO_INT (client_data); current_state = STATE_DONE_WITH_INTERACT; @@ -590,14 +590,14 @@ set_clone_restart_commands (void) char *discardv[10]; int i; SmProp prop1, prop2, prop3, *props[3]; - + /* Restart (use same client ID) */ - + prop1.name = SmRestartCommand; prop1.type = SmLISTofARRAY8; - + g_return_if_fail (client_id); - + i = 0; restartv[i] = "metacity"; ++i; @@ -618,7 +618,7 @@ set_clone_restart_commands (void) prop1.num_vals = i; /* Clone (no client ID) */ - + i = 0; clonev[i] = "metacity"; ++i; @@ -626,7 +626,7 @@ set_clone_restart_commands (void) prop2.name = SmCloneCommand; prop2.type = SmLISTofARRAY8; - + prop2.vals = g_new (SmPropValue, i); i = 0; while (clonev[i]) @@ -638,7 +638,7 @@ set_clone_restart_commands (void) prop2.num_vals = i; /* Discard */ - + i = 0; discardv[i] = "rm"; ++i; @@ -647,10 +647,10 @@ set_clone_restart_commands (void) discardv[i] = (char*) full_save_file (); ++i; discardv[i] = NULL; - + prop3.name = SmDiscardCommand; prop3.type = SmLISTofARRAY8; - + prop3.vals = g_new (SmPropValue, i); i = 0; while (discardv[i]) @@ -661,11 +661,11 @@ set_clone_restart_commands (void) } prop3.num_vals = i; - + props[0] = &prop1; props[1] = &prop2; props[2] = &prop3; - + SmcSetProperties (session_connection, 3, props); g_free (prop1.vals); @@ -704,7 +704,7 @@ window_type_to_string (MetaWindowType type) } return ""; -} +} static MetaWindowType window_type_from_string (const char *str) @@ -767,7 +767,7 @@ encode_text_as_utf8_markup (const char *text) GString *str; const char *p; char *escaped; - + str = g_string_new (""); p = text; @@ -779,7 +779,7 @@ encode_text_as_utf8_markup (const char *text) escaped = g_markup_escape_text (str->str, str->len); g_string_free (str, TRUE); - + return escaped; } @@ -791,7 +791,7 @@ decode_text_from_utf8 (const char *text) const char *p; str = g_string_new (""); - + p = text; while (*p) { @@ -813,11 +813,11 @@ save_state (void) GSList *windows; GSList *tmp; int stack_position; - + g_assert (client_id); outfile = NULL; - + /* * g_get_user_config_dir() is guaranteed to return an existing directory. * Eventually, if SM stays with the WM, I'd like to make this @@ -829,7 +829,7 @@ save_state (void) metacity_dir = g_strconcat (g_get_user_config_dir (), G_DIR_SEPARATOR_S "metacity", NULL); - + session_dir = g_strconcat (metacity_dir, G_DIR_SEPARATOR_S "sessions", NULL); @@ -849,7 +849,7 @@ save_state (void) } meta_topic (META_DEBUG_SM, "Saving session to '%s'\n", full_save_file ()); - + outfile = fopen (full_save_file (), "w"); if (outfile == NULL) @@ -872,9 +872,9 @@ save_state (void) * Note that attributes on <window> are the match info we use to * see if the saved state applies to a restored window, and * child elements are the saved state to be applied. - * + * */ - + fprintf (outfile, "<metacity_session id=\"%s\">\n", client_id); @@ -903,7 +903,7 @@ save_state (void) * in UTF-8 (I think they are in XPCS which is Latin-1? * in practice they are always ascii though.) */ - + sm_client_id = encode_text_as_utf8_markup (window->sm_client_id); res_class = window->res_class ? encode_text_as_utf8_markup (window->res_class) : NULL; @@ -915,7 +915,7 @@ save_state (void) title = g_markup_escape_text (window->title, -1); else title = NULL; - + meta_topic (META_DEBUG_SM, "Saving session managed window %s, client ID '%s'\n", window->desc, window->sm_client_id); @@ -934,7 +934,7 @@ save_state (void) g_free (res_name); g_free (role); g_free (title); - + /* Sticky */ if (window->on_all_workspaces) fputs (" <sticky/>\n", outfile); @@ -947,13 +947,13 @@ save_state (void) if (META_WINDOW_MAXIMIZED (window)) { fprintf (outfile, - " <maximized saved_x=\"%d\" saved_y=\"%d\" saved_width=\"%d\" saved_height=\"%d\"/>\n", + " <maximized saved_x=\"%d\" saved_y=\"%d\" saved_width=\"%d\" saved_height=\"%d\"/>\n", window->saved_rect.x, window->saved_rect.y, window->saved_rect.width, window->saved_rect.height); } - + /* Workspaces we're on */ { int n; @@ -966,13 +966,13 @@ save_state (void) { int x, y, w, h; meta_window_get_geometry (window, &x, &y, &w, &h); - + fprintf (outfile, " <geometry x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" gravity=\"%s\"/>\n", x, y, w, h, meta_gravity_to_string (window->size_hints.win_gravity)); } - + fputs (" </window>\n", outfile); } else @@ -980,15 +980,15 @@ save_state (void) meta_topic (META_DEBUG_SM, "Not saving window '%s', not session managed\n", window->desc); } - + tmp = tmp->next; ++stack_position; } - + g_slist_free (windows); fputs ("</metacity_session>\n", outfile); - + out: if (outfile) { @@ -1004,7 +1004,7 @@ save_state (void) full_save_file (), g_strerror (errno)); } } - + g_free (metacity_dir); g_free (session_dir); } @@ -1085,7 +1085,7 @@ load_state (const char *previous_save_file) G_DIR_SEPARATOR_S, previous_save_file, NULL); - + if (!g_file_get_contents (session_file, &text, &length, @@ -1105,10 +1105,10 @@ load_state (const char *previous_save_file) meta_topic (META_DEBUG_SM, "Parsing saved session file %s\n", session_file); g_free (session_file); session_file = NULL; - + parse_data.info = NULL; parse_data.previous_id = NULL; - + context = g_markup_parse_context_new (&metacity_session_parser, 0, &parse_data, NULL); @@ -1118,8 +1118,8 @@ load_state (const char *previous_save_file) length, &error)) goto error; - - + + error = NULL; if (!g_markup_parse_context_end_parse (context, &error)) goto error; @@ -1129,7 +1129,7 @@ load_state (const char *previous_save_file) goto out; error: - + meta_warning (_("Failed to parse saved session file: %s\n"), error->message); g_error_free (error); @@ -1139,9 +1139,9 @@ load_state (const char *previous_save_file) g_free (parse_data.previous_id); parse_data.previous_id = NULL; - + out: - + g_free (text); return parse_data.previous_id; @@ -1163,14 +1163,14 @@ start_element_handler (GMarkupParseContext *context, if (strcmp (element_name, "metacity_session") == 0) { /* Get previous ID */ - int i; + int i; i = 0; while (attribute_names[i]) { const char *name; const char *val; - + name = attribute_names[i]; val = attribute_values[i]; @@ -1182,7 +1182,7 @@ start_element_handler (GMarkupParseContext *context, _("<metacity_session> attribute seen but we already have the session ID")); return; } - + if (strcmp (name, "id") == 0) { pd->previous_id = decode_text_from_utf8 (val); @@ -1196,14 +1196,14 @@ start_element_handler (GMarkupParseContext *context, name, "metacity_session"); return; } - + ++i; } } else if (strcmp (element_name, "window") == 0) { int i; - + if (pd->info) { g_set_error (error, @@ -1212,7 +1212,7 @@ start_element_handler (GMarkupParseContext *context, _("nested <window> tag")); return; } - + pd->info = session_info_new (); i = 0; @@ -1220,10 +1220,10 @@ start_element_handler (GMarkupParseContext *context, { const char *name; const char *val; - + name = attribute_names[i]; val = attribute_values[i]; - + if (strcmp (name, "id") == 0) { if (*val) @@ -1273,7 +1273,7 @@ start_element_handler (GMarkupParseContext *context, pd->info = NULL; return; } - + ++i; } } @@ -1287,7 +1287,7 @@ start_element_handler (GMarkupParseContext *context, const char *name; name = attribute_names[i]; - + if (strcmp (name, "index") == 0) { pd->info->workspace_indices = @@ -1305,7 +1305,7 @@ start_element_handler (GMarkupParseContext *context, pd->info = NULL; return; } - + ++i; } } @@ -1385,22 +1385,22 @@ start_element_handler (GMarkupParseContext *context, pd->info->saved_rect.y, pd->info->saved_rect.width, pd->info->saved_rect.height); - } + } else if (strcmp (element_name, "geometry") == 0) { int i; pd->info->geometry_set = TRUE; - + i = 0; while (attribute_names[i]) { const char *name; const char *val; - + name = attribute_names[i]; val = attribute_values[i]; - + if (strcmp (name, "x") == 0) { if (*val) @@ -1435,7 +1435,7 @@ start_element_handler (GMarkupParseContext *context, name, "geometry"); return; } - + ++i; } @@ -1473,12 +1473,12 @@ end_element_handler (GMarkupParseContext *context, window_info_list = g_slist_prepend (window_info_list, pd->info); - + meta_topic (META_DEBUG_SM, "Loaded window info from session with class: %s name: %s role: %s\n", pd->info->res_class ? pd->info->res_class : "(none)", pd->info->res_name ? pd->info->res_name : "(none)", pd->info->role ? pd->info->role : "(none)"); - + pd->info = NULL; } } @@ -1514,20 +1514,20 @@ get_possible_matches (MetaWindow *window) GSList *retval; GSList *tmp; gboolean ignore_client_id; - + retval = NULL; ignore_client_id = g_getenv ("METACITY_DEBUG_SM") != NULL; - + tmp = window_info_list; while (tmp != NULL) { MetaWindowSessionInfo *info; info = tmp->data; - + if ((ignore_client_id || - both_null_or_matching (info->id, window->sm_client_id)) && + both_null_or_matching (info->id, window->sm_client_id)) && both_null_or_matching (info->res_class, window->res_class) && both_null_or_matching (info->res_name, window->res_name) && both_null_or_matching (info->role, window->role)) @@ -1554,7 +1554,7 @@ get_possible_matches (MetaWindow *window) window->desc, window->res_class ? window->res_class : "(none)", info->res_class ? info->res_class : "(none)"); - + else if (!both_null_or_matching (info->res_name, window->res_name)) meta_topic (META_DEBUG_SM, "Window %s has name %s doesn't match saved name %s, no match\n", window->desc, @@ -1570,7 +1570,7 @@ get_possible_matches (MetaWindow *window) window->desc, info->id); } } - + tmp = tmp->next; } @@ -1584,10 +1584,10 @@ find_best_match (GSList *infos, GSList *tmp; const MetaWindowSessionInfo *matching_title; const MetaWindowSessionInfo *matching_type; - + matching_title = NULL; matching_type = NULL; - + tmp = infos; while (tmp != NULL) { @@ -1602,7 +1602,7 @@ find_best_match (GSList *infos, if (matching_type == NULL && info->type == window->type) matching_type = info; - + tmp = tmp->next; } @@ -1611,7 +1611,7 @@ find_best_match (GSList *infos, * to e.g. break ties by geometry hint similarity, * or other window features. */ - + if (matching_title) return matching_title; else if (matching_type) @@ -1625,7 +1625,7 @@ meta_window_lookup_saved_state (MetaWindow *window) { GSList *possibles; const MetaWindowSessionInfo *info; - + /* Window is not session managed. * I haven't yet figured out how to deal with these * in a way that doesn't cause broken side effects in @@ -1649,9 +1649,9 @@ meta_window_lookup_saved_state (MetaWindow *window) } info = find_best_match (possibles, window); - + g_slist_free (possibles); - + return info; } @@ -1676,7 +1676,7 @@ session_info_free (MetaWindowSessionInfo *info) g_free (info->role); g_slist_free (info->workspace_indices); - + g_free (info); } @@ -1689,7 +1689,7 @@ session_info_new (void) info->type = META_WINDOW_NORMAL; info->gravity = NorthWestGravity; - + return info; } @@ -1730,7 +1730,7 @@ finish_interact (gboolean shutdown) if (current_state == STATE_DONE_WITH_INTERACT) /* paranoia */ { SmcInteractDone (session_connection, False /* don't cancel logout */); - + save_yourself_possibly_done (shutdown, TRUE); } } @@ -1755,13 +1755,13 @@ warn_about_lame_clients_and_finish_interact (gboolean shutdown) GSList *tmp; GSList *columns = NULL; GPid pid; - + windows = meta_display_list_windows (meta_get_display ()); tmp = windows; while (tmp != NULL) { MetaWindow *window; - + window = tmp->data; /* only complain about normal windows, the others @@ -1770,12 +1770,12 @@ warn_about_lame_clients_and_finish_interact (gboolean shutdown) if (window->sm_client_id == NULL && window->type == META_WINDOW_NORMAL) lame = g_slist_prepend (lame, window); - + tmp = tmp->next; } - + g_slist_free (windows); - + if (lame == NULL) { /* No lame apps. */ diff --git a/src/core/session.h b/src/core/session.h index c032ff10..e991ffc9 100644 --- a/src/core/session.h +++ b/src/core/session.h @@ -9,9 +9,9 @@ * requires us to do it here. */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -21,7 +21,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -45,11 +45,11 @@ struct _MetaWindowSessionInfo MetaWindowType type; /* Information we restore */ - - GSList *workspace_indices; + + GSList *workspace_indices; int stack_position; - + /* width/height should be multiplied by resize inc and * added to base size; position should be interpreted in * light of gravity. This preserves semantics of the diff --git a/src/core/stack.c b/src/core/stack.c index a619f960..cb6200f7 100644 --- a/src/core/stack.c +++ b/src/core/stack.c @@ -4,12 +4,12 @@ * \file stack.c Which windows cover which other windows */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002, 2003 Red Hat, Inc. * Copyright (C) 2004 Rob Adams * Copyright (C) 2004, 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -19,7 +19,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -64,7 +64,7 @@ MetaStack* meta_stack_new (MetaScreen *screen) { MetaStack *stack; - + stack = g_new (MetaStack, 1); stack->screen = screen; @@ -82,7 +82,7 @@ meta_stack_new (MetaScreen *screen) stack->need_resort = FALSE; stack->need_relayer = FALSE; stack->need_constrain = FALSE; - + return stack; } @@ -97,7 +97,7 @@ meta_stack_free (MetaStack *stack) if (stack->last_root_children_stacked) g_array_free (stack->last_root_children_stacked, TRUE); - + g_free (stack); } @@ -109,7 +109,7 @@ meta_stack_add (MetaStack *stack, if (window->stack_position >= 0) meta_bug ("Window %s had stack position already\n", window->desc); - + stack->added = g_list_prepend (stack->added, window); window->stack_position = stack->n_positions; @@ -117,7 +117,7 @@ meta_stack_add (MetaStack *stack, meta_topic (META_DEBUG_STACK, "Window %s has stack_position initialized to %d\n", window->desc, window->stack_position); - + stack_sync_to_server (stack); } @@ -137,7 +137,7 @@ meta_stack_remove (MetaStack *stack, meta_window_set_stack_position_no_sync (window, stack->n_positions - 1); window->stack_position = -1; - stack->n_positions -= 1; + stack->n_positions -= 1; /* We don't know if it's been moved from "added" to "stack" yet */ stack->added = g_list_remove (stack->added, window); @@ -152,7 +152,7 @@ meta_stack_remove (MetaStack *stack, if (window->frame) stack->removed = g_list_prepend (stack->removed, GUINT_TO_POINTER (window->frame->xwindow)); - + stack_sync_to_server (stack); } @@ -161,7 +161,7 @@ meta_stack_update_layer (MetaStack *stack, MetaWindow *window) { stack->need_relayer = TRUE; - + stack_sync_to_server (stack); } @@ -170,7 +170,7 @@ meta_stack_update_transient (MetaStack *stack, MetaWindow *window) { stack->need_constrain = TRUE; - + stack_sync_to_server (stack); } @@ -178,10 +178,10 @@ meta_stack_update_transient (MetaStack *stack, void meta_stack_raise (MetaStack *stack, MetaWindow *window) -{ +{ meta_window_set_stack_position_no_sync (window, stack->n_positions - 1); - + stack_sync_to_server (stack); } @@ -190,7 +190,7 @@ meta_stack_lower (MetaStack *stack, MetaWindow *window) { meta_window_set_stack_position_no_sync (window, 0); - + stack_sync_to_server (stack); } @@ -204,7 +204,7 @@ void meta_stack_thaw (MetaStack *stack) { g_return_if_fail (stack->freeze_count > 0); - + stack->freeze_count -= 1; stack_sync_to_server (stack); } @@ -238,7 +238,7 @@ get_standalone_layer (MetaWindow *window) { MetaStackLayer layer; gboolean focused_transient = FALSE; - + switch (window->type) { case META_WINDOW_DESKTOP: @@ -253,7 +253,7 @@ get_standalone_layer (MetaWindow *window) layer = META_LAYER_DOCK; break; - default: + default: meta_window_foreach_transient (window, is_focused_foreach, &focused_transient); @@ -289,16 +289,16 @@ get_maximum_layer_in_group (MetaWindow *window) GSList *tmp; MetaStackLayer max; MetaStackLayer layer; - + max = META_LAYER_DESKTOP; - + group = meta_window_get_group (window); if (group != NULL) members = meta_group_list_windows (group); else members = NULL; - + tmp = members; while (tmp != NULL) { @@ -307,12 +307,12 @@ get_maximum_layer_in_group (MetaWindow *window) layer = get_standalone_layer (w); if (layer > max) max = layer; - + tmp = tmp->next; } g_slist_free (members); - + return max; } @@ -320,7 +320,7 @@ static void compute_layer (MetaWindow *window) { window->layer = get_standalone_layer (window); - + /* We can only do promotion-due-to-group for dialogs and other * transients, or weird stuff happens like the desktop window and * nautilus windows getting in the same layer, or all gnome-terminal @@ -336,11 +336,11 @@ compute_layer (MetaWindow *window) * and a dialog transient for the normal window; you don't want the dialog * above the dock if it wouldn't normally be. */ - + MetaStackLayer group_max; - + group_max = get_maximum_layer_in_group (window); - + if (group_max > window->layer) { meta_topic (META_DEBUG_STACK, @@ -377,10 +377,10 @@ compare_window_position (void *a, else return 0; /* not reached */ } - + /* * Stacking constraints - * + * * Assume constraints of the form "AB" meaning "window A must be * below window B" * @@ -397,14 +397,14 @@ compare_window_position (void *a, * apply BC: ABC * * but apply constraints in the wrong order and it breaks: - * + * * start: BCA * apply BC: BCA * apply AB: CAB * * We make a directed graph of the constraints by linking * from "above windows" to "below windows as follows: - * + * * AB -> BC -> CD * \ * CE @@ -429,7 +429,7 @@ struct Constraint /* used to create the graph. */ GSList *next_nodes; - + /* constraint has been applied, used * to detect cycles. */ @@ -457,7 +457,7 @@ add_constraint (Constraint **constraints, Constraint *c; g_assert (above->screen == below->screen); - + /* check if constraint is a duplicate */ c = constraints[below->stack_position]; while (c != NULL) @@ -484,7 +484,7 @@ create_constraints (Constraint **constraints, GList *windows) { GList *tmp; - + tmp = windows; while (tmp != NULL) { @@ -497,7 +497,7 @@ create_constraints (Constraint **constraints, tmp = tmp->next; continue; } - + if (WINDOW_TRANSIENT_FOR_WHOLE_GROUP (w)) { GSList *group_windows; @@ -510,9 +510,9 @@ create_constraints (Constraint **constraints, group_windows = meta_group_list_windows (group); else group_windows = NULL; - + tmp2 = group_windows; - + while (tmp2 != NULL) { MetaWindow *group_window = tmp2->data; @@ -523,7 +523,7 @@ create_constraints (Constraint **constraints, tmp2 = tmp2->next; continue; } - + #if 0 /* old way of doing it */ if (!(meta_window_is_ancestor_of_transient (w, group_window)) && @@ -539,7 +539,7 @@ create_constraints (Constraint **constraints, w->desc, group_window->desc); add_constraint (constraints, w, group_window); } - + tmp2 = tmp2->next; } @@ -549,7 +549,7 @@ create_constraints (Constraint **constraints, !w->transient_parent_is_root_window) { MetaWindow *parent; - + parent = meta_display_lookup_x_window (w->display, w->xtransient_for); @@ -561,7 +561,7 @@ create_constraints (Constraint **constraints, add_constraint (constraints, w, parent); } } - + tmp = tmp->next; } } @@ -580,12 +580,12 @@ graph_constraints (Constraint **constraints, /* If we have "A below B" and "B below C" then AB -> BC so we * add BC to next_nodes in AB. */ - + c = constraints[i]; while (c != NULL) { Constraint *n; - + g_assert (c->below->stack_position == i); /* Constraints where ->above is below are our @@ -598,10 +598,10 @@ graph_constraints (Constraint **constraints, n); /* c is a previous node of n */ n->has_prev = TRUE; - + n = n->next; } - + c = c->next; } @@ -619,16 +619,16 @@ free_constraints (Constraint **constraints, while (i < n_constraints) { Constraint *c; - + c = constraints[i]; while (c != NULL) { Constraint *next = c->next; - + g_slist_free (c->next_nodes); g_free (c); - + c = next; } @@ -639,7 +639,7 @@ free_constraints (Constraint **constraints, static void ensure_above (MetaWindow *above, MetaWindow *below) -{ +{ if (WINDOW_HAS_TRANSIENT_TYPE(above) && above->layer < below->layer) { @@ -667,10 +667,10 @@ traverse_constraint (Constraint *c) if (c->applied) return; - + ensure_above (c->above, c->below); c->applied = TRUE; - + tmp = c->next_nodes; while (tmp != NULL) { @@ -694,13 +694,13 @@ apply_constraints (Constraint **constraints, while (i < n_constraints) { Constraint *c; - + c = constraints[i]; while (c != NULL) { if (!c->has_prev) heads = g_slist_prepend (heads, c); - + c = c->next; } @@ -714,7 +714,7 @@ apply_constraints (Constraint **constraints, Constraint *c = tmp->data; traverse_constraint (c); - + tmp = tmp->next; } @@ -733,7 +733,7 @@ stack_do_window_deletions (MetaStack *stack) */ GList *tmp; int i; - + tmp = stack->removed; while (tmp != NULL) { @@ -747,7 +747,7 @@ stack_do_window_deletions (MetaStack *stack) while (i > 0) { --i; - + /* there's no guarantee we'll actually find windows to * remove, e.g. the same xwindow could have been * added/removed before we ever synced, and we put @@ -784,34 +784,34 @@ stack_do_window_additions (MetaStack *stack) meta_topic (META_DEBUG_STACK, "Adding %d windows to sorted list\n", n_added); - + old_size = stack->windows->len; g_array_set_size (stack->windows, old_size + n_added); - + end = &g_array_index (stack->windows, Window, old_size); /* stack->added has the most recent additions at the * front of the list, so we need to reverse it */ stack->added = g_list_reverse (stack->added); - + i = 0; tmp = stack->added; while (tmp != NULL) { MetaWindow *w; - + w = tmp->data; - + end[i] = w->xwindow; /* add to the main list */ stack->sorted = g_list_prepend (stack->sorted, w); - + ++i; tmp = tmp->next; } - + stack->need_resort = TRUE; /* may not be needed as we add to top */ stack->need_constrain = TRUE; stack->need_relayer = TRUE; @@ -828,13 +828,13 @@ static void stack_do_relayer (MetaStack *stack) { GList *tmp; - + if (!stack->need_relayer) return; - + meta_topic (META_DEBUG_STACK, "Recomputing layers\n"); - + tmp = stack->sorted; while (tmp != NULL) @@ -852,7 +852,7 @@ stack_do_relayer (MetaStack *stack) meta_topic (META_DEBUG_STACK, "Window %s moved from layer %u to %u\n", w->desc, old_layer, w->layer); - + stack->need_resort = TRUE; stack->need_constrain = TRUE; /* don't need to constrain as constraining @@ -860,7 +860,7 @@ stack_do_relayer (MetaStack *stack) * not layer */ } - + tmp = tmp->next; } @@ -877,7 +877,7 @@ stack_do_constrain (MetaStack *stack) Constraint **constraints; /* It'd be nice if this were all faster, probably */ - + if (!stack->need_constrain) return; @@ -892,10 +892,10 @@ stack_do_constrain (MetaStack *stack) graph_constraints (constraints, stack->n_positions); apply_constraints (constraints, stack->n_positions); - + free_constraints (constraints, stack->n_positions); g_free (constraints); - + stack->need_constrain = FALSE; } @@ -907,10 +907,10 @@ stack_do_resort (MetaStack *stack) { if (!stack->need_resort) return; - + meta_topic (META_DEBUG_STACK, "Sorting stack list\n"); - + stack->sorted = g_list_sort (stack->sorted, (GCompareFunc) compare_window_position); @@ -961,9 +961,9 @@ raise_window_relative_to_managed_windows (MetaScreen *screen, * we don't, since we know we won't manage any new windows * or restack any windows before using the XQueryTree results. */ - + meta_error_trap_push_with_return (screen->display); - + XQueryTree (screen->display->xdisplay, screen->xroot, &ignored1, &ignored2, &children, &n_children); @@ -999,7 +999,7 @@ raise_window_relative_to_managed_windows (MetaScreen *screen, children[i]) != NULL) { XWindowChanges changes; - + /* children[i] is the topmost managed child */ meta_topic (META_DEBUG_STACK, "Moving 0x%lx above topmost managed child window 0x%lx\n", @@ -1031,7 +1031,7 @@ raise_window_relative_to_managed_windows (MetaScreen *screen, xwindow); meta_error_trap_pop (screen->display, FALSE); } - + if (children) XFree (children); } @@ -1049,15 +1049,15 @@ stack_sync_to_server (MetaStack *stack) GArray *stacked; GArray *root_children_stacked; GList *tmp; - + /* Bail out if frozen */ if (stack->freeze_count > 0) return; - - meta_topic (META_DEBUG_STACK, "Syncing window stack to server\n"); + + meta_topic (META_DEBUG_STACK, "Syncing window stack to server\n"); stack_ensure_sorted (stack); - + /* Create stacked xwindow arrays. * Painfully, "stacked" is in bottom-to-top order for the * _NET hints, and "root_children_stacked" is in top-to-bottom @@ -1068,25 +1068,25 @@ stack_sync_to_server (MetaStack *stack) meta_topic (META_DEBUG_STACK, "Top to bottom: "); meta_push_no_msg_prefix (); - + tmp = stack->sorted; while (tmp != NULL) { MetaWindow *w; - + w = tmp->data; - + /* remember, stacked is in reverse order (bottom to top) */ g_array_prepend_val (stacked, w->xwindow); - + /* build XRestackWindows() array from top to bottom */ if (w->frame) g_array_append_val (root_children_stacked, w->frame->xwindow); else g_array_append_val (root_children_stacked, w->xwindow); - + meta_topic (META_DEBUG_STACK, "%u:%d - %s ", w->layer, w->stack_position, w->desc); - + tmp = tmp->next; } @@ -1097,12 +1097,12 @@ stack_sync_to_server (MetaStack *stack) if (stacked->len != stack->windows->len) meta_bug ("%u windows stacked, %u windows exist in stack\n", stacked->len, stack->windows->len); - + /* Sync to server */ meta_topic (META_DEBUG_STACK, "Restacking %u windows\n", root_children_stacked->len); - + meta_error_trap_push (stack->screen->display); if (stack->last_root_children_stacked == NULL) @@ -1134,7 +1134,7 @@ stack_sync_to_server (MetaStack *stack) const Window *old_end = old_stack + old_len; const Window *new_end = new_stack + new_len; Window last_window = None; - + while (oldp != old_end && newp != new_end) { @@ -1169,7 +1169,7 @@ stack_sync_to_server (MetaStack *stack) * *newp, then we fail to restack *newp; but on * unmanaging last_window, we'll fix it up. */ - + XWindowChanges changes; changes.sibling = last_window; @@ -1177,7 +1177,7 @@ stack_sync_to_server (MetaStack *stack) meta_topic (META_DEBUG_STACK, "Placing window 0x%lx below 0x%lx\n", *newp, last_window); - + XConfigureWindow (stack->screen->display->xdisplay, *newp, CWSibling | CWStackMode, @@ -1210,7 +1210,7 @@ stack_sync_to_server (MetaStack *stack) * get removed from the stacking list when we unmanage it * and we'll fix stacking at that time. */ - + /* Sync _NET_CLIENT_LIST and _NET_CLIENT_LIST_STACKING */ XChangeProperty (stack->screen->display->xdisplay, @@ -1233,7 +1233,7 @@ stack_sync_to_server (MetaStack *stack) if (stack->last_root_children_stacked) g_array_free (stack->last_root_children_stacked, TRUE); stack->last_root_children_stacked = root_children_stacked; - + /* That was scary... */ } @@ -1269,9 +1269,9 @@ meta_stack_get_above (MetaStack *stack, { GList *link; MetaWindow *above; - + stack_ensure_sorted (stack); - + link = g_list_find (stack->sorted, window); if (link == NULL) return NULL; @@ -1294,7 +1294,7 @@ meta_stack_get_below (MetaStack *stack, { GList *link; MetaWindow *below; - + stack_ensure_sorted (stack); link = g_list_find (stack->sorted, window); @@ -1303,7 +1303,7 @@ meta_stack_get_below (MetaStack *stack, return NULL; if (link->next == NULL) return NULL; - + below = link->next->data; if (only_within_layer && @@ -1345,7 +1345,7 @@ get_default_focus_window (MetaStack *stack, MetaWindow *topmost_overall; MetaGroup *not_this_one_group; GList *link; - + topmost_dock = NULL; transient_parent = NULL; topmost_in_group = NULL; @@ -1359,7 +1359,7 @@ get_default_focus_window (MetaStack *stack, /* top of this layer is at the front of the list */ link = stack->sorted; - + while (link) { MetaWindow *window = link->data; @@ -1447,22 +1447,22 @@ meta_stack_list_windows (MetaStack *stack, { GList *workspace_windows = NULL; GList *link; - + stack_ensure_sorted (stack); /* do adds/removes */ - + link = stack->sorted; - + while (link) { MetaWindow *window = link->data; - + if (window && (workspace == NULL || meta_window_located_on_workspace (window, workspace))) { workspace_windows = g_list_prepend (workspace_windows, window); } - + link = link->next; } @@ -1479,7 +1479,7 @@ meta_stack_windows_cmp (MetaStack *stack, /* -1 means a below b */ stack_ensure_sorted (stack); /* update constraints, layers */ - + if (window_a->layer < window_b->layer) return -1; else if (window_a->layer > window_b->layer) @@ -1529,7 +1529,7 @@ compare_pointers (gconstpointer a, return 1; else if (a < b) return -1; - else + else return 0; } @@ -1567,7 +1567,7 @@ meta_stack_set_positions (MetaStack *stack, /* Make sure any adds or removes aren't in limbo -- is this needed? */ stack_ensure_sorted (stack); - + if (!lists_contain_same_windows (windows, stack->sorted)) { meta_warning ("This list of windows has somehow changed; not resetting " @@ -1580,7 +1580,7 @@ meta_stack_set_positions (MetaStack *stack, stack->need_resort = TRUE; stack->need_constrain = TRUE; - + i = 0; tmp = windows; while (tmp != NULL) @@ -1589,7 +1589,7 @@ meta_stack_set_positions (MetaStack *stack, w->stack_position = i++; tmp = tmp->next; } - + meta_topic (META_DEBUG_STACK, "Reset the stack positions of (nearly) all windows\n"); @@ -1602,7 +1602,7 @@ meta_window_set_stack_position_no_sync (MetaWindow *window, { int low, high, delta; GList *tmp; - + g_return_if_fail (window->screen->stack != NULL); g_return_if_fail (window->stack_position >= 0); g_return_if_fail (position >= 0); @@ -1617,7 +1617,7 @@ meta_window_set_stack_position_no_sync (MetaWindow *window, window->screen->stack->need_resort = TRUE; window->screen->stack->need_constrain = TRUE; - + if (position < window->stack_position) { low = position; @@ -1642,7 +1642,7 @@ meta_window_set_stack_position_no_sync (MetaWindow *window, tmp = tmp->next; } - + window->stack_position = position; meta_topic (META_DEBUG_STACK, diff --git a/src/core/stack.h b/src/core/stack.h index f6d22f44..4e409cd3 100644 --- a/src/core/stack.h +++ b/src/core/stack.h @@ -4,7 +4,7 @@ * \file stack.h Which windows cover which other windows * * There are two factors that determine window position. - * + * * One is window->stack_position, which is a unique integer * indicating how windows are ordered with respect to one * another. The ordering here transcends layers; it isn't changed @@ -12,16 +12,16 @@ * windows from one layer to another, while preserving the relative * order of the moved windows. Also, it allows us to restore * the stacking order from a saved session. - * + * * However when actually stacking windows on the screen, the * layer overrides the stack_position; windows are first sorted * by layer, then by stack_position within each layer. */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -31,7 +31,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -97,7 +97,7 @@ struct _MetaStack * The order of the elements in this list is not important. */ GList *removed; - + /** * If this is zero, the local stack oughtn't to be brought up to date with * the X server's stack, because it is in the middle of being updated. @@ -297,7 +297,7 @@ MetaWindow* meta_stack_get_below (MetaStack *stack, * \param not_this_one Window to ignore because it's being unfocussed or * going away. * \return The window matching all these constraints or NULL if none does. - * + * * \bug Never called! */ MetaWindow* meta_stack_get_default_focus_window (MetaStack *stack, diff --git a/src/core/testasyncgetprop.c b/src/core/testasyncgetprop.c index 4f19f677..27ef4b22 100644 --- a/src/core/testasyncgetprop.c +++ b/src/core/testasyncgetprop.c @@ -94,14 +94,14 @@ x_error_handler (Display *xdisplay, if (error_trap_depth == 0) { print_backtrace (); - + fprintf (stderr, "Unexpected X error: %s serial %ld error_code %d request_code %d minor_code %d)\n", buf, error->serial, error->error_code, error->request_code, error->minor_code); - + exit (1); } @@ -122,7 +122,7 @@ error_trap_pop (Display *xdisplay) fprintf (stderr, "Error trap underflow!\n"); exit (1); } - + XSync (xdisplay, False); /* get all errors out of the queue */ --error_trap_depth; } @@ -192,11 +192,11 @@ try_get_reply (Display *xdisplay, struct timeval current_time; gettimeofday (¤t_time, NULL); - + printf (" %gms (we have a reply for property %ld)\n", ELAPSED (program_start_time, current_time), ag_task_get_property (task)); - + data = NULL; name = atom_name (xdisplay, @@ -204,7 +204,7 @@ try_get_reply (Display *xdisplay, printf (" %s on 0x%lx:\n", name, ag_task_get_window (task)); free (name); - + result = ag_task_get_reply_and_free (task, &actual_type, &actual_format, @@ -222,12 +222,12 @@ try_get_reply (Display *xdisplay, name = atom_name (xdisplay, actual_type); printf (" actual_type = %s\n", name); free (name); - + printf (" actual_format = %d\n", actual_format); - + printf (" n_items = %lu\n", n_items); printf (" bytes_after = %lu\n", bytes_after); - + printf (" data = \"%s\"\n", data ? (char*) data : "NULL"); } @@ -252,13 +252,13 @@ main (int argc, char **argv) char *end; Atom *props; struct timeval current_time; - + if (argc < 2) { fprintf (stderr, "specify window ID\n"); return 1; } - + window_str = argv[1]; end = NULL; @@ -280,7 +280,7 @@ main (int argc, char **argv) XSynchronize (xdisplay, True); XSetErrorHandler (x_error_handler); - + n_props = 0; props = XListProperties (xdisplay, window, &n_props); if (n_props == 0 || props == NULL) @@ -290,7 +290,7 @@ main (int argc, char **argv) } gettimeofday (&program_start_time, NULL); - + i = 0; while (i < n_props) { @@ -307,7 +307,7 @@ main (int argc, char **argv) fprintf (stderr, "Failed to send request\n"); return 1; } - + ++i; } @@ -315,24 +315,24 @@ main (int argc, char **argv) props = NULL; n_left = n_props; - + while (TRUE) { XEvent xevent; int connection; fd_set set; AgGetPropertyTask *task; - + /* Mop up event queue */ while (XPending (xdisplay) > 0) - { + { XNextEvent (xdisplay, &xevent); gettimeofday (¤t_time, NULL); printf (" %gms (processing event type %d)\n", ELAPSED (program_start_time, current_time), xevent.xany.type); } - + while ((task = ag_get_next_completed_task (xdisplay))) { try_get_reply (xdisplay, task); @@ -358,7 +358,7 @@ main (int argc, char **argv) } run_speed_comparison (xdisplay, window); - + return 0; } @@ -373,7 +373,7 @@ run_speed_comparison (Display *xdisplay, int n_props; struct timeval start, end; int n_left; - + /* We just use atom values (0 to n_props) % 200, many are probably * BadAtom, that's fine, but the %200 keeps most of them valid. The * async case is about twice as advantageous when using valid atoms @@ -382,9 +382,9 @@ run_speed_comparison (Display *xdisplay, */ n_props = 4000; printf ("Timing with %d property requests\n", n_props); - + gettimeofday (&start, NULL); - + i = 0; while (i < n_props) { @@ -397,23 +397,23 @@ run_speed_comparison (Display *xdisplay, fprintf (stderr, "Failed to send request\n"); exit (1); } - + ++i; } n_left = n_props; - + while (TRUE) { int connection; fd_set set; XEvent xevent; AgGetPropertyTask *task; - + /* Mop up event queue */ while (XPending (xdisplay) > 0) XNextEvent (xdisplay, &xevent); - + while ((task = ag_get_next_completed_task (xdisplay))) { Atom actual_type; @@ -423,7 +423,7 @@ run_speed_comparison (Display *xdisplay, unsigned char *data; assert (ag_task_have_reply (task)); - + data = NULL; ag_task_get_reply_and_free (task, &actual_type, @@ -431,13 +431,13 @@ run_speed_comparison (Display *xdisplay, &n_items, &bytes_after, &data); - + if (data) XFree (data); - + n_left -= 1; } - + if (n_left == 0) break; @@ -449,16 +449,16 @@ run_speed_comparison (Display *xdisplay, select (connection + 1, &set, NULL, NULL, NULL); } - + gettimeofday (&end, NULL); - + printf ("Async time: %gms\n", ELAPSED (start, end)); - + gettimeofday (&start, NULL); error_trap_push (xdisplay); - + i = 0; while (i < n_props) { @@ -467,7 +467,7 @@ run_speed_comparison (Display *xdisplay, unsigned long n_items; unsigned long bytes_after; unsigned char *data; - + data = NULL; if (XGetWindowProperty (xdisplay, window, (Atom) i % 200, @@ -483,14 +483,14 @@ run_speed_comparison (Display *xdisplay, if (data) XFree (data); } - + ++i; } error_trap_pop (xdisplay); - + gettimeofday (&end, NULL); - + printf ("Sync time: %gms\n", ELAPSED (start, end)); } diff --git a/src/core/testboxes.c b/src/core/testboxes.c index 670731ea..40a3278f 100644 --- a/src/core/testboxes.c +++ b/src/core/testboxes.c @@ -2,9 +2,9 @@ /* Metacity box operation testing program */ -/* +/* * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -369,7 +369,7 @@ test_merge_regions () * uniformly distributed location of center of struts (within screen) * merge all regions that are possible * print stats on problem setup - * number of (non-completely-occluded?) struts + * number of (non-completely-occluded?) struts * percentage of screen covered * length of resulting non-minimal spanning set * length of resulting minimal spanning set @@ -514,11 +514,11 @@ test_merge_regions () compare = compare->next; } - printf (" Num rectangles contained in others : %d\n", + printf (" Num rectangles contained in others : %d\n", num_contains); - printf (" Num rectangles partially contained in others: %d\n", + printf (" Num rectangles partially contained in others: %d\n", num_part_contains); - printf (" Num rectangles adjacent to others : %d\n", + printf (" Num rectangles adjacent to others : %d\n", num_adjacent); printf (" Num rectangles merged with others : %d\n", num_merged); @@ -589,9 +589,9 @@ test_regions_okay () GList* region; GList* tmp; - /*************************************************************/ + /*************************************************************/ /* Make sure test region 0 has the right spanning rectangles */ - /*************************************************************/ + /*************************************************************/ region = get_screen_region (0); tmp = NULL; tmp = g_list_prepend (tmp, new_meta_rect (0, 0, 1600, 1200)); @@ -599,9 +599,9 @@ test_regions_okay () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (region); - /*************************************************************/ + /*************************************************************/ /* Make sure test region 1 has the right spanning rectangles */ - /*************************************************************/ + /*************************************************************/ region = get_screen_region (1); tmp = NULL; tmp = g_list_prepend (tmp, new_meta_rect (0, 20, 400, 1180)); @@ -612,7 +612,7 @@ test_regions_okay () /*************************************************************/ /* Make sure test region 2 has the right spanning rectangles */ - /*************************************************************/ + /*************************************************************/ region = get_screen_region (2); tmp = NULL; tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 300, 1180)); @@ -626,7 +626,7 @@ test_regions_okay () /*************************************************************/ /* Make sure test region 3 has the right spanning rectangles */ - /*************************************************************/ + /*************************************************************/ region = get_screen_region (3); tmp = NULL; tmp = g_list_prepend (tmp, new_meta_rect ( 380, 675, 420, 525)); /* 220500 */ @@ -652,7 +652,7 @@ test_regions_okay () /*************************************************************/ /* Make sure test region 4 has the right spanning rectangles */ - /*************************************************************/ + /*************************************************************/ region = get_screen_region (4); tmp = NULL; tmp = g_list_prepend (tmp, new_meta_rect ( 800, 20, 800, 1180)); @@ -662,7 +662,7 @@ test_regions_okay () /*************************************************************/ /* Make sure test region 5 has the right spanning rectangles */ - /*************************************************************/ + /*************************************************************/ printf ("The next test intentionally causes a warning, " "but it can be ignored.\n"); region = get_screen_region (5); @@ -1026,9 +1026,9 @@ test_find_onscreen_edges () int top = META_DIRECTION_TOP; int bottom = META_DIRECTION_BOTTOM; - /*************************************************/ + /*************************************************/ /* Make sure test region 0 has the correct edges */ - /*************************************************/ + /*************************************************/ edges = get_screen_edges (0); tmp = NULL; tmp = g_list_prepend (tmp, new_screen_edge ( 0, 1200, 1600, 0, bottom)); @@ -1039,9 +1039,9 @@ test_find_onscreen_edges () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************/ + /*************************************************/ /* Make sure test region 1 has the correct edges */ - /*************************************************/ + /*************************************************/ edges = get_screen_edges (1); tmp = NULL; tmp = g_list_prepend (tmp, new_screen_edge ( 0, 1200, 400, 0, bottom)); @@ -1054,9 +1054,9 @@ test_find_onscreen_edges () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************/ + /*************************************************/ /* Make sure test region 2 has the correct edges */ - /*************************************************/ + /*************************************************/ edges = get_screen_edges (2); tmp = NULL; tmp = g_list_prepend (tmp, new_screen_edge (1200, 1200, 400, 0, bottom)); @@ -1075,9 +1075,9 @@ test_find_onscreen_edges () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************/ + /*************************************************/ /* Make sure test region 3 has the correct edges */ - /*************************************************/ + /*************************************************/ edges = get_screen_edges (3); tmp = NULL; tmp = g_list_prepend (tmp, new_screen_edge (1200, 1200, 400, 0, bottom)); @@ -1102,7 +1102,7 @@ test_find_onscreen_edges () char big_buffer1[(EDGE_LENGTH+2)*FUDGE], big_buffer2[(EDGE_LENGTH+2)*FUDGE]; meta_rectangle_edge_list_to_string (edges, "\n ", big_buffer1); meta_rectangle_edge_list_to_string (tmp, "\n ", big_buffer2); - printf("Generated edge list:\n %s\nComparison edges list:\n %s\n", + printf("Generated edge list:\n %s\nComparison edges list:\n %s\n", big_buffer1, big_buffer2); #endif @@ -1110,9 +1110,9 @@ test_find_onscreen_edges () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************/ + /*************************************************/ /* Make sure test region 4 has the correct edges */ - /*************************************************/ + /*************************************************/ edges = get_screen_edges (4); tmp = NULL; tmp = g_list_prepend (tmp, new_screen_edge ( 800, 1200, 800, 0, bottom)); @@ -1123,18 +1123,18 @@ test_find_onscreen_edges () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************/ + /*************************************************/ /* Make sure test region 5 has the correct edges */ - /*************************************************/ + /*************************************************/ edges = get_screen_edges (5); tmp = NULL; verify_edge_lists_are_equal (edges, tmp); meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************/ + /*************************************************/ /* Make sure test region 6 has the correct edges */ - /*************************************************/ + /*************************************************/ edges = get_screen_edges (6); tmp = NULL; tmp = g_list_prepend (tmp, new_screen_edge ( 0, 1200, 1600, 0, bottom)); @@ -1159,18 +1159,18 @@ test_find_nonintersected_xinerama_edges () int top = META_DIRECTION_TOP; int bottom = META_DIRECTION_BOTTOM; - /*************************************************************************/ + /*************************************************************************/ /* Make sure test xinerama set 0 for with region 0 has the correct edges */ - /*************************************************************************/ + /*************************************************************************/ edges = get_xinerama_edges (0, 0); tmp = NULL; verify_edge_lists_are_equal (edges, tmp); meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************************************/ + /*************************************************************************/ /* Make sure test xinerama set 2 for with region 1 has the correct edges */ - /*************************************************************************/ + /*************************************************************************/ edges = get_xinerama_edges (2, 1); tmp = NULL; tmp = g_list_prepend (tmp, new_xinerama_edge ( 0, 600, 1600, 0, bottom)); @@ -1179,9 +1179,9 @@ test_find_nonintersected_xinerama_edges () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************************************/ + /*************************************************************************/ /* Make sure test xinerama set 1 for with region 2 has the correct edges */ - /*************************************************************************/ + /*************************************************************************/ edges = get_xinerama_edges (1, 2); tmp = NULL; tmp = g_list_prepend (tmp, new_xinerama_edge ( 800, 20, 0, 1080, right)); @@ -1191,16 +1191,16 @@ test_find_nonintersected_xinerama_edges () char big_buffer1[(EDGE_LENGTH+2)*FUDGE], big_buffer2[(EDGE_LENGTH+2)*FUDGE]; meta_rectangle_edge_list_to_string (edges, "\n ", big_buffer1); meta_rectangle_edge_list_to_string (tmp, "\n ", big_buffer2); - printf("Generated edge list:\n %s\nComparison edges list:\n %s\n", + printf("Generated edge list:\n %s\nComparison edges list:\n %s\n", big_buffer1, big_buffer2); #endif verify_edge_lists_are_equal (edges, tmp); meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************************************/ + /*************************************************************************/ /* Make sure test xinerama set 3 for with region 3 has the correct edges */ - /*************************************************************************/ + /*************************************************************************/ edges = get_xinerama_edges (3, 3); tmp = NULL; tmp = g_list_prepend (tmp, new_xinerama_edge ( 900, 600, 700, 0, bottom)); @@ -1213,9 +1213,9 @@ test_find_nonintersected_xinerama_edges () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************************************/ + /*************************************************************************/ /* Make sure test xinerama set 3 for with region 4 has the correct edges */ - /*************************************************************************/ + /*************************************************************************/ edges = get_xinerama_edges (3, 4); tmp = NULL; tmp = g_list_prepend (tmp, new_xinerama_edge ( 800, 600, 800, 0, bottom)); @@ -1225,9 +1225,9 @@ test_find_nonintersected_xinerama_edges () meta_rectangle_free_list_and_elements (tmp); meta_rectangle_free_list_and_elements (edges); - /*************************************************************************/ + /*************************************************************************/ /* Make sure test xinerama set 3 for with region 5has the correct edges */ - /*************************************************************************/ + /*************************************************************************/ edges = get_xinerama_edges (3, 5); tmp = NULL; verify_edge_lists_are_equal (edges, tmp); diff --git a/src/core/util.c b/src/core/util.c index 1fbaed63..4204e59b 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -2,10 +2,10 @@ /* Metacity utilities */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -44,11 +44,11 @@ meta_print_backtrace (void) int bt_size; int i; char **syms; - + bt_size = backtrace (bt, 500); syms = backtrace_symbols (bt, bt_size); - + i = 0; while (i < bt_size) { @@ -83,7 +83,7 @@ ensure_logfile (void) char *tmpl; int fd; GError *err; - + tmpl = g_strdup_printf ("metacity-%d-debug-log-XXXXXX", (int) getpid ()); @@ -93,7 +93,7 @@ ensure_logfile (void) &err); g_free (tmpl); - + if (err != NULL) { meta_warning (_("Failed to open debug log: %s\n"), @@ -101,9 +101,9 @@ ensure_logfile (void) g_error_free (err); return; } - + logfile = fdopen (fd, "w"); - + if (logfile == NULL) { meta_warning (_("Failed to fdopen() log file %s: %s\n"), @@ -114,7 +114,7 @@ ensure_logfile (void) { g_printerr (_("Opened log file %s\n"), filename); } - + g_free (filename); } } @@ -132,11 +132,11 @@ meta_set_verbose (gboolean setting) #ifndef WITH_VERBOSE_MODE if (setting) meta_fatal (_("Metacity was compiled without support for verbose mode\n")); -#else +#else if (setting) ensure_logfile (); #endif - + is_verbose = setting; } @@ -189,7 +189,7 @@ utf8_fputs (const char *str, { char *l; int retval; - + l = g_locale_from_utf8 (str, -1, NULL, NULL, NULL); if (l == NULL) @@ -218,24 +218,24 @@ meta_debug_spew_real (const char *format, ...) va_list args; gchar *str; FILE *out; - + g_return_if_fail (format != NULL); if (!is_debugging) return; - + va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); out = logfile ? logfile : stderr; - + if (no_prefix == 0) utf8_fputs (_("Window manager: "), out); utf8_fputs (str, out); fflush (out); - + g_free (str); } #endif /* WITH_VERBOSE_MODE */ @@ -252,19 +252,19 @@ meta_verbose_real (const char *format, ...) if (!is_verbose) return; - + va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); out = logfile ? logfile : stderr; - + if (no_prefix == 0) utf8_fputs ("Window manager: ", out); utf8_fputs (str, out); fflush (out); - + g_free (str); } #endif /* WITH_VERBOSE_MODE */ @@ -339,8 +339,8 @@ meta_topic_real (MetaDebugTopic topic, if (!is_verbose) return; - - va_start (args, format); + + va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); @@ -354,11 +354,11 @@ meta_topic_real (MetaDebugTopic topic, ++sync_count; fprintf (out, "%d: ", sync_count); } - + utf8_fputs (str, out); - + fflush (out); - + g_free (str); } #endif /* WITH_VERBOSE_MODE */ @@ -371,7 +371,7 @@ meta_bug (const char *format, ...) FILE *out; g_return_if_fail (format != NULL); - + va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); @@ -387,11 +387,11 @@ meta_bug (const char *format, ...) utf8_fputs (str, out); fflush (out); - + g_free (str); meta_print_backtrace (); - + /* stop us in a debugger */ abort (); } @@ -402,9 +402,9 @@ meta_warning (const char *format, ...) va_list args; gchar *str; FILE *out; - + g_return_if_fail (format != NULL); - + va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); @@ -420,7 +420,7 @@ meta_warning (const char *format, ...) utf8_fputs (str, out); fflush (out); - + g_free (str); } @@ -430,9 +430,9 @@ meta_fatal (const char *format, ...) va_list args; gchar *str; FILE *out; - + g_return_if_fail (format != NULL); - + va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); @@ -448,7 +448,7 @@ meta_fatal (const char *format, ...) utf8_fputs (str, out); fflush (out); - + g_free (str); meta_exit (META_EXIT_ERROR); @@ -471,7 +471,7 @@ meta_pop_no_msg_prefix (void) void meta_exit (MetaExitCode code) { - + exit (code); } @@ -567,7 +567,7 @@ meta_show_dialog (const char *type, argvl[i++] = _("Metacity"); argvl[i++] = "--text"; argvl[i++] = message; - + if (timeout) { argvl[i++] = "--timeout"; @@ -585,7 +585,7 @@ meta_show_dialog (const char *type, argvl[i++] = "--cancel-label"; argvl[i++] = cancel_text; } - + tmp = columns; while (tmp) { @@ -600,7 +600,7 @@ meta_show_dialog (const char *type, argvl[i++] = tmp->data; tmp = tmp->next; } - + argvl[i] = NULL; if (transient_for) diff --git a/src/core/window-private.h b/src/core/window-private.h index 807428fd..5668d92f 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -9,12 +9,12 @@ * which the rest of the world is allowed to use.) */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat, Inc. * Copyright (C) 2003, 2004 Rob Adams * Copyright (C) 2004-2006 Elijah Newren - * + * * 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; either version 2 of the @@ -24,7 +24,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -101,10 +101,10 @@ struct _MetaWindow MetaIconCache icon_cache; Pixmap wm_hints_pixmap; Pixmap wm_hints_mask; - + MetaWindowType type; Atom type_atom; - + /* NOTE these five are not in UTF-8, we just treat them as random * binary data */ @@ -116,17 +116,17 @@ struct _MetaWindow char *startup_id; int net_wm_pid; - + Window xtransient_for; Window xgroup_leader; Window xclient_leader; /* Initial workspace property */ - int initial_workspace; - + int initial_workspace; + /* Initial timestamp property */ - guint32 initial_timestamp; - + guint32 initial_timestamp; + /* Whether we're maximized */ guint maximized_horizontally : 1; guint maximized_vertically : 1; @@ -159,7 +159,7 @@ struct _MetaWindow * these monitors. If not, this is the single monitor which the window's * origin is on. */ long fullscreen_monitors[4]; - + /* Whether we're trying to constrain the window to be fully onscreen */ guint require_fully_onscreen : 1; @@ -184,7 +184,7 @@ struct _MetaWindow * see also unmaps_pending */ guint mapped : 1; - + /* Iconic is the state in WM_STATE; happens for workspaces/shading * in addition to minimize */ @@ -196,20 +196,20 @@ struct _MetaWindow /* whether an initial workspace was explicitly set */ guint initial_workspace_set : 1; - + /* whether an initial timestamp was explicitly set */ guint initial_timestamp_set : 1; - + /* whether net_wm_user_time has been set yet */ guint net_wm_user_time_set : 1; - + /* These are the flags from WM_PROTOCOLS */ guint take_focus : 1; guint delete_window : 1; guint net_wm_ping : 1; /* Globally active / No input */ guint input : 1; - + /* MWM hints about features of window */ guint mwm_decorated : 1; guint mwm_border_only : 1; @@ -218,7 +218,7 @@ struct _MetaWindow guint mwm_has_maximize_func : 1; guint mwm_has_move_func : 1; guint mwm_has_resize_func : 1; - + /* Computed features of window */ guint decorated : 1; guint border_only : 1; @@ -230,7 +230,7 @@ struct _MetaWindow guint has_move_func : 1; guint has_resize_func : 1; guint has_fullscreen_func : 1; - + /* Weird "_NET_WM_STATE_MODAL" flag */ guint wm_state_modal : 1; @@ -248,12 +248,12 @@ struct _MetaWindow /* EWHH demands attention flag */ guint wm_state_demands_attention : 1; - + /* this flag tracks receipt of focus_in focus_out and * determines whether we draw the focus */ guint has_focus : 1; - + /* Have we placed this window? */ guint placed : 1; @@ -271,15 +271,15 @@ struct _MetaWindow /* Are we in meta_window_new()? */ guint constructing : 1; - + /* Are we in the various queues? (Bitfield: see META_WINDOW_IS_IN_QUEUE) */ guint is_in_queues : NUMBER_OF_QUEUES; - + /* Used by keybindings.c */ guint keys_grabbed : 1; /* normal keybindings grabbed */ guint grab_on_frame : 1; /* grabs are on the frame */ guint all_keys_grabbed : 1; /* AnyKey grabbed */ - + /* Set if the reason for unmanaging the window is that * it was withdrawn */ @@ -304,7 +304,7 @@ struct _MetaWindow /* icon props have changed */ guint need_reread_icon : 1; - + /* if TRUE, window was maximized at start of current grab op */ guint shaken_loose : 1; @@ -323,7 +323,7 @@ struct _MetaWindow guint sync_request_serial; GTimeVal sync_request_time; #endif - + /* Number of UnmapNotify that are caused by us, if * we get UnmapNotify with none pending then the client * is withdrawing the window. @@ -336,11 +336,11 @@ struct _MetaWindow /* window that gets updated net_wm_user_time values */ Window user_time_window; - + /* The size we set the window to last (i.e. what we believe * to be its actual size on the server). The x, y are * the actual server-side x,y so are relative to the frame - * (meaning that they just hold the frame width and height) + * (meaning that they just hold the frame width and height) * or the root window (meaning they specify the location * of the top left of the inner window) as appropriate. */ @@ -368,7 +368,7 @@ struct _MetaWindow * Position always in root coords, unlike window->rect. */ MetaRectangle user_rect; - + /* Requested geometry */ int border_width; /* x/y/w/h here get filled with ConfigureRequest values */ @@ -377,7 +377,7 @@ struct _MetaWindow /* Managed by stack.c */ MetaStackLayer layer; int stack_position; /* see comment in stack.h */ - + /* Current dialog open for this window */ int dialog_pid; @@ -445,7 +445,7 @@ void meta_window_activate (MetaWindow *window, guint32 current_time); void meta_window_activate_with_workspace (MetaWindow *window, guint32 current_time, - MetaWorkspace *workspace); + MetaWorkspace *workspace); void meta_window_make_fullscreen_internal (MetaWindow *window); void meta_window_make_fullscreen (MetaWindow *window); void meta_window_unmake_fullscreen (MetaWindow *window); diff --git a/src/core/window-props.c b/src/core/window-props.c index 59eea24e..505bcefa 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -14,11 +14,11 @@ * together. */ -/* +/* * Copyright (C) 2001, 2002, 2003 Red Hat, Inc. * Copyright (C) 2004, 2005 Elijah Newren * Copyright (C) 2009 Thomas Thurman - * + * * 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; either version 2 of the @@ -28,7 +28,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -173,7 +173,7 @@ static void init_prop_value (MetaWindow *window, MetaWindowPropHooks *hooks, MetaPropValue *value) -{ +{ if (!hooks || hooks->type == META_PROP_VALUE_INVALID) { value->type = META_PROP_VALUE_INVALID; @@ -203,7 +203,7 @@ reload_wm_client_machine (MetaWindow *window, { g_free (window->wm_client_machine); window->wm_client_machine = NULL; - + if (value->type != META_PROP_VALUE_INVALID) window->wm_client_machine = g_strdup (value->v.str); @@ -260,7 +260,7 @@ reload_net_wm_window_type (MetaWindow *window, } meta_XFree (atoms); - + if (meta_is_verbose ()) { char *str; @@ -397,7 +397,7 @@ reload_net_wm_pid (MetaWindow *window, if (value->type != META_PROP_VALUE_INVALID) { gulong cardinal = (int) value->v.cardinal; - + if (cardinal <= 0) meta_warning (_("Application set a bogus _NET_WM_PID %lu\n"), cardinal); @@ -492,7 +492,7 @@ owner_of_process (pid_t process, uid_t *result) { #ifdef HAVE_GTOP glibtop_proc_uid process_details; - + glibtop_get_proc_uid (&process_details, process); if (process_details.flags & (1L << GLIBTOP_PROC_UID_UID)) @@ -530,12 +530,12 @@ set_title_text (MetaWindow *window, { char hostname[HOST_NAME_MAX + 1]; gboolean modified = FALSE; - + if (!target) return FALSE; - + g_free (*target); - + if (!title) *target = g_strdup (""); else if (g_utf8_strlen (title, MAX_TITLE_LENGTH + 1) > MAX_TITLE_LENGTH) @@ -569,7 +569,7 @@ set_title_text (MetaWindow *window, /* Assume a window with unknown ownership is ours (call it usufruct!) */ gboolean window_owner_is_us = !window_owner_known || window_owner==getuid (); - + if (window_owner_is_us) { /* we own it, so fall back to the simple case */ @@ -596,7 +596,7 @@ set_title_text (MetaWindow *window, { found_name = pwd->pw_name; } - + if (found_name) /* Translators: the title of a window owned by another user * on this machine */ @@ -611,7 +611,7 @@ set_title_text (MetaWindow *window, } /* either way we changed it */ modified = TRUE; - + } } else @@ -640,7 +640,7 @@ set_window_title (MetaWindow *window, const char *title) { char *str; - + gboolean modified = set_title_text (window, window->using_net_wm_visible_name, @@ -648,7 +648,7 @@ set_window_title (MetaWindow *window, window->display->atom__NET_WM_VISIBLE_NAME, &window->title); window->using_net_wm_visible_name = modified; - + /* strndup is a hack since GNU libc has broken %.10s */ str = g_strndup (window->title, 10); g_free (window->desc); @@ -694,7 +694,7 @@ reload_wm_name (MetaWindow *window, value->v.str); return; } - + if (value->type != META_PROP_VALUE_INVALID) { set_window_title (window, value->v.str); @@ -754,11 +754,11 @@ reload_wm_icon_name (MetaWindow *window, value->v.str); return; } - + if (value->type != META_PROP_VALUE_INVALID) { set_icon_title (window, value->v.str); - + meta_verbose ("Using WM_ICON_NAME for new title of %s: \"%s\"\n", window->desc, window->title); } @@ -947,7 +947,7 @@ reload_mwm_hints (MetaWindow *window, meta_verbose ("Functions flag unset\n"); meta_window_recalc_features (window); - + /* We do all this anyhow at the end of meta_window_new() */ if (!window->constructing) { @@ -955,7 +955,7 @@ reload_mwm_hints (MetaWindow *window, meta_window_ensure_frame (window); else meta_window_destroy_frame (window); - + meta_window_queue (window, META_QUEUE_MOVE_RESIZE | /* because ensure/destroy frame may unmap: */ @@ -977,7 +977,7 @@ reload_wm_class (MetaWindow *window, window->res_name = NULL; if (value->type != META_PROP_VALUE_INVALID) - { + { if (value->v.class_hint.res_name) window->res_name = g_strdup (value->v.class_hint.res_name); @@ -1013,32 +1013,32 @@ reload_net_startup_id (MetaWindow *window, { guint32 timestamp = window->net_wm_user_time; MetaWorkspace *workspace = NULL; - + g_free (window->startup_id); - + if (value->type != META_PROP_VALUE_INVALID) window->startup_id = g_strdup (value->v.str); else window->startup_id = NULL; - + /* Update timestamp and workspace on a running window */ if (!window->constructing) { - window->initial_timestamp_set = 0; + window->initial_timestamp_set = 0; window->initial_workspace_set = 0; - + if (meta_screen_apply_startup_properties (window->screen, window)) { - + if (window->initial_timestamp_set) timestamp = window->initial_timestamp; if (window->initial_workspace_set) workspace = meta_screen_get_workspace_by_index (window->screen, window->initial_workspace); - + meta_window_activate_with_workspace (window, timestamp, workspace); } } - + meta_verbose ("New _NET_STARTUP_ID \"%s\" for %s\n", window->startup_id ? window->startup_id : "unset", window->desc); @@ -1118,7 +1118,7 @@ spew_size_hints_differences (const XSizeHints *old, if (FLAG_CHANGED (old, new, PWinGravity)) meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PWinGravity now %s (%d -> %d)\n", FLAG_TOGGLED_ON (old, new, PWinGravity) ? "set" : "unset", - old->win_gravity, new->win_gravity); + old->win_gravity, new->win_gravity); } void @@ -1471,15 +1471,15 @@ reload_normal_hints (MetaWindow *window, if (value->type != META_PROP_VALUE_INVALID) { XSizeHints old_hints; - + meta_topic (META_DEBUG_GEOMETRY, "Updating WM_NORMAL_HINTS for %s\n", window->desc); old_hints = window->size_hints; - + meta_set_normal_hints (window, value->v.size_hints.hints); - + spew_size_hints_differences (&old_hints, &window->size_hints); - + meta_window_recalc_features (window); if (!initial) @@ -1493,12 +1493,12 @@ reload_wm_protocols (MetaWindow *window, gboolean initial) { int i; - + window->take_focus = FALSE; window->delete_window = FALSE; window->net_wm_ping = FALSE; - - if (value->type == META_PROP_VALUE_INVALID) + + if (value->type == META_PROP_VALUE_INVALID) return; i = 0; @@ -1515,7 +1515,7 @@ reload_wm_protocols (MetaWindow *window, window->net_wm_ping = TRUE; ++i; } - + meta_verbose ("New _NET_STARTUP_ID \"%s\" for %s\n", window->startup_id ? window->startup_id : "unset", window->desc); @@ -1527,20 +1527,20 @@ reload_wm_hints (MetaWindow *window, gboolean initial) { Window old_group_leader; - + old_group_leader = window->xgroup_leader; - + /* Fill in defaults */ window->input = TRUE; window->initially_iconic = FALSE; window->xgroup_leader = None; window->wm_hints_pixmap = None; window->wm_hints_mask = None; - + if (value->type != META_PROP_VALUE_INVALID) { const XWMHints *hints = value->v.wm_hints; - + if (hints->flags & InputHint) window->input = hints->input; @@ -1555,7 +1555,7 @@ reload_wm_hints (MetaWindow *window, if (hints->flags & IconMaskHint) window->wm_hints_mask = hints->icon_mask; - + meta_verbose ("Read WM_HINTS input: %d iconic: %d group leader: 0x%lx pixmap: 0x%lx mask: 0x%lx\n", window->input, window->initially_iconic, window->xgroup_leader, @@ -1567,7 +1567,7 @@ reload_wm_hints (MetaWindow *window, { meta_verbose ("Window %s changed its group leader to 0x%lx\n", window->desc, window->xgroup_leader); - + meta_window_group_leader_changed (window); } @@ -1584,13 +1584,13 @@ reload_transient_for (MetaWindow *window, gboolean initial) { window->xtransient_for = None; - + if (value->type != META_PROP_VALUE_INVALID) window->xtransient_for = value->v.xwindow; /* Make sure transient_for is valid */ if (window->xtransient_for != None && - meta_display_lookup_x_window (window->display, + meta_display_lookup_x_window (window->display, window->xtransient_for) == NULL) { meta_warning (_("Invalid WM_TRANSIENT_FOR window 0x%lx specified " diff --git a/src/core/window-props.h b/src/core/window-props.h index 9adaafc2..cd16227e 100644 --- a/src/core/window-props.h +++ b/src/core/window-props.h @@ -10,9 +10,9 @@ * round trip to the server. */ -/* +/* * Copyright (C) 2001, 2002 Red Hat, Inc. - * + * * 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; either version 2 of the @@ -22,7 +22,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/core/window.c b/src/core/window.c index 3eca1555..34a04845 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2,12 +2,12 @@ /* Metacity X managed windows */ -/* +/* * Copyright (C) 2001 Havoc Pennington, Anders Carlsson * Copyright (C) 2002, 2003 Red Hat, Inc. * Copyright (C) 2003 Rob Adams * Copyright (C) 2004-2006 Elijah Newren - * + * * 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; either version 2 of the @@ -17,7 +17,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -138,7 +138,7 @@ wm_state_to_string (int state) switch (state) { case NormalState: - return "NormalState"; + return "NormalState"; case IconicState: return "IconicState"; case WithdrawnState: @@ -191,7 +191,7 @@ maybe_leave_show_desktop_mode (MetaWindow *window) { meta_screen_minimize_all_on_active_workspace_except (window->screen, window); - meta_screen_unshow_desktop (window->screen); + meta_screen_unshow_desktop (window->screen); } } @@ -202,15 +202,15 @@ meta_window_new (MetaDisplay *display, { XWindowAttributes attrs; MetaWindow *window; - + meta_display_grab (display); meta_error_trap_push (display); /* Push a trap over all of window * creation, to reduce XSync() calls */ - + meta_error_trap_push_with_return (display); - - if (XGetWindowAttributes (display->xdisplay,xwindow, &attrs)) + + if (XGetWindowAttributes (display->xdisplay,xwindow, &attrs)) { if(meta_error_trap_pop_with_return (display, TRUE) != Success) { @@ -225,15 +225,15 @@ meta_window_new (MetaDisplay *display, } else { - meta_error_trap_pop_with_return (display, TRUE); + meta_error_trap_pop_with_return (display, TRUE); meta_verbose ("Failed to get attributes for window 0x%lx\n", xwindow); meta_error_trap_pop (display, TRUE); meta_display_ungrab (display); return NULL; } - - + + meta_error_trap_pop (display, FALSE); meta_display_ungrab (display); @@ -255,7 +255,7 @@ meta_window_new_with_attrs (MetaDisplay *display, gboolean has_shape; g_assert (attrs != NULL); - + meta_verbose ("Attempting to manage 0x%lx\n", xwindow); if (meta_display_xwindow_is_a_no_focus_window (display, xwindow)) @@ -270,7 +270,7 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_verbose ("Deciding not to manage override_redirect window 0x%lx\n", xwindow); return NULL; } - + /* Grab server */ meta_display_grab (display); meta_error_trap_push (display); /* Push a trap over all of window @@ -287,7 +287,7 @@ meta_window_new_with_attrs (MetaDisplay *display, (attrs->map_state == IsUnviewable) ? "IsUnviewable" : "(unknown)"); - + existing_wm_state = WithdrawnState; if (must_be_viewable && attrs->map_state != IsViewable) { @@ -311,9 +311,9 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_verbose ("WM_STATE of %lx = %s\n", xwindow, wm_state_to_string (existing_wm_state)); } - + meta_error_trap_push_with_return (display); - + XAddToSaveSet (display->xdisplay, xwindow); event_mask = @@ -355,15 +355,15 @@ meta_window_new_with_attrs (MetaDisplay *display, if (attrs->win_gravity != NorthWestGravity) { XSetWindowAttributes set_attrs; - + set_attrs.win_gravity = NorthWestGravity; - + XChangeWindowAttributes (display->xdisplay, xwindow, CWWinGravity, &set_attrs); } - + if (meta_error_trap_pop_with_return (display, FALSE) != Success) { meta_verbose ("Window 0x%lx disappeared just as we tried to manage it\n", @@ -374,15 +374,15 @@ meta_window_new_with_attrs (MetaDisplay *display, } g_assert (!attrs->override_redirect); - + window = g_new (MetaWindow, 1); window->constructing = TRUE; - + window->dialog_pid = -1; - + window->xwindow = xwindow; - + /* this is in window->screen->display, but that's too annoying to * type */ @@ -395,7 +395,7 @@ meta_window_new_with_attrs (MetaDisplay *display, window->sync_request_time.tv_sec = 0; window->sync_request_time.tv_usec = 0; #endif - + window->screen = NULL; tmp = display->screens; while (tmp != NULL) @@ -407,10 +407,10 @@ meta_window_new_with_attrs (MetaDisplay *display, window->screen = tmp->data; break; } - + tmp = tmp->next; } - + g_assert (window->screen); window->desc = g_strdup_printf ("0x%lx", window->xwindow); @@ -419,7 +419,7 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_stack_freeze (window->screen->stack); window->has_shape = has_shape; - + window->rect.x = attrs->x; window->rect.y = attrs->y; window->rect.width = attrs->width; @@ -437,11 +437,11 @@ meta_window_new_with_attrs (MetaDisplay *display, /* And this is our unmaximized size */ window->saved_rect = window->rect; window->user_rect = window->rect; - + window->depth = attrs->depth; window->xvisual = attrs->visual; window->colormap = attrs->colormap; - + window->title = NULL; window->icon_name = NULL; window->icon = NULL; @@ -497,9 +497,9 @@ meta_window_new_with_attrs (MetaDisplay *display, window->shaken_loose = FALSE; window->have_focus_click_grab = FALSE; window->disable_sync = FALSE; - + window->unmaps_pending = 0; - + window->mwm_decorated = TRUE; window->mwm_border_only = FALSE; window->mwm_has_close_func = TRUE; @@ -507,7 +507,7 @@ meta_window_new_with_attrs (MetaDisplay *display, window->mwm_has_maximize_func = TRUE; window->mwm_has_move_func = TRUE; window->mwm_has_resize_func = TRUE; - + window->decorated = TRUE; window->has_close_func = TRUE; window->has_minimize_func = TRUE; @@ -520,7 +520,7 @@ meta_window_new_with_attrs (MetaDisplay *display, window->has_fullscreen_func = TRUE; window->always_sticky = FALSE; - + window->wm_state_modal = FALSE; window->skip_taskbar = FALSE; window->skip_pager = FALSE; @@ -529,20 +529,20 @@ meta_window_new_with_attrs (MetaDisplay *display, window->wm_state_above = FALSE; window->wm_state_below = FALSE; window->wm_state_demands_attention = FALSE; - + window->res_class = NULL; window->res_name = NULL; window->role = NULL; window->sm_client_id = NULL; window->wm_client_machine = NULL; window->startup_id = NULL; - + window->net_wm_pid = -1; - + window->xtransient_for = None; window->xclient_leader = None; window->transient_parent_is_root_window = FALSE; - + window->type = META_WINDOW_NORMAL; window->type_atom = None; @@ -554,12 +554,12 @@ meta_window_new_with_attrs (MetaDisplay *display, window->using_net_wm_visible_icon_name = FALSE; window->need_reread_icon = TRUE; - + window->layer = META_LAYER_LAST; /* invalid value */ window->stack_position = -1; window->initial_workspace = 0; /* not used */ window->initial_timestamp = 0; /* not used */ - + meta_display_register_x_window (display, &window->xwindow, window); @@ -628,7 +628,7 @@ meta_window_new_with_attrs (MetaDisplay *display, window->net_wm_user_time = meta_display_get_current_time_roundtrip (window->display); } - + if (window->decorated) meta_window_ensure_frame (window); @@ -649,12 +649,12 @@ meta_window_new_with_attrs (MetaDisplay *display, */ window->on_all_workspaces = TRUE; } - + /* For the workspace, first honor hints, * if that fails put transients with parents, * otherwise put window on active space */ - + if (window->initial_workspace_set) { if (window->initial_workspace == (int) 0xFFFFFFFF) @@ -662,7 +662,7 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_topic (META_DEBUG_PLACEMENT, "Window %s is initially on all spaces\n", window->desc); - + /* need to set on_all_workspaces first so that it will be * added to all the MRU lists */ @@ -678,13 +678,13 @@ meta_window_new_with_attrs (MetaDisplay *display, space = meta_screen_get_workspace_by_index (window->screen, window->initial_workspace); - + if (space) meta_workspace_add_window (space, window); } } - - if (window->workspace == NULL && + + if (window->workspace == NULL && window->xtransient_for != None) { /* Try putting dialog on parent's workspace */ @@ -698,30 +698,30 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_topic (META_DEBUG_PLACEMENT, "Putting window %s on same workspace as parent %s\n", window->desc, parent->desc); - + if (parent->on_all_workspaces) window->on_all_workspaces = TRUE; - + /* this will implicitly add to the appropriate MRU lists */ meta_workspace_add_window (parent->workspace, window); } } - + if (window->workspace == NULL) { meta_topic (META_DEBUG_PLACEMENT, "Putting window %s on active workspace\n", window->desc); - + space = window->screen->active_workspace; meta_workspace_add_window (space, window); } - + /* for the various on_all_workspaces = TRUE possible above */ meta_window_set_current_workspace_hint (window); - + meta_window_update_struts (window); /* Must add window to stack before doing move/resize, since the @@ -731,7 +731,7 @@ meta_window_new_with_attrs (MetaDisplay *display, * and thus constraints may try to auto-fullscreen it which also * means restacking it. */ - meta_stack_add (window->screen->stack, + meta_stack_add (window->screen->stack, window); /* Put our state back where it should be, @@ -760,7 +760,7 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_window_release_saved_state (info); } } - + /* FIXME we have a tendency to set this then immediately * change it again. */ @@ -772,7 +772,7 @@ meta_window_new_with_attrs (MetaDisplay *display, /* disable show desktop mode unless we're a desktop component */ maybe_leave_show_desktop_mode (window); - + meta_window_queue (window, META_QUEUE_CALC_SHOWING); /* See bug 303284; a transient of the given window can already exist, in which * case we think it should probably be shown. @@ -795,7 +795,7 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_error_trap_pop (display, FALSE); /* pop the XSync()-reducing trap */ meta_display_ungrab (display); - + window->constructing = FALSE; return window; @@ -830,10 +830,10 @@ meta_window_apply_session_info (MetaWindow *window, meta_topic (META_DEBUG_SM, "Restoring maximized state %d for window %s\n", info->maximized, window->desc); - + if (window->has_maximize_func && info->maximized) { - meta_window_maximize (window, + meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL); @@ -846,7 +846,7 @@ meta_window_apply_session_info (MetaWindow *window, info->saved_rect.width, info->saved_rect.height, window->desc); - + window->saved_rect.x = info->saved_rect.x; window->saved_rect.y = info->saved_rect.y; window->saved_rect.width = info->saved_rect.width; @@ -854,7 +854,7 @@ meta_window_apply_session_info (MetaWindow *window, } } } - + if (info->on_all_workspaces_set) { window->on_all_workspaces = info->on_all_workspaces; @@ -862,26 +862,26 @@ meta_window_apply_session_info (MetaWindow *window, "Restoring sticky state %d for window %s\n", window->on_all_workspaces, window->desc); } - + if (info->workspace_indices) { GSList *tmp; - GSList *spaces; + GSList *spaces; spaces = NULL; - + tmp = info->workspace_indices; while (tmp != NULL) { - MetaWorkspace *space; + MetaWorkspace *space; space = meta_screen_get_workspace_by_index (window->screen, GPOINTER_TO_INT (tmp->data)); - + if (space) spaces = g_slist_prepend (spaces, space); - + tmp = tmp->next; } @@ -899,13 +899,13 @@ meta_window_apply_session_info (MetaWindow *window, * happened to be on more than one, since we have replaces * window->workspaces with window->workspace */ - meta_workspace_add_window (spaces->data, window); + meta_workspace_add_window (spaces->data, window); meta_topic (META_DEBUG_SM, "Restoring saved window %s to workspace %d\n", window->desc, meta_workspace_index (spaces->data)); - + g_slist_free (spaces); } } @@ -914,7 +914,7 @@ meta_window_apply_session_info (MetaWindow *window, { int x, y, w, h; MetaMoveResizeFlags flags; - + window->placed = TRUE; /* don't do placement algorithms later */ x = info->rect.x; @@ -927,11 +927,11 @@ meta_window_apply_session_info (MetaWindow *window, /* Force old gravity, ignoring anything now set */ window->size_hints.win_gravity = info->gravity; - + meta_topic (META_DEBUG_SM, "Restoring pos %d,%d size %d x %d for %s\n", x, y, w, h, window->desc); - + flags = META_DO_GRAVITY_ADJUST | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION; meta_window_move_resize_internal (window, flags, @@ -945,23 +945,23 @@ meta_window_free (MetaWindow *window, guint32 timestamp) { GList *tmp; - + meta_verbose ("Unmanaging 0x%lx\n", window->xwindow); if (window->display->compositor) meta_compositor_free_window (window->display->compositor, window); - + if (window->display->window_with_menu == window) { meta_ui_window_menu_free (window->display->window_menu); window->display->window_menu = NULL; window->display->window_with_menu = NULL; } - + if (destroying_windows_disallowed > 0) meta_bug ("Tried to destroy window %s while destruction was not allowed\n", window->desc); - + window->unmanaging = TRUE; if (window->fullscreen) @@ -983,7 +983,7 @@ meta_window_free (MetaWindow *window, * group.c won't re-add to the * group if window->unmanaging */ - + /* If we have the focus, focus some other window. * This is done first, so that if the unmap causes * an EnterNotify the EnterNotify will have final say @@ -1026,12 +1026,12 @@ meta_window_free (MetaWindow *window, window->desc); invalidate_work_areas (window); } - + if (window->display->grab_window == window) meta_display_end_grab_op (window->display, timestamp); g_assert (window->display->grab_window != window); - + if (window->display->focus_window == window) { window->display->focus_window = NULL; @@ -1047,12 +1047,12 @@ meta_window_free (MetaWindow *window, * also do this just in case a window got unmaximized.) */ send_configure_notify (window); - + meta_window_unqueue (window, META_QUEUE_CALC_SHOWING | META_QUEUE_MOVE_RESIZE | META_QUEUE_UPDATE_ICON); meta_window_free_delete_dialog (window); - + if (window->workspace) meta_workspace_remove_window (window->workspace, window); @@ -1070,12 +1070,12 @@ meta_window_free (MetaWindow *window, tmp = tmp->next; } #endif - + meta_stack_remove (window->screen->stack, window); - + if (window->frame) meta_window_destroy_frame (window); - + if (window->withdrawn) { /* We need to clean off the window's state so it @@ -1119,9 +1119,9 @@ meta_window_free (MetaWindow *window, meta_window_ungrab_keys (window); meta_display_ungrab_window_buttons (window->display, window->xwindow); meta_display_ungrab_focus_window_button (window->display, window); - + meta_display_unregister_x_window (window->display, window->xwindow); - + meta_error_trap_push (window->display); @@ -1155,7 +1155,7 @@ meta_window_free (MetaWindow *window, if (META_DISPLAY_HAS_SHAPE (window->display)) XShapeSelectInput (window->display->xdisplay, window->xwindow, NoEventMask); #endif - + meta_error_trap_pop (window->display, FALSE); if (window->icon) @@ -1165,7 +1165,7 @@ meta_window_free (MetaWindow *window, g_object_unref (G_OBJECT (window->mini_icon)); meta_icon_cache_free (&window->icon_cache); - + g_free (window->sm_client_id); g_free (window->wm_client_machine); g_free (window->startup_id); @@ -1183,10 +1183,10 @@ set_wm_state (MetaWindow *window, int state) { unsigned long data[2]; - + meta_verbose ("Setting wm state %s on %s\n", wm_state_to_string (state), window->desc); - + /* Metacity doesn't use icon windows, so data[1] should be None * according to the ICCCM 2.0 Section 4.1.3.1. */ @@ -1206,7 +1206,7 @@ set_net_wm_state (MetaWindow *window) { int i; unsigned long data[12]; - + i = 0; if (window->shaded) { @@ -1270,7 +1270,7 @@ set_net_wm_state (MetaWindow *window) } meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i); - + meta_error_trap_push (window->display); XChangeProperty (window->display->xdisplay, window->xwindow, window->display->atom__NET_WM_STATE, @@ -1341,7 +1341,7 @@ meta_window_showing_on_its_workspace (MetaWindow *window) /* 1. See if we're minimized */ if (window->minimized) showing = FALSE; - + /* 2. See if we're in "show desktop" mode */ is_desktop_or_dock = FALSE; is_desktop_or_dock_foreach (window, @@ -1357,7 +1357,7 @@ meta_window_showing_on_its_workspace (MetaWindow *window) else /* This only seems to be needed for startup */ workspace_of_window = NULL; - if (showing && + if (showing && workspace_of_window && workspace_of_window->showing_desktop && !is_desktop_or_dock) { @@ -1370,7 +1370,7 @@ meta_window_showing_on_its_workspace (MetaWindow *window) * ancestor's "mapped" field may not be up to date * since it's being computed in this same idle queue) */ - + if (showing) { if (ancestor_is_minimized (window)) @@ -1381,7 +1381,7 @@ meta_window_showing_on_its_workspace (MetaWindow *window) /* 4. See if we're drawing wireframe */ if (window->display->grab_window == window && - window->display->grab_wireframe_active) + window->display->grab_wireframe_active) showing = FALSE; #endif @@ -1396,7 +1396,7 @@ meta_window_should_be_showing (MetaWindow *window) meta_verbose ("Should be showing for window %s\n", window->desc); /* See if we're on the workspace */ - on_workspace = meta_window_located_on_workspace (window, + on_workspace = meta_window_located_on_workspace (window, window->screen->active_workspace); if (!on_workspace) @@ -1425,12 +1425,12 @@ finish_minimize (gpointer data) * haven't done that yet. */ guint32 timestamp = meta_display_get_current_time_roundtrip (window->display); - + meta_window_hide (window); if (window->has_focus) { meta_workspace_focus_default_window (window->screen->active_workspace, - window, + window, timestamp); } } @@ -1442,14 +1442,14 @@ implement_showing (MetaWindow *window, /* Actually show/hide the window */ meta_verbose ("Implement showing = %d for window %s\n", showing, window->desc); - + if (!showing) { gboolean on_workspace; - on_workspace = meta_window_located_on_workspace (window, + on_workspace = meta_window_located_on_workspace (window, window->screen->active_workspace); - + /* Really this effects code should probably * be in meta_window_hide so the window->mapped * test isn't duplicated here. Anyhow, we animate @@ -1461,15 +1461,15 @@ implement_showing (MetaWindow *window, { MetaRectangle icon_rect, window_rect; gboolean result; - + /* Check if the window has an icon geometry */ result = meta_window_get_icon_geometry (window, &icon_rect); - + if (!result) { /* just animate into the corner somehow - maybe * not a good idea... - */ + */ icon_rect.x = window->screen->rect.width; icon_rect.y = window->screen->rect.height; icon_rect.width = 1; @@ -1542,7 +1542,7 @@ idle_calc_showing (gpointer data) queue_idle[queue_index] = 0; destroying_windows_disallowed += 1; - + /* We map windows from top to bottom and unmap from bottom to * top, to avoid extra expose events. The exception is * for unplaced windows, which have to be mapped from bottom to @@ -1566,7 +1566,7 @@ idle_calc_showing (gpointer data) should_show = g_slist_prepend (should_show, window); else should_hide = g_slist_prepend (should_hide, window); - + tmp = tmp->next; } @@ -1580,7 +1580,7 @@ idle_calc_showing (gpointer data) first_window = copy->data; meta_display_grab (first_window->display); - + tmp = unplaced; while (tmp != NULL) { @@ -1589,7 +1589,7 @@ idle_calc_showing (gpointer data) window = tmp->data; meta_window_calc_showing (window); - + tmp = tmp->next; } @@ -1601,10 +1601,10 @@ idle_calc_showing (gpointer data) window = tmp->data; implement_showing (window, TRUE); - + tmp = tmp->next; } - + tmp = should_hide; while (tmp != NULL) { @@ -1613,10 +1613,10 @@ idle_calc_showing (gpointer data) window = tmp->data; implement_showing (window, FALSE); - + tmp = tmp->next; } - + tmp = copy; while (tmp != NULL) { @@ -1630,7 +1630,7 @@ idle_calc_showing (gpointer data) * we are still in the calc_showing queue */ window->is_in_queues &= ~META_QUEUE_CALC_SHOWING; - + tmp = tmp->next; } @@ -1645,7 +1645,7 @@ idle_calc_showing (gpointer data) while (tmp != NULL) { MetaWindow *window = tmp->data; - + if (!window->display->mouse_mode) meta_display_increment_focus_sentinel (window->display); @@ -1654,16 +1654,16 @@ idle_calc_showing (gpointer data) } meta_display_ungrab (first_window->display); - + g_slist_free (copy); g_slist_free (unplaced); g_slist_free (should_show); g_slist_free (should_hide); g_slist_free (displays); - + destroying_windows_disallowed -= 1; - + return FALSE; } @@ -1691,7 +1691,7 @@ meta_window_unqueue (MetaWindow *window, guint queuebits) /* Note that window may not actually be in the queue * because it may have been in "copy" inside the idle handler - */ + */ queue_pending[queuenum] = g_slist_remove (queue_pending[queuenum], window); window->is_in_queues &= ~(1<<queuenum); @@ -1878,7 +1878,7 @@ intervening_user_event_occurred (MetaWindow *window) meta_topic (META_DEBUG_STARTUP, "window %s focus prevented by other activity; %u < %u\n", window->desc, - compare, + compare, focus_window->net_wm_user_time); return TRUE; } @@ -1942,7 +1942,7 @@ __window_is_terminal (MetaWindow *window) * and the focus_window have no relation */ static void -window_state_on_map (MetaWindow *window, +window_state_on_map (MetaWindow *window, gboolean *takes_focus, gboolean *places_on_top) { @@ -2037,12 +2037,12 @@ window_would_be_covered (const MetaWindow *newbie) { MetaWorkspace *workspace = newbie->workspace; GList *tmp, *windows; - + windows = meta_workspace_list_windows (workspace); tmp = windows; while (tmp != NULL) - { + { MetaWindow *w = tmp->data; if (w->wm_state_above && w != newbie) @@ -2160,7 +2160,7 @@ meta_window_show (MetaWindow *window) */ window->denied_focus_and_not_transient = FALSE; } - + if (needs_stacking_adjustment) { gboolean overlap; @@ -2174,7 +2174,7 @@ meta_window_show (MetaWindow *window) * Firstly, set the flag so we don't give the window focus anyway * and confuse people. */ - + takes_focus_on_map = FALSE; overlap = windows_overlap (window, focus_window); @@ -2202,17 +2202,17 @@ meta_window_show (MetaWindow *window) * always on top, then the user might not notice the window appearing so * set the demands attention hint. * - * We set the hint ourselves rather than calling + * We set the hint ourselves rather than calling * meta_window_set_demands_attention() because that would cause * a recalculation of overlap, and a call to set_net_wm_state() * which we are going to call ourselves here a few lines down. */ if (overlap || will_be_covered) window->wm_state_demands_attention = TRUE; - } + } /* Shaded means the frame is mapped but the window is not */ - + if (window->frame && !window->frame->mapped) { meta_topic (META_DEBUG_WINDOW_STATE, @@ -2225,7 +2225,7 @@ meta_window_show (MetaWindow *window) if (window->shaded) { if (window->mapped) - { + { meta_topic (META_DEBUG_WINDOW_STATE, "%s actually needs unmap (shaded)\n", window->desc); meta_topic (META_DEBUG_WINDOW_STATE, @@ -2255,26 +2255,26 @@ meta_window_show (MetaWindow *window) XMapWindow (window->display->xdisplay, window->xwindow); meta_error_trap_pop (window->display, FALSE); did_show = TRUE; - + if (window->was_minimized) { MetaRectangle window_rect; MetaRectangle icon_rect; - + window->was_minimized = FALSE; - + if (meta_window_get_icon_geometry (window, &icon_rect)) { meta_window_get_outer_rect (window, &window_rect); - + meta_effect_run_unminimize (window, &window_rect, &icon_rect, NULL, NULL); } } - } - + } + if (window->iconic) { window->iconic = FALSE; @@ -2290,7 +2290,7 @@ meta_window_show (MetaWindow *window) { window->showing_for_first_time = FALSE; if (takes_focus_on_map) - { + { meta_window_focus (window, timestamp); } else @@ -2330,12 +2330,12 @@ static void meta_window_hide (MetaWindow *window) { gboolean did_hide; - + meta_topic (META_DEBUG_WINDOW_STATE, "Hiding window %s\n", window->desc); did_hide = FALSE; - + if (window->frame && window->frame->mapped) { meta_topic (META_DEBUG_WINDOW_STATE, "Frame actually needs unmap\n"); @@ -2353,7 +2353,7 @@ meta_window_hide (MetaWindow *window) window->desc); window->mapped = FALSE; window->unmaps_pending += 1; - meta_error_trap_push (window->display); + meta_error_trap_push (window->display); XUnmapWindow (window->display->xdisplay, window->xwindow); meta_error_trap_pop (window->display, FALSE); did_hide = TRUE; @@ -2364,9 +2364,9 @@ meta_window_hide (MetaWindow *window) window->iconic = TRUE; set_wm_state (window, IconicState); } - + set_net_wm_state (window); - + if (did_hide && window->struts) { meta_topic (META_DEBUG_WORKAREA, @@ -2395,7 +2395,7 @@ meta_window_minimize (MetaWindow *window) meta_window_foreach_transient (window, queue_calc_showing_func, NULL); - + if (window->has_focus) { meta_topic (META_DEBUG_FOCUS, @@ -2438,7 +2438,7 @@ ensure_size_hints_satisfied (MetaRectangle *rect, maxw = size_hints->max_width; maxh = size_hints->max_height; basew = size_hints->base_width; baseh = size_hints->base_height; winc = size_hints->width_inc; hinc = size_hints->height_inc; - + /* First, enforce min/max size constraints */ rect->width = CLAMP (rect->width, minw, maxw); rect->height = CLAMP (rect->height, minh, maxh); @@ -2540,7 +2540,7 @@ meta_window_maximize_internal (MetaWindow *window, maximize_horizontally && maximize_vertically ? "" : maximize_horizontally ? " horizontally" : maximize_vertically ? " vertically" : "BUGGGGG"); - + if (saved_rect != NULL) window->saved_rect = *saved_rect; else @@ -2549,9 +2549,9 @@ meta_window_maximize_internal (MetaWindow *window, if (maximize_horizontally && maximize_vertically) window->saved_maximize = TRUE; - window->maximized_horizontally = + window->maximized_horizontally = window->maximized_horizontally || maximize_horizontally; - window->maximized_vertically = + window->maximized_vertically = window->maximized_vertically || maximize_vertically; /* Fix for #336850: If the frame shape isn't reapplied, it is @@ -2561,7 +2561,7 @@ meta_window_maximize_internal (MetaWindow *window, */ if (window->frame) window->frame->need_reapply_frame_shape = TRUE; - + recalc_window_features (window); set_net_wm_state (window); } @@ -2589,11 +2589,11 @@ meta_window_maximize (MetaWindow *window, /* Shading sucks anyway; I'm not adding a timestamp argument * to this function just for this niche usage & corner case. */ - guint32 timestamp = + guint32 timestamp = meta_display_get_current_time_roundtrip (window->display); meta_window_unshade (window, timestamp); } - + /* if the window hasn't been placed yet, we'll maximize it then */ if (!window->placed) @@ -2609,7 +2609,7 @@ meta_window_maximize (MetaWindow *window, window->maximized_vertically = FALSE; } - meta_window_maximize_internal (window, + meta_window_maximize_internal (window, directions, saved_rect); @@ -2740,10 +2740,10 @@ meta_window_unmaximize (MetaWindow *window, unmaximize_horizontally && unmaximize_vertically ? "" : unmaximize_horizontally ? " horizontally" : unmaximize_vertically ? " vertically" : "BUGGGGG"); - - window->maximized_horizontally = + + window->maximized_horizontally = window->maximized_horizontally && !unmaximize_horizontally; - window->maximized_vertically = + window->maximized_vertically = window->maximized_vertically && !unmaximize_vertically; /* Unmaximize to the saved_rect position in the direction(s) @@ -2831,22 +2831,22 @@ meta_window_make_fullscreen_internal (MetaWindow *window) /* Shading sucks anyway; I'm not adding a timestamp argument * to this function just for this niche usage & corner case. */ - guint32 timestamp = + guint32 timestamp = meta_display_get_current_time_roundtrip (window->display); meta_window_unshade (window, timestamp); } meta_window_save_rect (window); - + window->fullscreen = TRUE; window->force_save_user_rect = FALSE; meta_stack_freeze (window->screen->stack); meta_window_update_layer (window); - + meta_window_raise (window); meta_stack_thaw (window->screen->stack); - + recalc_window_features (window); set_net_wm_state (window); } @@ -2873,7 +2873,7 @@ meta_window_unmake_fullscreen (MetaWindow *window) meta_topic (META_DEBUG_WINDOW_OPS, "Unfullscreening %s\n", window->desc); - + window->fullscreen = FALSE; target_rect = window->saved_rect; @@ -2894,7 +2894,7 @@ meta_window_unmake_fullscreen (MetaWindow *window) force_save_user_window_placement (window); meta_window_update_layer (window); - + recalc_window_features (window); set_net_wm_state (window); } @@ -2935,7 +2935,7 @@ meta_window_shade (MetaWindow *window, meta_topic (META_DEBUG_WINDOW_OPS, "Shading %s\n", window->desc); if (!window->shaded) - { + { window->shaded = TRUE; meta_window_queue(window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING); @@ -2947,7 +2947,7 @@ meta_window_shade (MetaWindow *window, "Re-focusing window %s after shading it\n", window->desc); meta_window_focus (window, timestamp); - + set_net_wm_state (window); } } @@ -3020,7 +3020,7 @@ window_activate (MetaWindow *window, return; } - /* For those stupid pagers, get a valid timestamp and show a warning */ + /* For those stupid pagers, get a valid timestamp and show a warning */ if (timestamp == 0) { meta_warning ("meta_window_activate called by a pager with a 0 timestamp; " @@ -3032,15 +3032,15 @@ window_activate (MetaWindow *window, /* disable show desktop mode unless we're a desktop component */ maybe_leave_show_desktop_mode (window); - + /* Get window on current or given workspace */ if (workspace == NULL) workspace = window->screen->active_workspace; - /* For non-transient windows, we just set up a pulsing indicator, + /* For non-transient windows, we just set up a pulsing indicator, rather than move windows or workspaces. See http://bugzilla.gnome.org/show_bug.cgi?id=482354 */ - if (window->xtransient_for == None && + if (window->xtransient_for == None && !meta_window_located_on_workspace (window, workspace)) { meta_window_set_demands_attention (window); @@ -3049,11 +3049,11 @@ window_activate (MetaWindow *window, } else if (window->xtransient_for != None) { - /* Move transients to current workspace - preference dialogs should appear over + /* Move transients to current workspace - preference dialogs should appear over the source window. */ meta_window_change_workspace (window, workspace); } - + if (window->shaded) meta_window_unshade (window, timestamp); @@ -3112,7 +3112,7 @@ adjust_for_gravity (MetaWindow *window, int bw; int child_x, child_y; int frame_width, frame_height; - + if (coords_assume_border) bw = window->border_width; else @@ -3132,7 +3132,7 @@ adjust_for_gravity (MetaWindow *window, frame_width = rect->width; frame_height = rect->height; } - + /* We're computing position to pass to window_move, which is * the position of the client window (StaticGravity basically) * @@ -3247,7 +3247,7 @@ send_sync_request (MetaWindow *window) window->sync_request_serial++; XSyncIntToValue (&value, window->sync_request_serial); - + ev.type = ClientMessage; ev.window = window->xwindow; ev.message_type = window->display->atom_WM_PROTOCOLS; @@ -3351,26 +3351,26 @@ meta_window_move_resize_internal (MetaWindow *window, int client_move_y; MetaRectangle new_rect; MetaRectangle old_rect; - + is_configure_request = (flags & META_IS_CONFIGURE_REQUEST) != 0; do_gravity_adjust = (flags & META_DO_GRAVITY_ADJUST) != 0; is_user_action = (flags & META_IS_USER_ACTION) != 0; /* The action has to be a move or a resize or both... */ g_assert (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)); - + /* We don't need it in the idle queue anymore. */ meta_window_unqueue (window, META_QUEUE_MOVE_RESIZE); meta_window_get_client_root_coords (window, &old_rect); - + meta_topic (META_DEBUG_GEOMETRY, "Move/resize %s to %d,%d %dx%d%s%s from %d,%d %dx%d\n", window->desc, root_x_nw, root_y_nw, w, h, is_configure_request ? " (configure request)" : "", is_user_action ? " (user move/resize)" : "", old_rect.x, old_rect.y, old_rect.width, old_rect.height); - + if (window->frame) meta_frame_calc_borders (window->frame, &borders); @@ -3383,9 +3383,9 @@ meta_window_move_resize_internal (MetaWindow *window, * instead obtained by resizing the old rectangle according to the * relevant gravity. */ - if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == + if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == META_IS_RESIZE_ACTION) - { + { meta_rectangle_resize_with_gravity (&old_rect, &new_rect, gravity, @@ -3397,7 +3397,7 @@ meta_window_move_resize_internal (MetaWindow *window, new_rect.x, new_rect.y); } else if (is_configure_request || do_gravity_adjust) - { + { adjust_for_gravity (window, window->frame ? &borders : NULL, /* configure request coords assume @@ -3424,14 +3424,14 @@ meta_window_move_resize_internal (MetaWindow *window, h = new_rect.height; root_x_nw = new_rect.x; root_y_nw = new_rect.y; - + if (w != window->rect.width || h != window->rect.height) - need_resize_client = TRUE; - + need_resize_client = TRUE; + window->rect.width = w; window->rect.height = h; - + if (window->frame) { int new_w, new_h; @@ -3447,7 +3447,7 @@ meta_window_move_resize_internal (MetaWindow *window, frame_size_dy = new_h - window->frame->rect.height; need_resize_frame = (frame_size_dx != 0 || frame_size_dy != 0); - + window->frame->rect.width = new_w; window->frame->rect.height = new_h; @@ -3476,12 +3476,12 @@ meta_window_move_resize_internal (MetaWindow *window, * behavior. The move and resize must actually occur, it is not * enough to set CWX | CWWidth but pass in the current size/pos. */ - + if (window->frame) { int new_x, new_y; int frame_pos_dx, frame_pos_dy; - + /* Compute new frame coords */ new_x = root_x_nw - borders.visible.left; new_y = root_y_nw - borders.visible.top; @@ -3490,9 +3490,9 @@ meta_window_move_resize_internal (MetaWindow *window, frame_pos_dy = new_y - window->frame->rect.y; need_move_frame = (frame_pos_dx != 0 || frame_pos_dy != 0); - + window->frame->rect.x = new_x; - window->frame->rect.y = new_y; + window->frame->rect.y = new_y; /* If frame will both move and resize, then StaticGravity * on the child window will kick in and implicitly move @@ -3506,7 +3506,7 @@ meta_window_move_resize_internal (MetaWindow *window, /* window->rect.x, window->rect.y are relative to frame, * remember they are the server coords */ - + new_x = borders.visible.left; new_y = borders.visible.top; @@ -3519,7 +3519,7 @@ meta_window_move_resize_internal (MetaWindow *window, /* when we move the frame by frame_pos_dx, frame_pos_dy the * client will implicitly move relative to frame by the * inverse delta. - * + * * When moving client then frame, we move the client by the * frame delta, to be canceled out by the implicit move by * the inverse frame delta, resulting in a client at new_x, @@ -3533,7 +3533,7 @@ meta_window_move_resize_internal (MetaWindow *window, * In both cases we need to move the client window * in all cases where we had to move the frame window. */ - + client_move_x = new_x + frame_pos_dx; client_move_y = new_y + frame_pos_dy; @@ -3557,7 +3557,7 @@ meta_window_move_resize_internal (MetaWindow *window, /* This is the final target position, but not necessarily what * we pass to XConfigureWindow, due to StaticGravity implicit * movement. - */ + */ window->rect.x = new_x; window->rect.y = new_y; } @@ -3566,7 +3566,7 @@ meta_window_move_resize_internal (MetaWindow *window, if (root_x_nw != window->rect.x || root_y_nw != window->rect.y) need_move_client = TRUE; - + window->rect.x = root_x_nw; window->rect.y = root_y_nw; @@ -3593,9 +3593,9 @@ meta_window_move_resize_internal (MetaWindow *window, } /* See ICCCM 4.1.5 for when to send ConfigureNotify */ - + need_configure_notify = FALSE; - + /* If this is a configure request and we change nothing, then we * must send configure notify. */ @@ -3623,7 +3623,7 @@ meta_window_move_resize_internal (MetaWindow *window, ((window->size_hints.flags & PPosition) || (window->size_hints.flags & USPosition))) need_configure_notify = TRUE; - + /* The rest of this function syncs our new size/pos with X as * efficiently as possible */ @@ -3636,8 +3636,8 @@ meta_window_move_resize_internal (MetaWindow *window, configure_frame_first = (size_dx + size_dy >= 0); if (use_static_gravity) - meta_window_set_gravity (window, StaticGravity); - + meta_window_set_gravity (window, StaticGravity); + if (configure_frame_first && window->frame) meta_frame_sync_to_window (window->frame, gravity, @@ -3648,7 +3648,7 @@ meta_window_move_resize_internal (MetaWindow *window, values.y = client_move_y; values.width = window->rect.width; values.height = window->rect.height; - + mask = 0; if (is_configure_request && window->border_width != 0) mask |= CWBorderWidth; /* must force to 0 */ @@ -3670,7 +3670,7 @@ meta_window_move_resize_internal (MetaWindow *window, need_move_client ? "true" : "false", need_resize_client ? "true" : "false"); } - + meta_error_trap_push (window->display); #ifdef HAVE_XSYNC @@ -3679,7 +3679,7 @@ meta_window_move_resize_internal (MetaWindow *window, window->sync_request_time.tv_usec == 0 && window->sync_request_time.tv_sec == 0) { - /* turn off updating */ + /* turn off updating */ if (window->display->compositor) meta_compositor_set_updates (window->display->compositor, window, FALSE); @@ -3691,19 +3691,19 @@ meta_window_move_resize_internal (MetaWindow *window, window->xwindow, mask, &values); - + meta_error_trap_pop (window->display, FALSE); } if (!configure_frame_first && window->frame) meta_frame_sync_to_window (window->frame, gravity, - need_move_frame, need_resize_frame); + need_move_frame, need_resize_frame); /* Put gravity back to be nice to lesser window managers */ if (use_static_gravity) - meta_window_set_gravity (window, NorthWestGravity); - + meta_window_set_gravity (window, NorthWestGravity); + if (need_configure_notify) send_configure_notify (window); @@ -3727,12 +3727,12 @@ meta_window_move_resize_internal (MetaWindow *window, { meta_topic (META_DEBUG_GEOMETRY, "Size/position not modified\n"); } - + if (window->display->grab_wireframe_active) meta_window_update_wireframe (window, root_x_nw, root_y_nw, w, h); else meta_window_refresh_resize_popup (window); - + /* Invariants leaving this function are: * a) window->rect and frame->rect reflect the actual * server-side size/pos of window->xwindow and frame->xwindow @@ -3753,7 +3753,7 @@ meta_window_resize (MetaWindow *window, MetaMoveResizeFlags flags; meta_window_get_position (window, &x, &y); - + flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION; meta_window_move_resize_internal (window, flags, @@ -3767,7 +3767,7 @@ meta_window_move (MetaWindow *window, int root_x_nw, int root_y_nw) { - MetaMoveResizeFlags flags = + MetaMoveResizeFlags flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION; meta_window_move_resize_internal (window, flags, @@ -3785,8 +3785,8 @@ meta_window_move_resize (MetaWindow *window, int w, int h) { - MetaMoveResizeFlags flags = - (user_op ? META_IS_USER_ACTION : 0) | + MetaMoveResizeFlags flags = + (user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION; meta_window_move_resize_internal (window, flags, @@ -3806,7 +3806,7 @@ meta_window_resize_with_gravity (MetaWindow *window, MetaMoveResizeFlags flags; meta_window_get_position (window, &x, &y); - + flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION; meta_window_move_resize_internal (window, flags, @@ -3847,7 +3847,7 @@ idle_move_resize (gpointer data) queue_idle[queue_index] = 0; destroying_windows_disallowed += 1; - + tmp = copy; while (tmp != NULL) { @@ -3856,15 +3856,15 @@ idle_move_resize (gpointer data) window = tmp->data; /* As a side effect, sets window->move_resize_queued = FALSE */ - meta_window_move_resize_now (window); - + meta_window_move_resize_now (window); + tmp = tmp->next; } g_slist_free (copy); destroying_windows_disallowed -= 1; - + return FALSE; } @@ -3907,7 +3907,7 @@ meta_window_get_gravity_position (MetaWindow *window, MetaRectangle frame_extents; int w, h; int x, y; - + w = window->rect.width; h = window->rect.height; @@ -3930,7 +3930,7 @@ meta_window_get_gravity_position (MetaWindow *window, x = frame_extents.x; y = frame_extents.y; - + switch (gravity) { case NorthGravity: @@ -3941,7 +3941,7 @@ meta_window_get_gravity_position (MetaWindow *window, /* Center client window on that point. */ x -= w / 2; break; - + case SouthEastGravity: case EastGravity: case NorthEastGravity: @@ -3953,7 +3953,7 @@ meta_window_get_gravity_position (MetaWindow *window, default: break; } - + switch (gravity) { case WestGravity: @@ -3975,7 +3975,7 @@ meta_window_get_gravity_position (MetaWindow *window, default: break; } - + if (root_x) *root_x = x; if (root_y) @@ -4062,7 +4062,7 @@ meta_window_get_wireframe_geometry (MetaWindow *window, return; } - *width = window->display->grab_wireframe_rect.width - + *width = window->display->grab_wireframe_rect.width - window->display->grab_window->size_hints.base_width; *width /= window->display->grab_window->size_hints.width_inc; @@ -4168,7 +4168,7 @@ get_modal_transient (MetaWindow *window) while (tmp != NULL) { MetaWindow *transient = tmp->data; - + if (transient->xtransient_for == modal_transient->xwindow && transient->wm_state_modal) { @@ -4176,7 +4176,7 @@ get_modal_transient (MetaWindow *window) tmp = windows; continue; } - + tmp = tmp->next; } @@ -4192,13 +4192,13 @@ get_modal_transient (MetaWindow *window) void meta_window_focus (MetaWindow *window, guint32 timestamp) -{ +{ MetaWindow *modal_transient; meta_topic (META_DEBUG_FOCUS, "Setting input focus to window %s, input: %d take_focus: %d\n", window->desc, window->input, window->take_focus); - + if (window->display->grab_window && window->display->grab_window->all_keys_grabbed) { @@ -4217,7 +4217,7 @@ meta_window_focus (MetaWindow *window, window->desc, modal_transient->desc); if (!modal_transient->on_all_workspaces && modal_transient->workspace != window->screen->active_workspace) - meta_window_change_workspace (modal_transient, + meta_window_change_workspace (modal_transient, window->screen->active_workspace); window = modal_transient; } @@ -4264,7 +4264,7 @@ meta_window_focus (MetaWindow *window, FALSE, timestamp); } - + if (window->take_focus) { meta_topic (META_DEBUG_FOCUS, @@ -4289,8 +4289,8 @@ meta_window_change_workspace_without_transients (MetaWindow *window, { meta_verbose ("Changing window %s to workspace %d\n", window->desc, meta_workspace_index (workspace)); - - /* unstick if stuck. meta_window_unstick would call + + /* unstick if stuck. meta_window_unstick would call * meta_window_change_workspace recursively if the window * is not in the active workspace. */ @@ -4328,12 +4328,12 @@ meta_window_change_workspace (MetaWindow *window, static void window_stick_impl (MetaWindow *window) { - GList *tmp; + GList *tmp; MetaWorkspace *workspace; meta_verbose ("Sticking window %s current on_all_workspaces = %d\n", window->desc, window->on_all_workspaces); - + if (window->on_all_workspaces) return; @@ -4356,7 +4356,7 @@ window_stick_impl (MetaWindow *window) } meta_window_set_current_workspace_hint (window); - + meta_window_queue(window, META_QUEUE_CALC_SHOWING); } @@ -4390,9 +4390,9 @@ window_unstick_impl (MetaWindow *window) */ if (window->screen->active_workspace != window->workspace) meta_window_change_workspace (window, window->screen->active_workspace); - + meta_window_set_current_workspace_hint (window); - + meta_window_queue(window, META_QUEUE_CALC_SHOWING); } @@ -4479,15 +4479,15 @@ meta_window_set_current_workspace_hint (MetaWindow *window) if (window->workspace == NULL) { - /* this happens when unmanaging windows */ + /* this happens when unmanaging windows */ return; } - + data[0] = meta_window_get_net_wm_desktop (window); meta_verbose ("Setting _NET_WM_DESKTOP of %s to %lu\n", window->desc, data[0]); - + meta_error_trap_push (window->display); XChangeProperty (window->display->xdisplay, window->xwindow, window->display->atom__NET_WM_DESKTOP, @@ -4527,7 +4527,7 @@ meta_window_raise (MetaWindow *window) ancestor = meta_window_find_root_ancestor (window); meta_topic (META_DEBUG_WINDOW_OPS, - "Raising window %s, ancestor of %s\n", + "Raising window %s, ancestor of %s\n", ancestor->desc, window->desc); /* Raise the ancestor of the window (if the window has no ancestor, @@ -4577,7 +4577,7 @@ meta_window_send_icccm_message (MetaWindow *window, /* This comment and code are from twm, copyright * Open Group, Evans & Sutherland, etc. */ - + /* * ICCCM Client Messages - Section 4.2.8 of the ICCCM dictates that all * client messages will have the following form: @@ -4589,9 +4589,9 @@ meta_window_send_icccm_message (MetaWindow *window, * data[0] message atom * data[1] time stamp */ - + XClientMessageEvent ev; - + ev.type = ClientMessage; ev.window = window->xwindow; ev.message_type = window->display->atom_WM_PROTOCOLS; @@ -4626,7 +4626,7 @@ meta_window_move_resize_request (MetaWindow *window, * * Still have to do the ConfigureNotify and all, but pretend the * app asked for the current size/position instead of the new one. - */ + */ in_grab_op = FALSE; if (window->display->grab_op != META_GRAB_OP_NONE && window == window->display->grab_window) @@ -4648,7 +4648,7 @@ meta_window_move_resize_request (MetaWindow *window, break; } } - + /* it's essential to use only the explicitly-set fields, * and otherwise use our current up-to-date position. * @@ -4662,7 +4662,7 @@ meta_window_move_resize_request (MetaWindow *window, &x, &y); allow_position_change = FALSE; - + if (meta_prefs_get_disable_workarounds ()) { if (window->type == META_WINDOW_DIALOG || @@ -4684,7 +4684,7 @@ meta_window_move_resize_request (MetaWindow *window, if (in_grab_op) allow_position_change = FALSE; - + if (allow_position_change) { if (value_mask & CWX) @@ -4702,10 +4702,10 @@ meta_window_move_resize_request (MetaWindow *window, else { meta_topic (META_DEBUG_GEOMETRY, - "Not allowing position change for window %s PPosition 0x%lx USPosition 0x%lx type %u\n", - window->desc, window->size_hints.flags & PPosition, + "Not allowing position change for window %s PPosition 0x%lx USPosition 0x%lx type %u\n", + window->desc, window->size_hints.flags & PPosition, window->size_hints.flags & USPosition, - window->type); + window->type); } width = window->rect.width; @@ -4714,13 +4714,13 @@ meta_window_move_resize_request (MetaWindow *window, { if (value_mask & CWWidth) width = new_width; - + if (value_mask & CWHeight) height = new_height; } /* ICCCM 4.1.5 */ - + /* We're ignoring the value_mask here, since sizes * not in the mask will be the current window geometry. */ @@ -4749,7 +4749,7 @@ meta_window_move_resize_request (MetaWindow *window, flags |= META_IS_RESIZE_ACTION; if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) - meta_window_move_resize_internal (window, + meta_window_move_resize_internal (window, flags, gravity, x, @@ -4790,7 +4790,7 @@ meta_window_configure_request (MetaWindow *window, event->xconfigurerequest.y, event->xconfigurerequest.width, event->xconfigurerequest.height); - + /* Handle stacking. We only handle raises/lowers (both absolute and * relative to siblings), mostly because stack.c really can't deal with @@ -4839,8 +4839,8 @@ meta_window_configure_request (MetaWindow *window, restack_window(window, sibling, event->xconfigurerequest.detail); } - } - + } + return TRUE; } @@ -4848,7 +4848,7 @@ gboolean meta_window_property_notify (MetaWindow *window, XEvent *event) { - return process_property_notify (window, &event->xproperty); + return process_property_notify (window, &event->xproperty); } #define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0 @@ -4932,7 +4932,7 @@ meta_window_client_message (MetaWindow *window, window->desc); timestamp = meta_display_get_current_time (window->display); } - + meta_window_delete (window, timestamp); return TRUE; @@ -4947,9 +4947,9 @@ meta_window_client_message (MetaWindow *window, { int space; MetaWorkspace *workspace; - + space = event->xclient.data.l[0]; - + meta_verbose ("Request to move %s to workspace %d\n", window->desc, space); @@ -4974,7 +4974,7 @@ meta_window_client_message (MetaWindow *window, meta_verbose ("Window %s now on_all_workspaces = %d\n", window->desc, window->on_all_workspaces); - + return TRUE; } else if (event->xclient.message_type == @@ -4987,7 +4987,7 @@ meta_window_client_message (MetaWindow *window, action = event->xclient.data.l[0]; first = event->xclient.data.l[1]; second = event->xclient.data.l[2]; - + if (meta_is_verbose ()) { char *str1; @@ -4999,10 +4999,10 @@ meta_window_client_message (MetaWindow *window, str1 = NULL; meta_error_trap_push_with_return (display); - str2 = XGetAtomName (display->xdisplay, second); + str2 = XGetAtomName (display->xdisplay, second); if (meta_error_trap_pop_with_return (display, TRUE) != Success) str2 = NULL; - + meta_verbose ("Request to change _NET_WM_STATE action %lu atom1: %s atom2: %s\n", action, str1 ? str1 : "(unknown)", @@ -5020,7 +5020,7 @@ meta_window_client_message (MetaWindow *window, /* Stupid protocol has no timestamp; of course, shading * sucks anyway so who really cares that we're forced to do - * a roundtrip here? + * a roundtrip here? */ timestamp = meta_display_get_current_time_roundtrip (window->display); @@ -5044,14 +5044,14 @@ meta_window_client_message (MetaWindow *window, else meta_window_unmake_fullscreen (window); } - + if (first == display->atom__NET_WM_STATE_MAXIMIZED_HORZ || second == display->atom__NET_WM_STATE_MAXIMIZED_HORZ) { gboolean max; max = (action == _NET_WM_STATE_ADD || - (action == _NET_WM_STATE_TOGGLE && + (action == _NET_WM_STATE_TOGGLE && !window->maximized_horizontally)); if (max && window->has_maximize_func) { @@ -5073,7 +5073,7 @@ meta_window_client_message (MetaWindow *window, gboolean max; max = (action == _NET_WM_STATE_ADD || - (action == _NET_WM_STATE_TOGGLE && + (action == _NET_WM_STATE_TOGGLE && !window->maximized_vertically)); if (max && window->has_maximize_func) { @@ -5095,7 +5095,7 @@ meta_window_client_message (MetaWindow *window, window->wm_state_modal = (action == _NET_WM_STATE_ADD) || (action == _NET_WM_STATE_TOGGLE && !window->wm_state_modal); - + recalc_window_type (window); meta_window_queue(window, META_QUEUE_MOVE_RESIZE); } @@ -5103,7 +5103,7 @@ meta_window_client_message (MetaWindow *window, if (first == display->atom__NET_WM_STATE_SKIP_PAGER || second == display->atom__NET_WM_STATE_SKIP_PAGER) { - window->wm_state_skip_pager = + window->wm_state_skip_pager = (action == _NET_WM_STATE_ADD) || (action == _NET_WM_STATE_TOGGLE && !window->skip_pager); @@ -5125,7 +5125,7 @@ meta_window_client_message (MetaWindow *window, if (first == display->atom__NET_WM_STATE_ABOVE || second == display->atom__NET_WM_STATE_ABOVE) { - window->wm_state_above = + window->wm_state_above = (action == _NET_WM_STATE_ADD) || (action == _NET_WM_STATE_TOGGLE && !window->wm_state_above); @@ -5136,7 +5136,7 @@ meta_window_client_message (MetaWindow *window, if (first == display->atom__NET_WM_STATE_BELOW || second == display->atom__NET_WM_STATE_BELOW) { - window->wm_state_below = + window->wm_state_below = (action == _NET_WM_STATE_ADD) || (action == _NET_WM_STATE_TOGGLE && !window->wm_state_below); @@ -5153,7 +5153,7 @@ meta_window_client_message (MetaWindow *window, else meta_window_unset_demands_attention (window); } - + if (first == display->atom__NET_WM_STATE_STICKY || second == display->atom__NET_WM_STATE_STICKY) { @@ -5163,7 +5163,7 @@ meta_window_client_message (MetaWindow *window, else meta_window_unstick (window); } - + return TRUE; } else if (event->xclient.message_type == @@ -5193,7 +5193,7 @@ meta_window_client_message (MetaWindow *window, * "frame action". */ gboolean const frame_action = TRUE; - + x_root = event->xclient.data.l[0]; y_root = event->xclient.data.l[1]; action = event->xclient.data.l[2]; @@ -5205,7 +5205,7 @@ meta_window_client_message (MetaWindow *window, "Received _NET_WM_MOVERESIZE message on %s, %d,%d action = %d, button %d\n", window->desc, x_root, y_root, action, button); - + op = META_GRAB_OP_NONE; switch (action) { @@ -5224,7 +5224,7 @@ meta_window_client_message (MetaWindow *window, case _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT: op = META_GRAB_OP_RESIZING_SE; break; - case _NET_WM_MOVERESIZE_SIZE_BOTTOM: + case _NET_WM_MOVERESIZE_SIZE_BOTTOM: op = META_GRAB_OP_RESIZING_S; break; case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT: @@ -5261,8 +5261,8 @@ meta_window_client_message (MetaWindow *window, } else if (op != META_GRAB_OP_NONE && ((window->has_move_func && op == META_GRAB_OP_MOVING) || - (window->has_resize_func && - (op != META_GRAB_OP_MOVING && + (window->has_resize_func && + (op != META_GRAB_OP_MOVING && op != META_GRAB_OP_KEYBOARD_MOVING)))) { /* @@ -5378,7 +5378,7 @@ meta_window_client_message (MetaWindow *window, meta_window_update_fullscreen_monitors (window, top, bottom, left, right); } - + return FALSE; } @@ -5406,7 +5406,7 @@ meta_window_notify_focus (MetaWindow *window, /* note the event can be on either the window or the frame, * we focus the frame for shaded windows */ - + /* The event can be FocusIn, FocusOut, or UnmapNotify. * On UnmapNotify we have to pretend it's focus out, * because we won't get a focus out if it occurs, apparently. @@ -5420,7 +5420,7 @@ meta_window_notify_focus (MetaWindow *window, * XGrabKey, which means focus_window disappears and the front of * the MRU list gets confused from what the user expects once a * keybinding is used. - */ + */ meta_topic (META_DEBUG_FOCUS, "Focus %s event received on %s 0x%lx (%s) " "mode %s detail %s\n", @@ -5457,7 +5457,7 @@ meta_window_notify_focus (MetaWindow *window, * * http://bugzilla.gnome.org/show_bug.cgi?id=90382 */ - + if ((event->type == FocusIn || event->type == FocusOut) && (event->xfocus.mode == NotifyGrab || @@ -5469,7 +5469,7 @@ meta_window_notify_focus (MetaWindow *window, "Ignoring focus event generated by a grab or other weirdness\n"); return TRUE; } - + if (event->type == FocusIn) { if (window != window->display->focus_window) @@ -5490,27 +5490,27 @@ meta_window_notify_focus (MetaWindow *window, * workspace. */ if (window->screen->active_workspace && - meta_window_located_on_workspace (window, + meta_window_located_on_workspace (window, window->screen->active_workspace)) { GList* link; - link = g_list_find (window->screen->active_workspace->mru_list, + link = g_list_find (window->screen->active_workspace->mru_list, window); g_assert (link); - window->screen->active_workspace->mru_list = + window->screen->active_workspace->mru_list = g_list_remove_link (window->screen->active_workspace->mru_list, link); g_list_free (link); - window->screen->active_workspace->mru_list = - g_list_prepend (window->screen->active_workspace->mru_list, + window->screen->active_workspace->mru_list = + g_list_prepend (window->screen->active_workspace->mru_list, window); } if (window->frame) meta_frame_queue_draw (window->frame); - + meta_error_trap_push (window->display); XInstallColormap (window->display->xdisplay, window->colormap); @@ -5552,7 +5552,7 @@ meta_window_notify_focus (MetaWindow *window, window->desc); return TRUE; } - + if (window == window->display->focus_window) { meta_topic (META_DEBUG_FOCUS, @@ -5561,7 +5561,7 @@ meta_window_notify_focus (MetaWindow *window, meta_topic (META_DEBUG_FOCUS, "* Focus --> NULL (was %s)\n", window->desc); - + window->display->focus_window = NULL; window->has_focus = FALSE; @@ -5571,7 +5571,7 @@ meta_window_notify_focus (MetaWindow *window, if (window->frame) meta_frame_queue_draw (window->frame); - meta_compositor_set_active_window (window->display->compositor, + meta_compositor_set_active_window (window->display->compositor, window->screen, NULL); meta_error_trap_push (window->display); @@ -5591,7 +5591,7 @@ meta_window_notify_focus (MetaWindow *window, /* Now set _NET_ACTIVE_WINDOW hint */ meta_display_update_active_window_hint (window->display); - + return FALSE; } @@ -5620,7 +5620,7 @@ send_configure_notify (MetaWindow *window) XEvent event; /* from twm */ - + event.type = ConfigureNotify; event.xconfigure.display = window->display->xdisplay; event.xconfigure.event = window->xwindow; @@ -5655,7 +5655,7 @@ send_configure_notify (MetaWindow *window) window->desc, event.xconfigure.x, event.xconfigure.y, event.xconfigure.width, event.xconfigure.height); - + meta_error_trap_push (window->display); XSendEvent (window->display->xdisplay, window->xwindow, @@ -5682,7 +5682,7 @@ meta_window_get_icon_geometry (MetaWindow *window, meta_XFree (geometry); return FALSE; } - + if (rect) { rect->x = geometry[0]; @@ -5704,7 +5704,7 @@ read_client_leader (MetaDisplay *display, Window xwindow) { Window retval = None; - + meta_prop_get_window (display, xwindow, display->atom_WM_CLIENT_LEADER, &retval); @@ -5714,7 +5714,7 @@ read_client_leader (MetaDisplay *display, typedef struct { - Window leader; + Window leader; } ClientLeaderData; static gboolean @@ -5736,7 +5736,7 @@ static void update_sm_hints (MetaWindow *window) { Window leader; - + window->xclient_leader = None; window->sm_client_id = NULL; @@ -5753,11 +5753,11 @@ update_sm_hints (MetaWindow *window) &d); leader = d.leader; } - + if (leader != None) { char *str; - + window->xclient_leader = leader; if (meta_prop_get_latin1_string (window->display, leader, @@ -5787,7 +5787,7 @@ update_sm_hints (MetaWindow *window) if (window->sm_client_id == NULL) /* first time through */ meta_warning (_("Window %s sets SM_CLIENT_ID on itself, instead of on the WM_CLIENT_LEADER window as specified in the ICCCM.\n"), window->desc); - + window->sm_client_id = g_strdup (str); meta_XFree (str); } @@ -5817,7 +5817,7 @@ meta_window_update_icon_now (MetaWindow *window) icon = NULL; mini_icon = NULL; - + if (meta_read_icons (window->screen, window->xwindow, &window->icon_cache, @@ -5831,16 +5831,16 @@ meta_window_update_icon_now (MetaWindow *window) { if (window->icon) g_object_unref (G_OBJECT (window->icon)); - + if (window->mini_icon) g_object_unref (G_OBJECT (window->mini_icon)); - + window->icon = icon; window->mini_icon = mini_icon; redraw_icon (window); } - + g_assert (window->icon); g_assert (window->mini_icon); } @@ -5864,7 +5864,7 @@ idle_update_icon (gpointer data) queue_idle[queue_index] = 0; destroying_windows_disallowed += 1; - + tmp = copy; while (tmp != NULL) { @@ -5872,16 +5872,16 @@ idle_update_icon (gpointer data) window = tmp->data; - meta_window_update_icon_now (window); + meta_window_update_icon_now (window); window->is_in_queues &= ~META_QUEUE_UPDATE_ICON; - + tmp = tmp->next; } g_slist_free (copy); destroying_windows_disallowed -= 1; - + return FALSE; } @@ -5900,7 +5900,7 @@ invalidate_work_areas (MetaWindow *window) GList *tmp; tmp = meta_window_get_workspaces (window); - + while (tmp != NULL) { meta_workspace_invalidate_work_area (tmp->data); @@ -5921,7 +5921,7 @@ meta_window_update_struts (MetaWindow *window) meta_verbose ("Updating struts for %s\n", window->desc); old_struts = window->struts; - new_struts = NULL; + new_struts = NULL; if (meta_prop_get_cardinal_list (window->display, window->xwindow, @@ -5977,7 +5977,7 @@ meta_window_update_struts (MetaWindow *window) meta_verbose ("_NET_WM_STRUT_PARTIAL struts %lu %lu %lu %lu for " "window %s\n", - struts[0], struts[1], struts[2], struts[3], + struts[0], struts[1], struts[2], struts[3], window->desc); } meta_XFree (struts); @@ -6033,9 +6033,9 @@ meta_window_update_struts (MetaWindow *window) new_struts = g_slist_prepend (new_struts, temp); } - + meta_verbose ("_NET_WM_STRUT struts %lu %lu %lu %lu for window %s\n", - struts[0], struts[1], struts[2], struts[3], + struts[0], struts[1], struts[2], struts[3], window->desc); } meta_XFree (struts); @@ -6045,7 +6045,7 @@ meta_window_update_struts (MetaWindow *window) meta_verbose ("No _NET_WM_STRUT property for %s\n", window->desc); } - + /* Determine whether old_struts and new_struts are the same */ old_iter = old_struts; new_iter = new_struts; @@ -6092,7 +6092,7 @@ recalc_window_type (MetaWindow *window) MetaWindowType old_type; old_type = window->type; - + if (window->type_atom != None) { if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP) @@ -6127,22 +6127,22 @@ recalc_window_type (MetaWindow *window) if (window->type == META_WINDOW_DIALOG && window->wm_state_modal) window->type = META_WINDOW_MODAL_DIALOG; - + meta_verbose ("Calculated type %u for %s, old type %u\n", window->type, window->desc, old_type); if (old_type != window->type) { recalc_window_features (window); - + set_net_wm_state (window); - + /* Update frame */ if (window->decorated) meta_window_ensure_frame (window); else meta_window_destroy_frame (window); - + /* update stacking constraints */ meta_window_update_layer (window); @@ -6211,7 +6211,7 @@ set_allowed_actions_hint (MetaWindow *window) g_assert (i <= MAX_N_ACTIONS); meta_verbose ("Setting _NET_WM_ALLOWED_ACTIONS with %d atoms\n", i); - + meta_error_trap_push (window->display); XChangeProperty (window->display->xdisplay, window->xwindow, window->display->atom__NET_WM_ALLOWED_ACTIONS, @@ -6251,8 +6251,8 @@ recalc_window_features (MetaWindow *window) window->has_minimize_func = window->mwm_has_minimize_func; window->has_maximize_func = window->mwm_has_maximize_func; window->has_move_func = window->mwm_has_move_func; - - window->has_resize_func = TRUE; + + window->has_resize_func = TRUE; /* If min_size == max_size, then don't allow resize */ if (window->size_hints.min_width == window->size_hints.max_width && @@ -6267,7 +6267,7 @@ recalc_window_features (MetaWindow *window) * MWM but not WM_NORMAL_HINTS are basically broken. We complain * about these apps but make them work. */ - + meta_warning (_("Window %s sets an MWM hint indicating it isn't resizable, but sets min size %d x %d and max size %d x %d; this doesn't make much sense.\n"), window->desc, window->size_hints.min_width, @@ -6280,7 +6280,7 @@ recalc_window_features (MetaWindow *window) window->has_fullscreen_func = TRUE; window->always_sticky = FALSE; - + /* Semantic category overrides the MWM hints */ if (window->type == META_WINDOW_TOOLBAR) window->decorated = FALSE; @@ -6298,7 +6298,7 @@ recalc_window_features (MetaWindow *window) if (window->type == META_WINDOW_DESKTOP || window->type == META_WINDOW_DOCK) window->always_sticky = TRUE; - + if (window->type == META_WINDOW_DESKTOP || window->type == META_WINDOW_DOCK || window->type == META_WINDOW_SPLASHSCREEN) @@ -6318,7 +6318,7 @@ recalc_window_features (MetaWindow *window) window->has_move_func = FALSE; window->has_resize_func = FALSE; } - + if (window->type != META_WINDOW_NORMAL) { window->has_minimize_func = FALSE; @@ -6327,9 +6327,9 @@ recalc_window_features (MetaWindow *window) } if (!window->has_resize_func) - { + { window->has_maximize_func = FALSE; - + /* don't allow fullscreen if we can't resize, unless the size * is entire screen size (kind of broken, because we * actually fullscreen to xinerama head size not screen size) @@ -6366,7 +6366,7 @@ recalc_window_features (MetaWindow *window) window->size_hints.min_height, window->size_hints.max_width, window->size_hints.max_height); - + /* no shading if not decorated */ if (!window->decorated || window->border_only) window->has_shade_func = FALSE; @@ -6376,10 +6376,10 @@ recalc_window_features (MetaWindow *window) if (window->wm_state_skip_taskbar) window->skip_taskbar = TRUE; - + if (window->wm_state_skip_pager) window->skip_pager = TRUE; - + switch (window->type) { /* Force skip taskbar/pager on these window types */ @@ -6400,7 +6400,7 @@ recalc_window_features (MetaWindow *window) window->xtransient_for != window->screen->xroot) window->skip_taskbar = TRUE; break; - + case META_WINDOW_NORMAL: break; } @@ -6417,7 +6417,7 @@ recalc_window_features (MetaWindow *window) window->has_shade_func, window->skip_taskbar, window->skip_pager); - + /* FIXME: * Lame workaround for recalc_window_features * being used overzealously. The fix is to @@ -6432,7 +6432,7 @@ recalc_window_features (MetaWindow *window) old_has_shade_func != window->has_shade_func || old_always_sticky != window->always_sticky) set_allowed_actions_hint (window); - + /* FIXME perhaps should ensure if we don't have a shade func, * we aren't shaded, etc. */ @@ -6450,15 +6450,15 @@ menu_callback (MetaWindowMenu *menu, MetaDisplay *display; MetaWindow *window; MetaWorkspace *workspace; - + display = meta_display_for_x_display (xdisplay); window = meta_display_lookup_x_window (display, client_xwindow); workspace = NULL; - + if (window != NULL) /* window can be NULL */ { meta_verbose ("Menu op %u on %s\n", op, window->desc); - + switch (op) { case META_MENU_OP_NONE: @@ -6478,7 +6478,7 @@ menu_callback (MetaWindowMenu *menu, META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL); break; - + case META_MENU_OP_MAXIMIZE: meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL | @@ -6488,11 +6488,11 @@ menu_callback (MetaWindowMenu *menu, case META_MENU_OP_UNSHADE: meta_window_unshade (window, timestamp); break; - + case META_MENU_OP_SHADE: meta_window_shade (window, timestamp); break; - + case META_MENU_OP_MOVE_LEFT: workspace = meta_workspace_get_neighbor (window->screen->active_workspace, META_MOTION_LEFT); @@ -6551,7 +6551,7 @@ menu_callback (MetaWindowMenu *menu, case META_MENU_OP_RECOVER: meta_window_shove_titlebar_onscreen (window); break; - + default: meta_warning (G_STRLOC": Unknown window op\n"); break; @@ -6577,7 +6577,7 @@ menu_callback (MetaWindowMenu *menu, display->window_menu = NULL; display->window_with_menu = NULL; } - + meta_ui_window_menu_free (menu); } @@ -6594,7 +6594,7 @@ meta_window_show_menu (MetaWindow *window, MetaWorkspaceLayout layout; int n_workspaces; gboolean ltr; - + if (window->display->window_menu) { meta_ui_window_menu_free (window->display->window_menu); @@ -6644,7 +6644,7 @@ meta_window_show_menu (MetaWindow *window, ops |= META_MENU_OP_UNMAXIMIZE; else ops |= META_MENU_OP_MAXIMIZE; - + #if 0 if (window->shaded) ops |= META_MENU_OP_UNSHADE; @@ -6659,13 +6659,13 @@ meta_window_show_menu (MetaWindow *window, ops |= META_MENU_OP_UNABOVE; else ops |= META_MENU_OP_ABOVE; - + if (!window->has_maximize_func) insensitive |= META_MENU_OP_UNMAXIMIZE | META_MENU_OP_MAXIMIZE; - + if (!window->has_minimize_func) insensitive |= META_MENU_OP_MINIMIZE; - + if (!window->has_close_func) insensitive |= META_MENU_OP_DELETE; @@ -6691,7 +6691,7 @@ meta_window_show_menu (MetaWindow *window, */ if ((ops & ~insensitive) == 0) return; - + menu = meta_ui_window_menu_new (window->screen->ui, window->xwindow, @@ -6700,13 +6700,13 @@ meta_window_show_menu (MetaWindow *window, meta_window_get_net_wm_desktop (window), meta_screen_get_n_workspaces (window->screen), menu_callback, - NULL); + NULL); window->display->window_menu = menu; window->display->window_with_menu = window; - + meta_verbose ("Popping up window menu for %s\n", window->desc); - + meta_ui_window_menu_popup (menu, root_x, root_y, button, timestamp); } @@ -6734,7 +6734,7 @@ meta_window_shove_titlebar_onscreen (MetaWindow *window) vert_amount = outer_rect.height; meta_rectangle_expand_region (onscreen_region, horiz_amount, - horiz_amount, + horiz_amount, 0, vert_amount); meta_rectangle_shove_into_region(onscreen_region, @@ -6742,7 +6742,7 @@ meta_window_shove_titlebar_onscreen (MetaWindow *window) &outer_rect); meta_rectangle_expand_region (onscreen_region, -horiz_amount, - -horiz_amount, + -horiz_amount, 0, -vert_amount); @@ -6752,7 +6752,7 @@ meta_window_shove_titlebar_onscreen (MetaWindow *window) FALSE, newx, newy, - window->rect.width, + window->rect.width, window->rect.height); } @@ -6770,7 +6770,7 @@ meta_window_titlebar_is_onscreen (MetaWindow *window) /* Titlebar can't be offscreen if there is no titlebar... */ if (!window->frame) return FALSE; - + /* Get the rectangle corresponding to the titlebar */ meta_window_get_outer_rect (window, &titlebar_rect); titlebar_rect.height = window->frame->child_y; @@ -6784,16 +6784,16 @@ meta_window_titlebar_is_onscreen (MetaWindow *window) { MetaRectangle *spanning_rect = onscreen_region->data; MetaRectangle overlap; - + meta_rectangle_intersect (&titlebar_rect, spanning_rect, &overlap); if (overlap.height > MIN (titlebar_rect.height, min_height_needed) && - overlap.width > MIN (titlebar_rect.width * min_width_percent, + overlap.width > MIN (titlebar_rect.width * min_width_percent, min_width_absolute)) { is_onscreen = TRUE; break; } - + onscreen_region = onscreen_region->next; } @@ -6817,11 +6817,11 @@ time_diff (const GTimeVal *first, } static gboolean -check_moveresize_frequency (MetaWindow *window, +check_moveresize_frequency (MetaWindow *window, gdouble *remaining) { GTimeVal current_time; - + g_get_current_time (¤t_time); #ifdef HAVE_XSYNC @@ -6842,7 +6842,7 @@ check_moveresize_frequency (MetaWindow *window, */ if (remaining) *remaining = 1000.0 - elapsed + 100; - + return FALSE; } else @@ -6875,17 +6875,17 @@ check_moveresize_frequency (MetaWindow *window, meta_topic (META_DEBUG_RESIZING, "Delaying move/resize as only %g of %g ms elapsed\n", elapsed, ms_between_resizes); - + if (remaining) *remaining = (ms_between_resizes - elapsed); return FALSE; } - + meta_topic (META_DEBUG_RESIZING, " Checked moveresize freq, allowing move/resize now (%g of %g seconds elapsed)\n", elapsed / 1000.0, 1.0 / max_resizes_per_second); - + return TRUE; } } @@ -6895,7 +6895,7 @@ update_move_timeout (gpointer data) { MetaWindow *window = data; - update_move (window, + update_move (window, window->display->grab_last_user_action_was_snap, window->display->grab_latest_motion_x, window->display->grab_latest_motion_y); @@ -6914,10 +6914,10 @@ update_move (MetaWindow *window, MetaRectangle old; int shake_threshold; MetaDisplay *display = window->display; - + display->grab_latest_motion_x = x; display->grab_latest_motion_y = y; - + dx = x - display->grab_anchor_root_x; dy = y - display->grab_anchor_root_y; @@ -6947,7 +6947,7 @@ update_move (MetaWindow *window, #define DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR 6 shake_threshold = meta_ui_get_drag_threshold (window->screen->ui) * DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR; - + if (snap) { /* We don't want to tile while snapping. Also, clear any previous tile @@ -7018,11 +7018,11 @@ update_move (MetaWindow *window, window->tile_mode = META_TILE_NONE; /* move the unmaximized window to the cursor */ - prop = - ((double)(x - display->grab_initial_window_pos.x)) / + prop = + ((double)(x - display->grab_initial_window_pos.x)) / ((double)display->grab_initial_window_pos.width); - display->grab_initial_window_pos.x = + display->grab_initial_window_pos.x = x - window->saved_rect.width * prop; display->grab_initial_window_pos.y = y; @@ -7057,7 +7057,7 @@ update_move (MetaWindow *window, { meta_window_get_work_area_for_xinerama (window, monitor, &work_area); - /* check if cursor is near the top of a xinerama work area */ + /* check if cursor is near the top of a xinerama work area */ if (x >= work_area.x && x < (work_area.x + work_area.width) && y >= work_area.y && @@ -7070,8 +7070,8 @@ update_move (MetaWindow *window, { window->saved_rect.x = work_area.x; window->saved_rect.y = work_area.y; - - if (window->frame) + + if (window->frame) { window->saved_rect.x += window->frame->child_x; window->saved_rect.y += window->frame->child_y; @@ -7120,7 +7120,7 @@ update_move (MetaWindow *window, new_y = old.y; /* Do any edge resistance/snapping */ - meta_window_edge_resistance_for_move (window, + meta_window_edge_resistance_for_move (window, old.x, old.y, &new_x, @@ -7133,13 +7133,13 @@ update_move (MetaWindow *window, { int root_x = new_x - display->grab_anchor_window_pos.x + display->grab_anchor_root_x; int root_y = new_y - display->grab_anchor_window_pos.y + display->grab_anchor_root_y; - + meta_compositor_update_move (display->compositor, window, root_x, root_y); } if (display->grab_wireframe_active) - meta_window_update_wireframe (window, new_x, new_y, + meta_window_update_wireframe (window, new_x, new_y, display->grab_wireframe_rect.width, display->grab_wireframe_rect.height); else @@ -7151,7 +7151,7 @@ update_resize_timeout (gpointer data) { MetaWindow *window = data; - update_resize (window, + update_resize (window, window->display->grab_last_user_action_was_snap, window->display->grab_latest_motion_x, window->display->grab_latest_motion_y, @@ -7171,10 +7171,10 @@ update_resize (MetaWindow *window, MetaRectangle old; int new_x, new_y; double remaining; - + window->display->grab_latest_motion_x = x; window->display->grab_latest_motion_y = y; - + dx = x - window->display->grab_anchor_root_x; dy = y - window->display->grab_anchor_root_y; @@ -7187,7 +7187,7 @@ update_resize (MetaWindow *window, */ if (dx == 0 && dy == 0) return; - + /* FIXME this is only used in wireframe mode */ new_x = window->display->grab_anchor_window_pos.x; new_y = window->display->grab_anchor_window_pos.y; @@ -7235,7 +7235,7 @@ update_resize (MetaWindow *window, meta_window_update_keyboard_resize (window, TRUE); } } - + /* FIXME: This stupidity only needed because of wireframe mode and * the fact that wireframe isn't making use of * meta_rectangle_resize_with_gravity(). If we were to use that, we @@ -7261,11 +7261,11 @@ update_resize (MetaWindow *window, new_w -= dx; new_x += dx; break; - + default: break; } - + switch (window->display->grab_op) { case META_GRAB_OP_RESIZING_SE: @@ -7276,7 +7276,7 @@ update_resize (MetaWindow *window, case META_GRAB_OP_KEYBOARD_RESIZING_SW: new_h += dy; break; - + case META_GRAB_OP_RESIZING_N: case META_GRAB_OP_RESIZING_NE: case META_GRAB_OP_RESIZING_NW: @@ -7299,7 +7299,7 @@ update_resize (MetaWindow *window, */ if (!window->display->grab_resize_timeout_id) { - window->display->grab_resize_timeout_id = + window->display->grab_resize_timeout_id = g_timeout_add ((int)remaining, update_resize_timeout, window); } @@ -7316,7 +7316,7 @@ update_resize (MetaWindow *window, g_source_remove (window->display->grab_resize_timeout_id); window->display->grab_resize_timeout_id = 0; } - + if (window->display->grab_wireframe_active) old = window->display->grab_wireframe_rect; else @@ -7332,7 +7332,7 @@ update_resize (MetaWindow *window, case META_GRAB_OP_RESIZING_N: new_w = old.width; break; - + case META_GRAB_OP_RESIZING_E: case META_GRAB_OP_RESIZING_W: new_h = old.height; @@ -7345,7 +7345,7 @@ update_resize (MetaWindow *window, /* compute gravity of client during operation */ gravity = meta_resize_gravity_from_grab_op (window->display->grab_op); g_assert (gravity >= 0); - + /* Do any edge resistance/snapping */ meta_window_edge_resistance_for_resize (window, old.width, @@ -7417,7 +7417,7 @@ check_use_this_motion_notify (MetaWindow *window, XEvent useless; /* This code is copied from Owen's GDK code. */ - + if (window->display->grab_motion_notify_time != 0) { /* == is really the right test, but I'm all for paranoia */ @@ -7434,7 +7434,7 @@ check_use_this_motion_notify (MetaWindow *window, else return FALSE; /* haven't reached the saved timestamp yet */ } - + esd.current_event = event; esd.count = 0; esd.last_time = 0; @@ -7449,7 +7449,7 @@ check_use_this_motion_notify (MetaWindow *window, meta_topic (META_DEBUG_RESIZING, "Will skip %d motion events and use the event with time %u\n", esd.count, (unsigned int) esd.last_time); - + if (esd.last_time == 0) return TRUE; else @@ -7494,7 +7494,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, window->disable_sync = FALSE; window->sync_request_time.tv_sec = 0; window->sync_request_time.tv_usec = 0; - + /* This means we are ready for another configure. */ switch (window->display->grab_op) { @@ -7521,13 +7521,13 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, window->display->grab_latest_motion_y, TRUE); break; - + default: break; } } #endif /* HAVE_XSYNC */ - + switch (event->type) { case ButtonRelease: @@ -7580,7 +7580,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, } meta_display_end_grab_op (window->display, event->xbutton.time); - break; + break; case MotionNotify: meta_display_check_threshold_reached (window->display, @@ -7627,14 +7627,14 @@ meta_window_set_gravity (MetaWindow *window, meta_verbose ("Setting gravity of %s to %d\n", window->desc, gravity); attrs.win_gravity = gravity; - + meta_error_trap_push (window->display); XChangeWindowAttributes (window->display->xdisplay, window->xwindow, CWWinGravity, &attrs); - + meta_error_trap_pop (window->display, FALSE); } @@ -7643,14 +7643,14 @@ get_work_area_xinerama (MetaWindow *window, MetaRectangle *area, int which_xinerama) { - GList *tmp; - + GList *tmp; + g_assert (which_xinerama >= 0); /* Initialize to the whole xinerama */ *area = window->screen->xinerama_infos[which_xinerama].rect; - - tmp = meta_window_get_workspaces (window); + + tmp = meta_window_get_workspaces (window); while (tmp != NULL) { MetaRectangle workspace_work_area; @@ -7662,7 +7662,7 @@ get_work_area_xinerama (MetaWindow *window, area); tmp = tmp->next; } - + meta_topic (META_DEBUG_WORKAREA, "Window %s xinerama %d has work area %d,%d %d x %d\n", window->desc, which_xinerama, @@ -7688,7 +7688,7 @@ meta_window_get_work_area_for_xinerama (MetaWindow *window, MetaRectangle *area) { g_return_if_fail (which_xinerama >= 0); - + get_work_area_xinerama (window, area, which_xinerama); @@ -7698,12 +7698,12 @@ void meta_window_get_work_area_all_xineramas (MetaWindow *window, MetaRectangle *area) { - GList *tmp; + GList *tmp; /* Initialize to the whole screen */ *area = window->screen->rect; - - tmp = meta_window_get_workspaces (window); + + tmp = meta_window_get_workspaces (window); while (tmp != NULL) { MetaRectangle workspace_work_area; @@ -7804,7 +7804,7 @@ meta_window_refresh_resize_popup (MetaWindow *window) "refresh_resize_popup called when wireframe active\n"); return; } - + switch (window->display->grab_op) { case META_GRAB_OP_RESIZING_SE: @@ -7830,7 +7830,7 @@ meta_window_refresh_resize_popup (MetaWindow *window) /* Not resizing */ return; } - + if (window->display->grab_resize_popup == NULL) { if (window->size_hints.width_inc > 1 || @@ -7839,16 +7839,16 @@ meta_window_refresh_resize_popup (MetaWindow *window) meta_ui_resize_popup_new (window->display->xdisplay, window->screen->number); } - + if (window->display->grab_resize_popup != NULL) { MetaRectangle rect; - + if (window->display->grab_wireframe_active) rect = window->display->grab_wireframe_rect; else meta_window_get_client_root_coords (window, &rect); - + meta_ui_resize_popup_set (window->display->grab_resize_popup, rect, window->size_hints.base_width, @@ -7875,13 +7875,13 @@ meta_window_foreach_transient (MetaWindow *window, while (tmp != NULL) { MetaWindow *transient = tmp->data; - + if (meta_window_is_ancestor_of_transient (window, transient)) { if (!(* func) (transient, data)) break; } - + tmp = tmp->next; } @@ -7895,7 +7895,7 @@ meta_window_foreach_ancestor (MetaWindow *window, { MetaWindow *w; MetaWindow *tortoise; - + w = window; tortoise = window; while (TRUE) @@ -7903,27 +7903,27 @@ meta_window_foreach_ancestor (MetaWindow *window, if (w->xtransient_for == None || w->transient_parent_is_root_window) break; - + w = meta_display_lookup_x_window (w->display, w->xtransient_for); - + if (w == NULL || w == tortoise) break; if (!(* func) (w, data)) - break; - + break; + if (w->xtransient_for == None || w->transient_parent_is_root_window) break; w = meta_display_lookup_x_window (w->display, w->xtransient_for); - + if (w == NULL || w == tortoise) break; if (!(* func) (w, data)) break; - + tortoise = meta_display_lookup_x_window (tortoise->display, tortoise->xtransient_for); @@ -7987,7 +7987,7 @@ warp_grab_pointer (MetaWindow *window, /* We may not have done begin_grab_op yet, i.e. may not be in a grab */ - + if (window == display->grab_window && display->grab_wireframe_active) { meta_window_get_xor_rect (window, &display->grab_wireframe_rect, &rect); @@ -7996,7 +7996,7 @@ warp_grab_pointer (MetaWindow *window, { meta_window_get_outer_rect (window, &rect); } - + switch (grab_op) { case META_GRAB_OP_KEYBOARD_MOVING: @@ -8055,7 +8055,7 @@ warp_grab_pointer (MetaWindow *window, /* Avoid weird bouncing at the screen edge; see bug 154706 */ *x = CLAMP (*x, 0, window->screen->rect.width-1); *y = CLAMP (*y, 0, window->screen->rect.height-1); - + meta_error_trap_push_with_return (display); meta_topic (META_DEBUG_WINDOW_OPS, @@ -8075,11 +8075,11 @@ warp_grab_pointer (MetaWindow *window, else meta_window_get_client_root_coords (window, &display->grab_anchor_window_pos); - + XWarpPointer (display->xdisplay, None, window->screen->xroot, - 0, 0, 0, 0, + 0, 0, 0, 0, *x, *y); if (meta_error_trap_pop_with_return (display, FALSE) != Success) @@ -8088,7 +8088,7 @@ warp_grab_pointer (MetaWindow *window, window->desc); return FALSE; } - + return TRUE; } @@ -8120,7 +8120,7 @@ meta_window_update_keyboard_resize (MetaWindow *window, gboolean update_cursor) { int x, y; - + warp_grab_pointer (window, window->display->grab_op, &x, &y); @@ -8143,7 +8143,7 @@ void meta_window_update_keyboard_move (MetaWindow *window) { int x, y; - + warp_grab_pointer (window, window->display->grab_op, &x, &y); @@ -8153,7 +8153,7 @@ void meta_window_update_layer (MetaWindow *window) { MetaGroup *group; - + meta_stack_freeze (window->screen->stack); group = meta_window_get_group (window); if (group) @@ -8242,8 +8242,8 @@ meta_window_stack_just_below (MetaWindow *window, { meta_topic (META_DEBUG_STACK, "Setting stack position of window %s to %d (making it below window %s).\n", - window->desc, - below_this_one->stack_position, + window->desc, + below_this_one->stack_position, below_this_one->desc); meta_window_set_stack_position (window, below_this_one->stack_position); } @@ -8303,7 +8303,7 @@ meta_window_set_demands_attention (MetaWindow *window) GList *stack = window->screen->stack->sorted; MetaWindow *other_window; gboolean obscured = FALSE; - + MetaWorkspace *workspace = window->screen->active_workspace; if (workspace!=window->workspace) { @@ -8319,12 +8319,12 @@ meta_window_set_demands_attention (MetaWindow *window) meta_window_get_outer_rect (window, &candidate_rect); /* The stack is sorted with the top windows first. */ - + while (stack != NULL && stack->data != window) { other_window = stack->data; stack = stack->next; - + if (other_window->on_all_workspaces || window->on_all_workspaces || other_window->workspace == window->workspace) @@ -8365,7 +8365,7 @@ meta_window_unset_demands_attention (MetaWindow *window) { meta_topic (META_DEBUG_WINDOW_OPS, "Marking %s as not needing attention\n", window->desc); - + window->wm_state_demands_attention = FALSE; set_net_wm_state (window); } diff --git a/src/core/workspace.c b/src/core/workspace.c index e03a7e73..9b342154 100644 --- a/src/core/workspace.c +++ b/src/core/workspace.c @@ -2,11 +2,11 @@ /* Metacity Workspaces */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2003 Rob Adams * Copyright (C) 2004, 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -80,7 +80,7 @@ meta_workspace_new (MetaScreen *screen) workspace->all_struts = NULL; workspace->showing_desktop = FALSE; - + return workspace; } @@ -101,7 +101,7 @@ workspace_free_struts (MetaWorkspace *workspace) { if (workspace->all_struts == NULL) return; - + g_slist_foreach (workspace->all_struts, free_this, NULL); g_slist_free (workspace->all_struts); workspace->all_struts = NULL; @@ -119,7 +119,7 @@ meta_workspace_free (MetaWorkspace *workspace) /* Here we assume all the windows are already on another workspace * as well, so they won't be "orphaned" */ - + tmp = workspace->windows; while (tmp != NULL) { @@ -137,10 +137,10 @@ meta_workspace_free (MetaWorkspace *workspace) g_assert (workspace->windows == NULL); screen = workspace->screen; - + workspace->screen->workspaces = g_list_remove (workspace->screen->workspaces, workspace); - + g_free (workspace->work_area_xinerama); g_list_free (workspace->mru_list); @@ -176,11 +176,11 @@ meta_workspace_add_window (MetaWorkspace *workspace, MetaWindow *window) { g_return_if_fail (window->workspace == NULL); - + /* If the window is on all workspaces, we want to add it to all mru * lists, otherwise just add it to this workspaces mru list */ - if (window->on_all_workspaces) + if (window->on_all_workspaces) { if (window->workspace == NULL) { @@ -205,7 +205,7 @@ meta_workspace_add_window (MetaWorkspace *workspace, window->workspace = workspace; meta_window_set_current_workspace_hint (window); - + if (window->struts) { meta_topic (META_DEBUG_WORKAREA, @@ -230,10 +230,10 @@ meta_workspace_remove_window (MetaWorkspace *workspace, window->workspace = NULL; /* If the window is on all workspaces, we don't want to remove it - * from the MRU list unless this causes it to be removed from all + * from the MRU list unless this causes it to be removed from all * workspaces */ - if (window->on_all_workspaces) + if (window->on_all_workspaces) { GList* tmp = window->screen->workspaces; while (tmp) @@ -251,7 +251,7 @@ meta_workspace_remove_window (MetaWorkspace *workspace, } meta_window_set_current_workspace_hint (window); - + if (window->struts) { meta_topic (META_DEBUG_WORKAREA, @@ -272,12 +272,12 @@ meta_workspace_relocate_windows (MetaWorkspace *workspace, { GList *tmp; GList *copy; - + g_return_if_fail (workspace != new_home); /* can't modify list we're iterating over */ copy = g_list_copy (workspace->windows); - + tmp = copy; while (tmp != NULL) { @@ -285,12 +285,12 @@ meta_workspace_relocate_windows (MetaWorkspace *workspace, meta_workspace_remove_window (workspace, window); meta_workspace_add_window (new_home, window); - + tmp = tmp->next; } g_list_free (copy); - + g_assert (workspace->windows == NULL); } @@ -375,10 +375,10 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace, { MetaWorkspace *old; MetaWindow *move_window; - + meta_verbose ("Activating workspace %d\n", meta_workspace_index (workspace)); - + if (workspace->screen->active_workspace == workspace) return; @@ -387,7 +387,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace, /* Note that old can be NULL; e.g. when starting up */ old = workspace->screen->active_workspace; - + workspace->screen->active_workspace = workspace; set_active_space_hint (workspace->screen); @@ -406,7 +406,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace, if (workspace->screen->display->grab_op == META_GRAB_OP_MOVING || workspace->screen->display->grab_op == META_GRAB_OP_KEYBOARD_MOVING) move_window = workspace->screen->display->grab_window; - + if (move_window != NULL) { if (move_window->on_all_workspaces) @@ -479,7 +479,7 @@ meta_workspace_list_windows (MetaWorkspace *workspace) GSList *display_windows; GSList *tmp; GList *workspace_windows; - + display_windows = meta_display_list_windows (workspace->screen->display); workspace_windows = NULL; @@ -513,11 +513,11 @@ set_active_space_hint (MetaScreen *screen) */ if (screen->closing > 0) return; - + data[0] = meta_workspace_index (screen->active_workspace); meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]); - + meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, screen->display->atom__NET_CURRENT_DESKTOP, @@ -532,7 +532,7 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace) GList *tmp; GList *windows; int i; - + if (workspace->work_areas_invalid) { meta_topic (META_DEBUG_WORKAREA, @@ -547,7 +547,7 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace) g_free (workspace->work_area_xinerama); workspace->work_area_xinerama = NULL; - + workspace_free_struts (workspace); for (i = 0; i < workspace->screen->n_xinerama_infos; i++) @@ -560,7 +560,7 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace) workspace->screen_region = NULL; workspace->screen_edges = NULL; workspace->xinerama_edges = NULL; - + workspace->work_areas_invalid = TRUE; /* redo the size/position constraints on all windows */ @@ -571,7 +571,7 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace) MetaWindow *w = tmp->data; meta_window_queue (w, META_QUEUE_MOVE_RESIZE); - + tmp = tmp->next; } @@ -597,7 +597,7 @@ ensure_work_areas_validated (MetaWorkspace *workspace) g_assert (workspace->screen_edges == NULL); g_assert (workspace->xinerama_edges == NULL); - /* STEP 1: Get the list of struts */ + /* STEP 1: Get the list of struts */ windows = meta_workspace_list_windows (workspace); for (tmp = windows; tmp != NULL; tmp = tmp->next) { @@ -615,7 +615,7 @@ ensure_work_areas_validated (MetaWorkspace *workspace) /* STEP 2: Get the maximal/spanning rects for the onscreen and * on-single-xinerama regions - */ + */ g_assert (workspace->xinerama_region == NULL); g_assert (workspace->screen_region == NULL); @@ -687,7 +687,7 @@ ensure_work_areas_validated (MetaWorkspace *workspace) workspace->work_area_screen.x, workspace->work_area_screen.y, workspace->work_area_screen.width, - workspace->work_area_screen.height); + workspace->work_area_screen.height); /* Now find the work areas for each xinerama */ g_free (workspace->work_area_xinerama); @@ -722,7 +722,7 @@ ensure_work_areas_validated (MetaWorkspace *workspace) /* STEP 4: Make sure the screen_region is nonempty (separate from step 2 * since it relies on step 3). - */ + */ if (workspace->screen_region == NULL) { MetaRectangle *nonempty_region; @@ -757,7 +757,7 @@ meta_workspace_get_work_area_for_xinerama (MetaWorkspace *workspace, ensure_work_areas_validated (workspace); g_assert (which_xinerama < workspace->screen->n_xinerama_infos); - + *area = workspace->work_area_xinerama[which_xinerama]; } @@ -766,7 +766,7 @@ meta_workspace_get_work_area_all_xineramas (MetaWorkspace *workspace, MetaRectangle *area) { ensure_work_areas_validated (workspace); - + *area = workspace->work_area_screen; } @@ -811,7 +811,7 @@ MetaWorkspace* meta_workspace_get_neighbor (MetaWorkspace *workspace, MetaMotionDirection direction) { - MetaWorkspaceLayout layout; + MetaWorkspaceLayout layout; int i, current_space, num_workspaces; gboolean ltr; @@ -822,10 +822,10 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, meta_verbose ("Getting neighbor of %d in direction %s\n", current_space, meta_motion_direction_to_string (direction)); - + ltr = meta_ui_get_direction() == META_UI_DIRECTION_LTR; - switch (direction) + switch (direction) { case META_MOTION_LEFT: layout.current_col -= ltr ? 1 : -1; @@ -858,12 +858,12 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, if (i >= num_workspaces) meta_bug ("calc_workspace_layout left an invalid (too-high) workspace number %d in the grid\n", i); - + meta_verbose ("Neighbor workspace is %d at row %d col %d\n", i, layout.current_row, layout.current_col); meta_screen_free_workspace_layout (&layout); - + return meta_screen_get_workspace_by_index (workspace->screen, i); } @@ -917,7 +917,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace, } if (workspace->screen->display->autoraise_window != window && - meta_prefs_get_auto_raise ()) + meta_prefs_get_auto_raise ()) { meta_display_queue_autoraise_callback (workspace->screen->display, window); @@ -966,7 +966,7 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace, meta_topic (META_DEBUG_FOCUS, "Focusing MRU window\n"); - /* First, check to see if we need to focus an ancestor of a window */ + /* First, check to see if we need to focus an ancestor of a window */ if (not_this_one) { MetaWindow *ancestor; @@ -975,9 +975,9 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace, if (ancestor != NULL) { meta_topic (META_DEBUG_FOCUS, - "Focusing %s, ancestor of %s\n", + "Focusing %s, ancestor of %s\n", ancestor->desc, not_this_one->desc); - + meta_window_focus (ancestor, timestamp); /* Also raise the window if in click-to-focus */ @@ -989,7 +989,7 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace, } /* No ancestor, look for the MRU window */ - tmp = workspace->mru_list; + tmp = workspace->mru_list; while (tmp) { @@ -1023,7 +1023,7 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace, { meta_topic (META_DEBUG_FOCUS, "Focusing workspace MRU window %s\n", window->desc); - + meta_window_focus (window, timestamp); /* Also raise the window if in click-to-focus */ diff --git a/src/core/workspace.h b/src/core/workspace.h index d84ef94b..6e426cd8 100644 --- a/src/core/workspace.h +++ b/src/core/workspace.h @@ -10,10 +10,10 @@ * are unmapped. */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2004, 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -23,7 +23,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -47,7 +47,7 @@ typedef enum struct _MetaWorkspace { MetaScreen *screen; - + GList *windows; GList *mru_list; diff --git a/src/core/xprops.c b/src/core/xprops.c index f8bcd8e1..14613773 100644 --- a/src/core/xprops.c +++ b/src/core/xprops.c @@ -2,7 +2,7 @@ /* Metacity X property convenience routines */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat Inc. * @@ -10,7 +10,7 @@ * Copyright 1987, 1988, 1998 The Open Group * Copyright 1988 by Wyse Technology, Inc., San Jose, Ca, * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, - * + * * 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; either version 2 of the @@ -20,7 +20,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -31,20 +31,20 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL OR WYSE BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +software without specific, written prior permission. + +DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL DIGITAL OR WYSE BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ @@ -114,12 +114,12 @@ validate_or_free_results (GetPropertyResults *results, const char *res_class; const char *res_name; MetaWindow *w; - + if (expected_format == results->format && expected_type == results->type && (!must_have_items || results->n_items > 0)) - return TRUE; - + return TRUE; + meta_error_trap_push (results->display); type_name = XGetAtomName (results->display->xdisplay, results->type); expected_name = XGetAtomName (results->display->xdisplay, expected_type); @@ -140,7 +140,7 @@ validate_or_free_results (GetPropertyResults *results, res_class = NULL; res_name = NULL; } - + if (title == NULL) title = "unknown"; @@ -149,7 +149,7 @@ validate_or_free_results (GetPropertyResults *results, if (res_name == NULL) res_name = "unknown"; - + meta_warning (_("Window 0x%lx has property %s\nthat was expected to have type %s format %d\nand actually has type %s format %d n_items %d.\nThis is most likely an application bug, not a window manager bug.\nThe window has title=\"%s\" class=\"%s\" name=\"%s\"\n"), results->xwindow, prop_name ? prop_name : "(bad atom)", @@ -171,7 +171,7 @@ validate_or_free_results (GetPropertyResults *results, XFree (results->prop); results->prop = NULL; } - + return FALSE; } @@ -190,7 +190,7 @@ get_property (MetaDisplay *display, results->type = None; results->bytes_after = 0; results->format = 0; - + meta_error_trap_push_with_return (display); if (XGetWindowProperty (display->xdisplay, xwindow, xatom, 0, G_MAXLONG, @@ -222,12 +222,12 @@ atom_list_from_results (GetPropertyResults *results, int *n_atoms_p) { if (!validate_or_free_results (results, 32, XA_ATOM, FALSE)) - return FALSE; + return FALSE; *atoms_p = (Atom*) results->prop; *n_atoms_p = results->n_items; - results->prop = NULL; - + results->prop = NULL; + return TRUE; } @@ -256,12 +256,12 @@ cardinal_list_from_results (GetPropertyResults *results, int *n_cardinals_p) { if (!validate_or_free_results (results, 32, XA_CARDINAL, FALSE)) - return FALSE; + return FALSE; *cardinals_p = (gulong*) results->prop; *n_cardinals_p = results->n_items; results->prop = NULL; - + return TRUE; } @@ -290,8 +290,8 @@ motif_hints_from_results (GetPropertyResults *results, { int real_size, max_size; #define MAX_ITEMS sizeof (MotifWmHints)/sizeof (gulong) - - *hints_p = NULL; + + *hints_p = NULL; if (results->type == None || results->n_items <= 0) { @@ -327,7 +327,7 @@ motif_hints_from_results (GetPropertyResults *results, XFree (results->prop); results->prop = NULL; } - + return TRUE; } @@ -338,7 +338,7 @@ meta_prop_get_motif_hints (MetaDisplay *display, MotifWmHints **hints_p) { GetPropertyResults results; - + *hints_p = NULL; if (!get_property (display, xwindow, xatom, AnyPropertyType, @@ -353,13 +353,13 @@ latin1_string_from_results (GetPropertyResults *results, char **str_p) { *str_p = NULL; - + if (!validate_or_free_results (results, 8, XA_STRING, FALSE)) return FALSE; *str_p = (char*) results->prop; results->prop = NULL; - + return TRUE; } @@ -376,7 +376,7 @@ meta_prop_get_latin1_string (MetaDisplay *display, if (!get_property (display, xwindow, xatom, XA_STRING, &results)) return FALSE; - + return latin1_string_from_results (&results, str_p); } @@ -385,7 +385,7 @@ utf8_string_from_results (GetPropertyResults *results, char **str_p) { *str_p = NULL; - + if (!validate_or_free_results (results, 8, results->display->atom_UTF8_STRING, FALSE)) return FALSE; @@ -401,13 +401,13 @@ utf8_string_from_results (GetPropertyResults *results, meta_XFree (name); XFree (results->prop); results->prop = NULL; - + return FALSE; } - + *str_p = (char*) results->prop; results->prop = NULL; - + return TRUE; } @@ -439,14 +439,14 @@ utf8_list_from_results (GetPropertyResults *results, int n_strings; char **retval; const char *p; - + *str_p = NULL; *n_str_p = 0; if (!validate_or_free_results (results, 8, results->display->atom_UTF8_STRING, FALSE)) return FALSE; - + /* I'm not sure this is right, but I'm guessing the * property is nul-separated */ @@ -461,11 +461,11 @@ utf8_list_from_results (GetPropertyResults *results, if (results->prop[results->n_items - 1] != '\0') ++n_strings; - + /* we're guaranteed that results->prop has a nul on the end * by XGetWindowProperty */ - + retval = g_new0 (char*, n_strings + 1); p = (char *)results->prop; @@ -484,17 +484,17 @@ utf8_list_from_results (GetPropertyResults *results, meta_XFree (name); meta_XFree (results->prop); results->prop = NULL; - + g_strfreev (retval); return FALSE; } retval[i] = g_strdup (p); - + p = p + strlen (p) + 1; ++i; } - + *str_p = retval; *n_str_p = i; @@ -531,9 +531,9 @@ meta_prop_set_utf8_string_hint (MetaDisplay *display, const char *val) { meta_error_trap_push (display); - XChangeProperty (display->xdisplay, + XChangeProperty (display->xdisplay, xwindow, atom, - display->atom_UTF8_STRING, + display->atom_UTF8_STRING, 8, PropModeReplace, (guchar*) val, strlen (val)); meta_error_trap_pop (display, FALSE); } @@ -543,12 +543,12 @@ window_from_results (GetPropertyResults *results, Window *window_p) { if (!validate_or_free_results (results, 32, XA_WINDOW, TRUE)) - return FALSE; + return FALSE; *window_p = *(Window*) results->prop; XFree (results->prop); - results->prop = NULL; - + results->prop = NULL; + return TRUE; } @@ -560,12 +560,12 @@ counter_from_results (GetPropertyResults *results, if (!validate_or_free_results (results, 32, XA_CARDINAL, TRUE)) - return FALSE; + return FALSE; *counter_p = *(XSyncCounter*) results->prop; XFree (results->prop); results->prop = NULL; - + return TRUE; } #endif @@ -579,7 +579,7 @@ meta_prop_get_window (MetaDisplay *display, GetPropertyResults results; *window_p = None; - + if (!get_property (display, xwindow, xatom, XA_WINDOW, &results)) return FALSE; @@ -603,12 +603,12 @@ cardinal_with_atom_type_from_results (GetPropertyResults *results, gulong *cardinal_p) { if (!validate_or_free_results (results, 32, prop_type, TRUE)) - return FALSE; + return FALSE; *cardinal_p = *(gulong*) results->prop; XFree (results->prop); - results->prop = NULL; - + results->prop = NULL; + return TRUE; } @@ -637,19 +637,19 @@ text_property_from_results (GetPropertyResults *results, XTextProperty tp; *utf8_str_p = NULL; - + tp.value = results->prop; results->prop = NULL; tp.encoding = results->type; tp.format = results->format; - tp.nitems = results->n_items; - + tp.nitems = results->n_items; + *utf8_str_p = meta_text_property_to_utf8 (results->display->xdisplay, &tp); - + if (tp.value != NULL) XFree (tp.value); - + return *utf8_str_p != NULL; } @@ -660,7 +660,7 @@ meta_prop_get_text_property (MetaDisplay *display, char **utf8_str_p) { GetPropertyResults results; - + if (!get_property (display, xwindow, xatom, AnyPropertyType, &results)) return FALSE; @@ -699,13 +699,13 @@ wm_hints_from_results (GetPropertyResults *results, { XWMHints *hints; xPropWMHints *raw; - + *hints_p = NULL; - + if (!validate_or_free_results (results, 32, XA_WM_HINTS, TRUE)) - return FALSE; + return FALSE; - /* pre-R3 bogusly truncated window_group, don't fail on them */ + /* pre-R3 bogusly truncated window_group, don't fail on them */ if (results->n_items < (NumPropWMHintsElements - 1)) { meta_verbose ("WM_HINTS property too short: %d should be %d\n", @@ -717,11 +717,11 @@ wm_hints_from_results (GetPropertyResults *results, } return FALSE; } - + hints = ag_Xmalloc0 (sizeof (XWMHints)); raw = (xPropWMHints*) results->prop; - + hints->flags = raw->flags; hints->input = (raw->input ? True : False); hints->initial_state = cvtINT32toInt (raw->initialState); @@ -755,7 +755,7 @@ meta_prop_get_wm_hints (MetaDisplay *display, GetPropertyResults results; *hints_p = NULL; - + if (!get_property (display, xwindow, xatom, XA_WM_HINTS, &results)) return FALSE; @@ -768,13 +768,13 @@ class_hint_from_results (GetPropertyResults *results, XClassHint *class_hint) { int len_name, len_class; - + class_hint->res_class = NULL; class_hint->res_name = NULL; - + if (!validate_or_free_results (results, 8, XA_STRING, FALSE)) return FALSE; - + len_name = strlen ((char *) results->prop); if (! (class_hint->res_name = ag_Xmalloc (len_name+1))) { @@ -782,14 +782,14 @@ class_hint_from_results (GetPropertyResults *results, results->prop = NULL; return FALSE; } - + strcpy (class_hint->res_name, (char *)results->prop); if (len_name == (int) results->n_items) len_name--; - + len_class = strlen ((char *)results->prop + len_name + 1); - + if (! (class_hint->res_class = ag_Xmalloc(len_class+1))) { XFree(class_hint->res_name); @@ -798,12 +798,12 @@ class_hint_from_results (GetPropertyResults *results, results->prop = NULL; return FALSE; } - + strcpy (class_hint->res_class, (char *)results->prop + len_name + 1); XFree (results->prop); results->prop = NULL; - + return TRUE; } @@ -814,10 +814,10 @@ meta_prop_get_class_hint (MetaDisplay *display, XClassHint *class_hint) { GetPropertyResults results; - + class_hint->res_class = NULL; class_hint->res_name = NULL; - + if (!get_property (display, xwindow, xatom, XA_STRING, &results)) return FALSE; @@ -832,10 +832,10 @@ size_hints_from_results (GetPropertyResults *results, { xPropSizeHints *raw; XSizeHints *hints; - + *hints_p = NULL; *flags_p = 0; - + if (!validate_or_free_results (results, 32, XA_WM_SIZE_HINTS, FALSE)) return FALSE; @@ -845,7 +845,7 @@ size_hints_from_results (GetPropertyResults *results, raw = (xPropSizeHints*) results->prop; hints = ag_Xmalloc (sizeof (XSizeHints)); - + /* XSizeHints misdeclares these as int instead of long */ hints->flags = raw->flags; hints->x = cvtINT32toInt (raw->x); @@ -873,12 +873,12 @@ size_hints_from_results (GetPropertyResults *results, } hints->flags &= (*flags_p); /* get rid of unwanted bits */ - + XFree (results->prop); results->prop = NULL; *hints_p = hints; - + return TRUE; } @@ -893,7 +893,7 @@ meta_prop_get_size_hints (MetaDisplay *display, *hints_p = NULL; *flags_p = 0; - + if (!get_property (display, xwindow, xatom, XA_WM_SIZE_HINTS, &results)) return FALSE; @@ -918,7 +918,7 @@ latin1_to_utf8 (const char *text) { GString *str; const char *p; - + str = g_string_new (""); p = text; @@ -942,10 +942,10 @@ meta_prop_get_values (MetaDisplay *display, meta_verbose ("Requesting %d properties of 0x%lx at once\n", n_values, xwindow); - + if (n_values == 0) return; - + tasks = g_new0 (AgGetPropertyTask*, n_values); /* Start up tasks. The "values" array can have values @@ -1007,22 +1007,22 @@ meta_prop_get_values (MetaDisplay *display, if (values[i].atom != None) tasks[i] = get_task (display, xwindow, values[i].atom, values[i].required_type); - + ++i; - } - + } + /* Get replies for all our tasks */ meta_topic (META_DEBUG_SYNC, "Syncing to get %d GetProperty replies in %s\n", n_values, G_STRFUNC); XSync (display->xdisplay, False); - + /* Collect results, should arrive in order requested */ i = 0; while (i < n_values) { AgGetPropertyTask *task; GetPropertyResults results; - + if (tasks[i] == NULL) { /* Probably values[i].type was None, or ag_task_create() @@ -1031,7 +1031,7 @@ meta_prop_get_values (MetaDisplay *display, values[i].type = META_PROP_VALUE_INVALID; goto next; } - + task = ag_get_next_completed_task (display->xdisplay); g_assert (task != NULL); g_assert (ag_task_have_reply (task)); @@ -1044,7 +1044,7 @@ meta_prop_get_values (MetaDisplay *display, results.type = None; results.bytes_after = 0; results.format = 0; - + if (ag_task_get_reply_and_free (task, &results.type, &results.format, &results.n_items, @@ -1177,7 +1177,7 @@ free_value (MetaPropValue *value) { switch (value->type) { - case META_PROP_VALUE_INVALID: + case META_PROP_VALUE_INVALID: break; case META_PROP_VALUE_UTF8: case META_PROP_VALUE_STRING: @@ -1186,10 +1186,10 @@ free_value (MetaPropValue *value) break; case META_PROP_VALUE_MOTIF_HINTS: meta_XFree (value->v.motif_hints); - break; + break; case META_PROP_VALUE_CARDINAL: break; - case META_PROP_VALUE_WINDOW: + case META_PROP_VALUE_WINDOW: break; case META_PROP_VALUE_ATOM_LIST: meta_XFree (value->v.atom_list.atoms); diff --git a/src/include/all-keybindings.h b/src/include/all-keybindings.h index c94ea221..3edbbfdf 100644 --- a/src/include/all-keybindings.h +++ b/src/include/all-keybindings.h @@ -1,8 +1,8 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2008 Thomas Thurman - * + * * 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; either version 2 of the @@ -12,7 +12,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/include/boxes.h b/src/include/boxes.h index 9efaa3da..61b9b61c 100644 --- a/src/include/boxes.h +++ b/src/include/boxes.h @@ -2,9 +2,9 @@ /* Simple box operations */ -/* +/* * Copyright (C) 2005, 2006 Elijah Newren - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -73,7 +73,7 @@ struct _MetaEdge * region_to_string: (RECT_LENGTH+strlen(separator_string)) * * g_list_length (region) * edge_to_string: EDGE_LENGTH - * edge_list_to_...: (EDGE_LENGTH+strlen(separator_string)) * + * edge_list_to_...: (EDGE_LENGTH+strlen(separator_string)) * * g_list_length (edge_list) */ #define RECT_LENGTH 27 @@ -251,7 +251,7 @@ void meta_rectangle_find_linepoint_closest_to_point (double x1, double y1, /* Return whether an edge overlaps or is adjacent to the rectangle in the * nonzero-width dimension of the edge. */ -gboolean meta_rectangle_edge_aligns (const MetaRectangle *rect, +gboolean meta_rectangle_edge_aligns (const MetaRectangle *rect, const MetaEdge *edge); /* Compare two edges, so that sorting functions can put a list of edges in diff --git a/src/include/common.h b/src/include/common.h index 3764e627..78de84a4 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -5,10 +5,10 @@ * PLEASE KEEP IN SYNC WITH GSETTINGS SCHEMAS! */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -18,7 +18,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -126,12 +126,12 @@ typedef enum META_GRAB_OP_KEYBOARD_ESCAPING_DOCK, META_GRAB_OP_KEYBOARD_ESCAPING_GROUP, - + /* Alt+F6 */ META_GRAB_OP_KEYBOARD_TABBING_GROUP, - + META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING, - + /* Frame button ops */ META_GRAB_OP_CLICKING_MINIMIZE, META_GRAB_OP_CLICKING_MAXIMIZE, @@ -181,7 +181,7 @@ typedef enum */ META_VIRTUAL_SHIFT_MASK = 1 << 5, META_VIRTUAL_CONTROL_MASK = 1 << 6, - META_VIRTUAL_ALT_MASK = 1 << 7, + META_VIRTUAL_ALT_MASK = 1 << 7, META_VIRTUAL_META_MASK = 1 << 8, META_VIRTUAL_SUPER_MASK = 1 << 9, META_VIRTUAL_HYPER_MASK = 1 << 10, diff --git a/src/include/core.h b/src/include/core.h index ef20ee28..b2b3d08e 100644 --- a/src/include/core.h +++ b/src/include/core.h @@ -2,10 +2,10 @@ /* Metacity interface used by GTK+ UI to talk to core */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/include/errors.h b/src/include/errors.h index de1d5700..2c82058d 100644 --- a/src/include/errors.h +++ b/src/include/errors.h @@ -2,9 +2,9 @@ /* Metacity X error handling */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -35,7 +35,7 @@ void meta_errors_init (void); void meta_errors_register_foreign_display (Display *foreign_dpy, ErrorHandler handler, gpointer data); - + void meta_error_trap_push (MetaDisplay *display); void meta_error_trap_pop (MetaDisplay *display, gboolean last_request_was_roundtrip); diff --git a/src/include/main.h b/src/include/main.h index 8b1a3308..d6bf96c5 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -2,9 +2,9 @@ /* Metacity main */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/include/prefs.h b/src/include/prefs.h index 4125371d..621ad5b8 100644 --- a/src/include/prefs.h +++ b/src/include/prefs.h @@ -2,10 +2,10 @@ /* Metacity preferences */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2006 Elijah Newren - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/include/resizepopup.h b/src/include/resizepopup.h index df9154d8..d68c97c5 100644 --- a/src/include/resizepopup.h +++ b/src/include/resizepopup.h @@ -2,9 +2,9 @@ /* Metacity resizing-terminal-window feedback */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/include/tabpopup.h b/src/include/tabpopup.h index b226fdf5..aa5744cf 100644 --- a/src/include/tabpopup.h +++ b/src/include/tabpopup.h @@ -2,10 +2,10 @@ /* Metacity tab popup window */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -36,7 +36,7 @@ typedef void *MetaTabEntryKey; struct _MetaTabEntry { - MetaTabEntryKey key; + MetaTabEntryKey key; const char *title; GdkPixbuf *icon; MetaRectangle rect; diff --git a/src/include/ui.h b/src/include/ui.h index 3485d652..45e85cdd 100644 --- a/src/include/ui.h +++ b/src/include/ui.h @@ -2,9 +2,9 @@ /* Metacity interface for talking to GTK+ UI module */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/include/util.h b/src/include/util.h index 4828a54f..dbbc74c0 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -2,10 +2,10 @@ /* Metacity utilities */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/include/xprops.h b/src/include/xprops.h index f8421bb0..2128f864 100644 --- a/src/include/xprops.h +++ b/src/include/xprops.h @@ -2,9 +2,9 @@ /* Metacity X property convenience routines */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -164,7 +164,7 @@ typedef struct MetaPropValueType type; Atom atom; Atom required_type; /* autofilled if None */ - + union { char *str; @@ -176,13 +176,13 @@ typedef struct #ifdef HAVE_XSYNC XSyncCounter xcounter; #endif - + struct { XSizeHints *hints; unsigned long flags; } size_hints; - + struct { gulong *cardinals; @@ -200,7 +200,7 @@ typedef struct Atom *atoms; int n_atoms; } atom_list; - + } v; } MetaPropValue; diff --git a/src/tools/metacity-grayscale.c b/src/tools/metacity-grayscale.c index c7ec0be9..f1435daa 100644 --- a/src/tools/metacity-grayscale.c +++ b/src/tools/metacity-grayscale.c @@ -1,8 +1,8 @@ /* Hack for grayscaling an image */ -/* +/* * Copyright (C) 2002 Red Hat Inc. - * + * * 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; either version 2 of the @@ -12,7 +12,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -34,15 +34,15 @@ grayscale_pixbuf (GdkPixbuf *pixbuf) int row; int n_rows; int width; - + gray = gdk_pixbuf_copy (pixbuf); rowstride = gdk_pixbuf_get_rowstride (gray); pixstride = gdk_pixbuf_get_has_alpha (gray) ? 4 : 3; - + pixels = gdk_pixbuf_get_pixels (gray); n_rows = gdk_pixbuf_get_height (gray); width = gdk_pixbuf_get_width (gray); - + row = 0; while (row < n_rows) { @@ -56,13 +56,13 @@ grayscale_pixbuf (GdkPixbuf *pixbuf) p[0] = (guchar) v; p[1] = (guchar) v; p[2] = (guchar) v; - + p += pixstride; } - + ++row; } - + return gray; } @@ -72,7 +72,7 @@ main (int argc, char **argv) GdkPixbuf *pixbuf; GdkPixbuf *gray; GError *err; - + if (argc != 2) { g_printerr ("specify a single image on the command line\n"); @@ -89,7 +89,7 @@ main (int argc, char **argv) } gray = grayscale_pixbuf (pixbuf); - + err = NULL; gdk_pixbuf_save (gray, "grayscale.png", "png", &err, NULL); if (err != NULL) @@ -100,6 +100,6 @@ main (int argc, char **argv) } g_print ("wrote grayscale.png\n"); - + return 0; } diff --git a/src/tools/metacity-mag.c b/src/tools/metacity-mag.c index 14b6d4e8..a101a6db 100644 --- a/src/tools/metacity-mag.c +++ b/src/tools/metacity-mag.c @@ -1,8 +1,8 @@ /* Hack for use instead of xmag */ -/* +/* * Copyright (C) 2002 Red Hat Inc. - * + * * 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; either version 2 of the @@ -12,7 +12,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -49,7 +49,7 @@ get_pixbuf (void) g_print ("Size %d x %d\n", last_grab_width, last_grab_height); #endif - + screenshot = gdk_pixbuf_get_from_window (gdk_get_default_root_window (), last_grab_x, last_grab_y, last_grab_width, last_grab_height); @@ -77,14 +77,14 @@ regrab_idle (GtkWidget *image) GtkAllocation allocation; gtk_widget_get_allocation (image, &allocation); - + if (allocation.width != last_grab_allocation.width || allocation.height != last_grab_allocation.height) { last_grab_width = rint (allocation.width / width_factor); last_grab_height = rint (allocation.height / height_factor); last_grab_allocation = allocation; - + magnified = get_pixbuf (); gtk_image_set_from_pixbuf (GTK_IMAGE (image), magnified); @@ -93,7 +93,7 @@ regrab_idle (GtkWidget *image) } regrab_idle_id = 0; - + return FALSE; } @@ -113,7 +113,7 @@ grab_area_at_mouse (GtkWidget *invisible, GdkPixbuf *magnified; int width, height; GtkWidget *widget; - + width = last_grab_width; height = last_grab_height; @@ -121,9 +121,9 @@ grab_area_at_mouse (GtkWidget *invisible, last_grab_y = y_root; last_grab_width = width; last_grab_height = height; - + magnified = get_pixbuf (); - + display_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (display_window), last_grab_width, last_grab_height); @@ -139,7 +139,7 @@ grab_area_at_mouse (GtkWidget *invisible, G_CALLBACK (gtk_main_quit), NULL); g_signal_connect_after (G_OBJECT (widget), "size_allocate", G_CALLBACK (image_resized), NULL); - + gtk_widget_show_all (display_window); } @@ -159,7 +159,7 @@ mouse_motion (GtkWidget *invisible, GdkEventMotion *event, gpointer data) { - + } static gboolean @@ -173,7 +173,7 @@ mouse_release (GtkWidget *invisible, grab_area_at_mouse (invisible, event->x_root, event->y_root); shutdown_grab (); - + g_signal_handlers_disconnect_by_func (invisible, mouse_motion, NULL); g_signal_handlers_disconnect_by_func (invisible, mouse_release, NULL); @@ -190,14 +190,14 @@ static gboolean key_press (GtkWidget *invisible, GdkEventKey *event, gpointer data) -{ +{ if (event->keyval == GDK_KEY_Escape) { shutdown_grab (); g_signal_handlers_disconnect_by_func (invisible, mouse_press, NULL); g_signal_handlers_disconnect_by_func (invisible, key_press, NULL); - + return TRUE; } @@ -208,7 +208,7 @@ static gboolean mouse_press (GtkWidget *invisible, GdkEventButton *event, gpointer data) -{ +{ if (event->type == GDK_BUTTON_PRESS && event->button == 1) { @@ -237,7 +237,7 @@ begin_area_grab (void) gtk_widget_add_events (grab_widget, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK); - + gtk_widget_show (grab_widget); } @@ -271,7 +271,7 @@ begin_area_grab (void) } gtk_grab_add (grab_widget); - + g_signal_connect (grab_widget, "button_press_event", G_CALLBACK (mouse_press), NULL); g_signal_connect (grab_widget, "key_press_event", @@ -284,8 +284,8 @@ main (int argc, char **argv) gtk_init (&argc, &argv); begin_area_grab (); - + gtk_main (); - + return 0; } diff --git a/src/tools/metacity-message.c b/src/tools/metacity-message.c index 7d110a68..8c8660aa 100644 --- a/src/tools/metacity-message.c +++ b/src/tools/metacity-message.c @@ -182,7 +182,7 @@ int main (int argc, char **argv) { bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - + gtk_init (&argc, &argv); if (argc < 2) @@ -205,13 +205,13 @@ main (int argc, char **argv) #ifndef WITH_VERBOSE_MODE g_printerr (_("Metacity was compiled without support for verbose mode\n")); return 1; -#else +#else send_toggle_verbose (); #endif } else usage (); - + return 0; } diff --git a/src/tools/metacity-window-demo.c b/src/tools/metacity-window-demo.c index 97c18603..940e2302 100644 --- a/src/tools/metacity-window-demo.c +++ b/src/tools/metacity-window-demo.c @@ -1,8 +1,8 @@ /* Metacity window types/properties demo app */ -/* +/* * Copyright (C) 2002 Havoc Pennington - * + * * 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; either version 2 of the @@ -12,7 +12,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -37,7 +37,7 @@ set_gdk_window_struts (GdkWindow *window, int bottom) { long vals[12]; - + vals[0] = left; vals[1] = right; vals[2] = top; @@ -77,7 +77,7 @@ on_realize_set_struts (GtkWindow *window, right = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-right")); top = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-top")); bottom = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-bottom")); - + set_gdk_window_struts (gtk_widget_get_window (widget), left, right, top, bottom); } @@ -101,11 +101,11 @@ set_gtk_window_struts (GtkWidget *window, GINT_TO_POINTER (top)); g_object_set_data (G_OBJECT (window), "meta-strut-bottom", GINT_TO_POINTER (bottom)); - + g_signal_handlers_disconnect_by_func (G_OBJECT (window), on_realize_set_struts, NULL); - + g_signal_connect_after (G_OBJECT (window), "realize", G_CALLBACK (on_realize_set_struts), @@ -121,15 +121,15 @@ set_gdk_window_type (GdkWindow *window, const char *type) { Atom atoms[2] = { None, None }; - + atoms[0] = XInternAtom (GDK_WINDOW_XDISPLAY (window), type, False); - + XChangeProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), XInternAtom (GDK_WINDOW_XDISPLAY (window), "_NET_WM_WINDOW_TYPE", False), XA_ATOM, 32, PropModeReplace, - (guchar *)atoms, + (guchar *)atoms, 1); } @@ -147,7 +147,7 @@ on_realize_set_type (GtkWindow *window, type = g_object_get_data (G_OBJECT (window), "meta-window-type"); g_return_if_fail (type != NULL); - + set_gdk_window_type (gtk_widget_get_window (widget), type); } @@ -165,7 +165,7 @@ set_gtk_window_type (GtkWindow *window, g_signal_handlers_disconnect_by_func (G_OBJECT (window), on_realize_set_type, NULL); - + g_signal_connect_after (G_OBJECT (window), "realize", G_CALLBACK (on_realize_set_type), @@ -191,7 +191,7 @@ on_realize_set_border_only (GtkWindow *window, widget = GTK_WIDGET (window); g_return_if_fail (gtk_widget_get_realized (widget)); - + set_gdk_window_border_only (gtk_widget_get_window (widget)); } @@ -205,7 +205,7 @@ set_gtk_window_border_only (GtkWindow *window) g_signal_handlers_disconnect_by_func (G_OBJECT (window), on_realize_set_border_only, NULL); - + g_signal_connect_after (G_OBJECT (window), "realize", G_CALLBACK (on_realize_set_border_only), @@ -221,7 +221,7 @@ main (int argc, char **argv) GList *list; GdkPixbuf *pixbuf; GError *err; - + gtk_init (&argc, &argv); err = NULL; @@ -230,7 +230,7 @@ main (int argc, char **argv) if (pixbuf) { list = g_list_prepend (NULL, pixbuf); - + gtk_window_set_default_icon_list (list); g_list_free (list); g_object_unref (G_OBJECT (pixbuf)); @@ -240,11 +240,11 @@ main (int argc, char **argv) g_printerr ("Could not load icon: %s\n", err->message); g_error_free (err); } - + do_appwindow (NULL, NULL, NULL); gtk_main (); - + return 0; } @@ -259,7 +259,7 @@ make_dialog (GtkWidget *parent, { GtkWidget *dialog; char *str; - + dialog = gtk_message_dialog_new (parent ? GTK_WINDOW (parent) : NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, @@ -271,11 +271,11 @@ make_dialog (GtkWidget *parent, str = g_strdup_printf ("%d dialog", depth); gtk_window_set_title (GTK_WINDOW (dialog), str); g_free (str); - + gtk_dialog_add_button (GTK_DIALOG (dialog), "Open child dialog", GTK_RESPONSE_ACCEPT); - + /* Close dialog on user response */ g_signal_connect (G_OBJECT (dialog), "response", @@ -284,7 +284,7 @@ make_dialog (GtkWidget *parent, g_object_set_data (G_OBJECT (dialog), "depth", GINT_TO_POINTER (depth)); - + gtk_widget_show (dialog); } @@ -321,7 +321,7 @@ modal_dialog_cb (GSimpleAction *action, gpointer callback_data) { GtkWidget *dialog; - + dialog = gtk_message_dialog_new (GTK_WINDOW (callback_data), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, @@ -329,7 +329,7 @@ modal_dialog_cb (GSimpleAction *action, "Here is a MODAL dialog"); set_gtk_window_type (GTK_WINDOW (dialog), "_NET_WM_WINDOW_TYPE_MODAL_DIALOG"); - + gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -351,13 +351,13 @@ utility_cb (GSimpleAction *action, GtkWidget *window; GtkWidget *vbox; GtkWidget *button; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_UTILITY"); gtk_window_set_title (GTK_WINDOW (window), "Utility"); - + gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data)); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), vbox); @@ -373,7 +373,7 @@ utility_cb (GSimpleAction *action, button = gtk_button_new_with_mnemonic ("_D button"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - + gtk_widget_show_all (window); } @@ -385,20 +385,20 @@ toolbar_cb (GSimpleAction *action, GtkWidget *window; GtkWidget *vbox; GtkWidget *label; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_TOOLBAR"); gtk_window_set_title (GTK_WINDOW (window), "Toolbar"); - + gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data)); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), vbox); label = gtk_label_new ("FIXME this needs a resize grip, etc."); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - + gtk_widget_show_all (window); } @@ -410,20 +410,20 @@ menu_cb (GSimpleAction *action, GtkWidget *window; GtkWidget *vbox; GtkWidget *label; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_MENU"); gtk_window_set_title (GTK_WINDOW (window), "Menu"); - + gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data)); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), vbox); label = gtk_label_new ("FIXME this isn't a menu."); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - + gtk_widget_show_all (window); } @@ -435,17 +435,17 @@ override_redirect_cb (GSimpleAction *action, GtkWidget *window; GtkWidget *vbox; GtkWidget *label; - + window = gtk_window_new (GTK_WINDOW_POPUP); gtk_window_set_title (GTK_WINDOW (window), "Override Redirect"); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), vbox); label = gtk_label_new ("This is an override\nredirect window\nand should not be managed"); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - + gtk_widget_show_all (window); } @@ -457,20 +457,20 @@ border_only_cb (GSimpleAction *action, GtkWidget *window; GtkWidget *vbox; GtkWidget *label; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); set_gtk_window_border_only (GTK_WINDOW (window)); gtk_window_set_title (GTK_WINDOW (window), "Border only"); - + gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data)); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), vbox); label = gtk_label_new ("This window is supposed to have a border but no titlebar."); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - + gtk_widget_show_all (window); } @@ -499,7 +499,7 @@ focus_out_event_cb (GtkWidget *window, widget = GTK_WIDGET (data); gtk_label_set_text (GTK_LABEL (widget), "Not focused"); - + return TRUE; } @@ -507,7 +507,7 @@ static GtkWidget* focus_label (GtkWidget *window) { GtkWidget *label; - + label = gtk_label_new ("Not focused"); g_signal_connect (G_OBJECT (window), "focus_in_event", @@ -515,7 +515,7 @@ focus_label (GtkWidget *window) g_signal_connect (G_OBJECT (window), "focus_out_event", G_CALLBACK (focus_out_event_cb), label); - + return label; } @@ -527,20 +527,20 @@ splashscreen_cb (GSimpleAction *action, GtkWidget *window; GtkWidget *image; GtkWidget *vbox; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_SPLASHSCREEN"); gtk_window_set_title (GTK_WINDOW (window), "Splashscreen"); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - + image = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), focus_label (window), FALSE, FALSE, 0); - + gtk_box_pack_start (GTK_BOX (vbox), focus_label (window), FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER (window), vbox); - + gtk_widget_show_all (window); } @@ -567,7 +567,7 @@ make_dock (int type) switch (type) { case DOCK_LEFT: - case DOCK_RIGHT: + case DOCK_RIGHT: box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); break; case DOCK_TOP: @@ -580,18 +580,18 @@ make_dock (int type) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DOCK"); - + image = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_DIALOG); - gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0); - - gtk_box_pack_start (GTK_BOX (box), focus_label (window), FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0); + + gtk_box_pack_start (GTK_BOX (box), focus_label (window), FALSE, FALSE, 0); button = gtk_button_new_with_label ("Close"); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (gtk_widget_destroy), window); - + gtk_container_add (GTK_CONTAINER (window), box); #define DOCK_SIZE 48 @@ -603,7 +603,7 @@ make_dock (int type) set_gtk_window_struts (window, DOCK_SIZE, 0, 0, 0); gtk_window_set_title (GTK_WINDOW (window), "LeftDock"); break; - case DOCK_RIGHT: + case DOCK_RIGHT: gtk_widget_set_size_request (window, DOCK_SIZE, 400); gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 200); set_gtk_window_struts (window, 0, DOCK_SIZE, 0, 0); @@ -624,7 +624,7 @@ make_dock (int type) case DOCK_ALL: break; } - + gtk_widget_show_all (window); } @@ -672,25 +672,25 @@ desktop_cb (GSimpleAction *action, GtkWidget *window; GtkWidget *label; GdkRGBA desktop_color; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DESKTOP"); gtk_window_set_title (GTK_WINDOW (window), "Desktop"); gtk_widget_set_size_request (window, gdk_screen_width (), gdk_screen_height ()); gtk_window_move (GTK_WINDOW (window), 0, 0); - + desktop_color.red = 0.32; desktop_color.green = 0.46; desktop_color.blue = 0.65; desktop_color.alpha = 1.0; gtk_widget_override_background_color (window, 0, &desktop_color); - + label = focus_label (window); - + gtk_container_add (GTK_CONTAINER (window), label); - + gtk_widget_show_all (window); } @@ -730,7 +730,7 @@ toggle_aspect_ratio (GSimpleAction *action, GTK_WIDGET (data), &geom, GDK_HINT_ASPECT); - + } static void @@ -751,7 +751,7 @@ clicked_toolbar_cb (GSimpleAction *action, gpointer data) { GtkWidget *dialog; - + dialog = gtk_message_dialog_new (GTK_WINDOW (data), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, @@ -763,7 +763,7 @@ clicked_toolbar_cb (GSimpleAction *action, "response", G_CALLBACK (gtk_widget_destroy), NULL); - + gtk_widget_show (dialog); } @@ -775,7 +775,7 @@ update_statusbar (GtkTextBuffer *buffer, gint row, col; gint count; GtkTextIter iter; - + gtk_statusbar_pop (statusbar, 0); /* clear any previous message, underflow is allowed */ count = gtk_text_buffer_get_char_count (buffer); @@ -973,15 +973,15 @@ do_appwindow (GSimpleAction *action, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Application Window"); - + g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL); - + grid = gtk_grid_new (); gtk_widget_set_vexpand (grid, TRUE); gtk_widget_set_hexpand (grid, TRUE); - + gtk_container_add (GTK_CONTAINER (window), grid); action_group = g_simple_action_group_new (); diff --git a/src/ui/draw-workspace.c b/src/ui/draw-workspace.c index 63e61773..3a0b65a3 100644 --- a/src/ui/draw-workspace.c +++ b/src/ui/draw-workspace.c @@ -6,9 +6,9 @@ * libwnck or metacity, since it's used in both of them */ -/* +/* * Copyright (C) 2002 Red Hat Inc. - * + * * 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; either version 2 of the @@ -18,7 +18,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -35,23 +35,23 @@ get_window_rect (const WnckWindowDisplayInfo *win, { double width_ratio, height_ratio; int x, y, width, height; - + width_ratio = (double) workspace_rect->width / (double) screen_width; height_ratio = (double) workspace_rect->height / (double) screen_height; - + x = win->x; y = win->y; width = win->width; height = win->height; - + x *= width_ratio; y *= height_ratio; width *= width_ratio; height *= height_ratio; - + x += workspace_rect->x; y += workspace_rect->y; - + if (width < 3) width = 3; if (height < 3) @@ -99,9 +99,9 @@ draw_window (GtkWidget *widget, icon = win->icon; icon_w = icon_h = 0; - + if (icon) - { + { icon_w = gdk_pixbuf_get_width (icon); icon_h = gdk_pixbuf_get_height (icon); @@ -117,7 +117,7 @@ draw_window (GtkWidget *widget, { icon_w = gdk_pixbuf_get_width (icon); icon_h = gdk_pixbuf_get_height (icon); - + /* Give up. */ if (icon_w > (winrect->width - 2) || icon_h > (winrect->height - 2)) @@ -130,7 +130,7 @@ draw_window (GtkWidget *widget, { icon_x = winrect->x + (winrect->width - icon_w) / 2; icon_y = winrect->y + (winrect->height - icon_h) / 2; - + cairo_save (cr); gdk_cairo_set_source_pixbuf (cr, icon, icon_x, icon_y); cairo_rectangle (cr, icon_x, icon_y, icon_w, icon_h); @@ -138,7 +138,7 @@ draw_window (GtkWidget *widget, cairo_paint (cr); cairo_restore (cr); } - + gtk_style_context_get_color (style, state, &color); gdk_cairo_set_source_rgba (cr, &color); cairo_set_line_width (cr, 1.0); @@ -146,7 +146,7 @@ draw_window (GtkWidget *widget, winrect->x + 0.5, winrect->y + 0.5, MAX (0, winrect->width - 1), MAX (0, winrect->height - 1)); cairo_stroke (cr); - + cairo_restore (cr); } @@ -176,7 +176,7 @@ wnck_draw_workspace (GtkWidget *widget, if (is_active) state = GTK_STATE_FLAG_SELECTED; - else if (workspace_background) + else if (workspace_background) state = GTK_STATE_FLAG_PRELIGHT; else state = GTK_STATE_FLAG_NORMAL; @@ -206,16 +206,16 @@ wnck_draw_workspace (GtkWidget *widget, { const WnckWindowDisplayInfo *win = &windows[i]; GdkRectangle winrect; - + get_window_rect (win, screen_width, screen_height, &workspace_rect, &winrect); - + draw_window (widget, cr, win, &winrect, state); - + ++i; } diff --git a/src/ui/draw-workspace.h b/src/ui/draw-workspace.h index 5c3a5359..48b74493 100644 --- a/src/ui/draw-workspace.h +++ b/src/ui/draw-workspace.h @@ -6,9 +6,9 @@ * libwnck or metacity, since it's used in both of them */ -/* +/* * Copyright (C) 2002 Red Hat Inc. - * + * * 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; either version 2 of the @@ -18,7 +18,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -40,7 +40,7 @@ typedef struct int height; guint is_active : 1; - + } WnckWindowDisplayInfo; void wnck_draw_workspace (GtkWidget *widget, diff --git a/src/ui/fixedtip.c b/src/ui/fixedtip.c index 5030a99a..1d2f5f09 100644 --- a/src/ui/fixedtip.c +++ b/src/ui/fixedtip.c @@ -2,9 +2,9 @@ /* Metacity fixed tooltip routine */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -71,9 +71,9 @@ meta_fixed_tip_show (int screen_number, const char *markup_text) { int w, h; - + if (tip == NULL) - { + { tip = gtk_window_new (GTK_WINDOW_POPUP); gtk_window_set_type_hint (GTK_WINDOW(tip), GDK_WINDOW_TYPE_HINT_TOOLTIP); @@ -91,7 +91,7 @@ meta_fixed_tip_show (int screen_number, screen_right_edge = monitor.x + monitor.width; screen_bottom_edge = monitor.y + monitor.height; } - + gtk_widget_set_app_paintable (tip, TRUE); gtk_window_set_resizable (GTK_WINDOW (tip), FALSE); gtk_widget_set_name (tip, "gtk-tooltips"); @@ -105,7 +105,7 @@ meta_fixed_tip_show (int screen_number, gtk_widget_set_halign (label, GTK_ALIGN_CENTER); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_widget_show (label); - + gtk_container_add (GTK_CONTAINER (tip), label); g_signal_connect (tip, "destroy", @@ -113,7 +113,7 @@ meta_fixed_tip_show (int screen_number, } gtk_label_set_markup (GTK_LABEL (label), markup_text); - + gtk_window_get_size (GTK_WINDOW (tip), &w, &h); if (meta_ui_get_direction() == META_UI_DIRECTION_RTL) @@ -121,7 +121,7 @@ meta_fixed_tip_show (int screen_number, if ((root_x + w) > screen_right_edge) root_x -= (root_x + w) - screen_right_edge; - + gtk_window_move (GTK_WINDOW (tip), root_x, root_y); gtk_widget_show (tip); diff --git a/src/ui/fixedtip.h b/src/ui/fixedtip.h index f0c39ef0..039387f7 100644 --- a/src/ui/fixedtip.h +++ b/src/ui/fixedtip.h @@ -1,8 +1,8 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -12,14 +12,14 @@ * 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, see <http://www.gnu.org/licenses/>. */ /** * \file fixedtip.h Metacity fixed tooltip routine - * + * * Sometimes we want to display a small floating rectangle with helpful * text near the pointer. For example, if the user holds the mouse over * the maximise button, we can display a tooltip saying "Maximize". diff --git a/src/ui/frames.c b/src/ui/frames.c index 9caa79a2..e78ee6eb 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -2,11 +2,11 @@ /* Metacity window frame manager widget */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2003 Red Hat, Inc. * Copyright (C) 2005, 2006 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -140,7 +140,7 @@ meta_frames_class_init (MetaFramesClass *class) widget_class->unmap = meta_frames_unmap; widget_class->draw = meta_frames_draw; - widget_class->destroy_event = meta_frames_destroy_event; + widget_class->destroy_event = meta_frames_destroy_event; widget_class->button_press_event = meta_frames_button_press_event; widget_class->button_release_event = meta_frames_button_release_event; widget_class->motion_notify_event = meta_frames_motion_notify_event; @@ -189,7 +189,7 @@ static void meta_frames_init (MetaFrames *frames) { frames->text_heights = g_hash_table_new (NULL, NULL); - + frames->frames = g_hash_table_new (unsigned_long_hash, unsigned_long_equal); frames->tooltip_timeout = 0; @@ -218,11 +218,11 @@ meta_frames_destroy (GtkWidget *widget) GSList *winlist; GSList *tmp; MetaFrames *frames; - + frames = META_FRAMES (widget); clear_tip (frames); - + winlist = NULL; g_hash_table_foreach (frames->frames, listify_func, &winlist); @@ -244,17 +244,17 @@ static void meta_frames_finalize (GObject *object) { MetaFrames *frames; - + frames = META_FRAMES (object); meta_prefs_remove_listener (prefs_changed_callback, frames); - + g_hash_table_destroy (frames->text_heights); invalidate_all_caches (frames); if (frames->invalidate_cache_timeout_id) g_source_remove (frames->invalidate_cache_timeout_id); - + g_assert (g_hash_table_size (frames->frames) == 0); g_hash_table_destroy (frames->frames); g_hash_table_destroy (frames->cache); @@ -281,7 +281,7 @@ get_cache (MetaFrames *frames, MetaUIFrame *frame) { CachedPixels *pixels; - + pixels = g_hash_table_lookup (frames->cache, frame); if (!pixels) @@ -299,11 +299,11 @@ invalidate_cache (MetaFrames *frames, { CachedPixels *pixels = get_cache (frames, frame); int i; - + for (i = 0; i < 4; i++) if (pixels->piece[i].pixmap) cairo_surface_destroy (pixels->piece[i].pixmap); - + g_free (pixels); g_hash_table_remove (frames->cache, frame); } @@ -319,7 +319,7 @@ invalidate_all_caches (MetaFrames *frames) invalidate_cache (frames, frame); } - + g_list_free (frames->invalidate_frames); frames->invalidate_frames = NULL; } @@ -328,7 +328,7 @@ static gboolean invalidate_cache_timeout (gpointer data) { MetaFrames *frames = data; - + invalidate_all_caches (frames); frames->invalidate_cache_timeout_id = 0; return FALSE; @@ -348,7 +348,7 @@ queue_recalc_func (gpointer key, gpointer value, gpointer data) * in case of color change. */ meta_frames_set_window_background (frames, frame); - + invalidate_whole_window (frames, frame); meta_core_queue_frame_resize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); @@ -356,7 +356,7 @@ queue_recalc_func (gpointer key, gpointer value, gpointer data) { /* save title to recreate layout */ g_free (frame->title); - + frame->title = g_strdup (pango_layout_get_text (frame->layout)); g_object_unref (G_OBJECT (frame->layout)); @@ -372,7 +372,7 @@ meta_frames_font_changed (MetaFrames *frames) g_hash_table_destroy (frames->text_heights); frames->text_heights = g_hash_table_new (NULL, NULL); } - + /* Queue a draw/resize on all frames */ g_hash_table_foreach (frames->frames, queue_recalc_func, frames); @@ -439,11 +439,11 @@ meta_frames_ensure_layout (MetaFrames *frames, MetaFrameFlags flags; MetaFrameType type; MetaFrameStyle *style; - + g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (frames))); widget = GTK_WIDGET (frames); - + meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_FRAME_FLAGS, &flags, META_CORE_GET_FRAME_TYPE, &type, @@ -458,7 +458,7 @@ meta_frames_ensure_layout (MetaFrames *frames, { /* save title to recreate layout */ g_free (frame->title); - + frame->title = g_strdup (pango_layout_get_text (frame->layout)); g_object_unref (G_OBJECT (frame->layout)); @@ -467,23 +467,23 @@ meta_frames_ensure_layout (MetaFrames *frames, } frame->cache_style = style; - + if (frame->layout == NULL) { gpointer key, value; PangoFontDescription *font_desc; double scale; int size; - + scale = meta_theme_get_title_scale (meta_theme_get_current (), type, flags); - + frame->layout = gtk_widget_create_pango_layout (widget, frame->title); pango_layout_set_ellipsize (frame->layout, PANGO_ELLIPSIZE_END); pango_layout_set_auto_dir (frame->layout, FALSE); - + font_desc = meta_gtk_widget_get_font_desc (widget, scale, meta_prefs_get_titlebar_font ()); @@ -505,10 +505,10 @@ meta_frames_ensure_layout (MetaFrames *frames, GINT_TO_POINTER (size), GINT_TO_POINTER (frame->text_height)); } - - pango_layout_set_font_description (frame->layout, + + pango_layout_set_font_description (frame->layout, font_desc); - + pango_font_description_free (font_desc); /* Save some RAM */ @@ -526,7 +526,7 @@ meta_frames_calc_geometry (MetaFrames *frames, MetaFrameFlags flags; MetaFrameType type; MetaButtonLayout button_layout; - + meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_CLIENT_WIDTH, &width, META_CORE_GET_CLIENT_HEIGHT, &height, @@ -537,7 +537,7 @@ meta_frames_calc_geometry (MetaFrames *frames, meta_frames_ensure_layout (frames, frame); meta_prefs_get_button_layout (&button_layout); - + meta_theme_calc_geometry (meta_theme_get_current (), type, frame->text_height, @@ -557,7 +557,7 @@ meta_frames_new (int screen_number) return g_object_new (META_TYPE_FRAMES, "screen", screen, - NULL); + NULL); } /* In order to use a style with a window it has to be attached to that @@ -586,7 +586,7 @@ meta_frames_manage_window (MetaFrames *frames, g_assert (window); frame = g_new (MetaUIFrame, 1); - + frame->window = window; gdk_window_set_user_data (frame->window, frames); @@ -595,7 +595,7 @@ meta_frames_manage_window (MetaFrames *frames, meta_frames_attach_style (frames, frame); /* Don't set event mask here, it's in frame.c */ - + frame->xwindow = xwindow; frame->cache_style = NULL; frame->layout = NULL; @@ -609,9 +609,9 @@ meta_frames_manage_window (MetaFrames *frames, * registered with its MetaWindow, which happens after this function * and meta_ui_create_frame_window() return to meta_window_ensure_frame(). */ - + meta_core_grab_buttons (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); - + g_hash_table_replace (frames->frames, &frame->xwindow, frame); } @@ -622,7 +622,7 @@ meta_frames_unmanage_window (MetaFrames *frames, MetaUIFrame *frame; clear_tip (frames); - + frame = g_hash_table_lookup (frames->frames, &xwindow); if (frame) @@ -631,7 +631,7 @@ meta_frames_unmanage_window (MetaFrames *frames, * is not actually referenced anymore */ invalidate_all_caches (frames); - + /* restore the cursor */ meta_core_set_screen_cursor (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, @@ -641,7 +641,7 @@ meta_frames_unmanage_window (MetaFrames *frames, if (frames->last_motion_frame == frame) frames->last_motion_frame = NULL; - + g_hash_table_remove (frames->frames, &frame->xwindow); g_object_unref (frame->style); @@ -653,7 +653,7 @@ meta_frames_unmanage_window (MetaFrames *frames, if (frame->title) g_free (frame->title); - + g_free (frame); } else @@ -691,12 +691,12 @@ meta_frames_get_borders (MetaFrames *frames, MetaFrameFlags flags; MetaUIFrame *frame; MetaFrameType type; - + frame = meta_frames_lookup_window (frames, xwindow); if (frame == NULL) meta_bug ("No such frame 0x%lx\n", xwindow); - + meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_FRAME_FLAGS, &flags, META_CORE_GET_FRAME_TYPE, &type, @@ -705,7 +705,7 @@ meta_frames_get_borders (MetaFrames *frames, g_return_if_fail (type < META_FRAME_TYPE_LAST); meta_frames_ensure_layout (frames, frame); - + /* We can't get the full geometry, because that depends on * the client window size and probably we're being called * by the core move/resize code to decide on the client @@ -723,7 +723,7 @@ meta_frames_reset_bg (MetaFrames *frames, Window xwindow) { MetaUIFrame *frame; - + frame = meta_frames_lookup_window (frames, xwindow); meta_frames_set_window_background (frames, frame); @@ -747,7 +747,7 @@ meta_frames_unflicker_bg (MetaFrames *frames, int target_height) { MetaUIFrame *frame; - + frame = meta_frames_lookup_window (frames, xwindow); g_return_if_fail (frame != NULL); @@ -757,7 +757,7 @@ meta_frames_unflicker_bg (MetaFrames *frames, -1); /* Oops, no way to get the background here */ - + meta_frames_paint_to_drawable (frames, frame, pixmap); #endif @@ -778,7 +778,7 @@ meta_frames_apply_shapes (MetaFrames *frames, XRectangle xrect; Region corners_xregion; Region window_xregion; - + frame = meta_frames_lookup_window (frames, xwindow); g_return_if_fail (frame != NULL); @@ -795,7 +795,7 @@ meta_frames_apply_shapes (MetaFrames *frames, meta_topic (META_DEBUG_SHAPES, "Unsetting shape mask on frame 0x%lx\n", frame->xwindow); - + XShapeCombineMask (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, ShapeBounding, 0, 0, None, ShapeSet); frame->shape_applied = FALSE; @@ -806,12 +806,12 @@ meta_frames_apply_shapes (MetaFrames *frames, "Frame 0x%lx still doesn't need a shape mask\n", frame->xwindow); } - + return; /* nothing to do */ } - + corners_xregion = XCreateRegion (); - + if (fgeom.top_left_corner_rounded_radius != 0) { const int corner = fgeom.top_left_corner_rounded_radius; @@ -825,7 +825,7 @@ meta_frames_apply_shapes (MetaFrames *frames, xrect.y = i; xrect.width = width; xrect.height = 1; - + XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); } } @@ -843,7 +843,7 @@ meta_frames_apply_shapes (MetaFrames *frames, xrect.y = i; xrect.width = width; xrect.height = 1; - + XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); } } @@ -861,7 +861,7 @@ meta_frames_apply_shapes (MetaFrames *frames, xrect.y = new_window_height - i - 1; xrect.width = width; xrect.height = 1; - + XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); } } @@ -879,13 +879,13 @@ meta_frames_apply_shapes (MetaFrames *frames, xrect.y = new_window_height - i - 1; xrect.width = width; xrect.height = 1; - + XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); } } - + window_xregion = XCreateRegion (); - + xrect.x = 0; xrect.y = 0; xrect.width = new_window_width; @@ -896,7 +896,7 @@ meta_frames_apply_shapes (MetaFrames *frames, XSubtractRegion (window_xregion, corners_xregion, window_xregion); XDestroyRegion (corners_xregion); - + if (window_has_shape) { /* The client window is oclock or something and has a shape @@ -905,22 +905,22 @@ meta_frames_apply_shapes (MetaFrames *frames, * on that, then combine. Wasting the window is assumed cheaper * than a round trip, but who really knows for sure. */ - XSetWindowAttributes attrs; + XSetWindowAttributes attrs; Window shape_window; Window client_window; Region client_xregion; GdkScreen *screen; int screen_number; - + meta_topic (META_DEBUG_SHAPES, "Frame 0x%lx needs to incorporate client shape\n", frame->xwindow); screen = gtk_widget_get_screen (GTK_WIDGET (frames)); screen_number = gdk_x11_screen_get_screen_number (screen); - + attrs.override_redirect = True; - + shape_window = XCreateWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), RootWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen_number), -5000, -5000, @@ -949,21 +949,21 @@ meta_frames_apply_shapes (MetaFrames *frames, * then union it with the shape_window's existing shape */ client_xregion = XCreateRegion (); - + xrect.x = fgeom.left_width; xrect.y = fgeom.top_height; xrect.width = new_window_width - fgeom.right_width - xrect.x; xrect.height = new_window_height - fgeom.bottom_height - xrect.y; XUnionRectWithRegion (&xrect, client_xregion, client_xregion); - + XSubtractRegion (window_xregion, client_xregion, window_xregion); XDestroyRegion (client_xregion); - + XShapeCombineRegion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), shape_window, ShapeBounding, 0, 0, window_xregion, ShapeUnion); - + /* Now copy shape_window shape to the real frame */ XShapeCombineShape (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, ShapeBounding, 0, 0, @@ -980,13 +980,13 @@ meta_frames_apply_shapes (MetaFrames *frames, meta_topic (META_DEBUG_SHAPES, "Frame 0x%lx has shaped corners\n", frame->xwindow); - + XShapeCombineRegion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, ShapeBounding, 0, 0, window_xregion, ShapeSet); } - + frame->shape_applied = TRUE; - + XDestroyRegion (window_xregion); #endif /* HAVE_SHAPE */ } @@ -1016,7 +1016,7 @@ meta_frames_queue_draw (MetaFrames *frames, Window xwindow) { MetaUIFrame *frame; - + frame = meta_frames_lookup_window (frames, xwindow); invalidate_whole_window (frames, frame); @@ -1028,14 +1028,14 @@ meta_frames_set_title (MetaFrames *frames, const char *title) { MetaUIFrame *frame; - + frame = meta_frames_lookup_window (frames, xwindow); g_assert (frame); - + g_free (frame->title); frame->title = g_strdup (title); - + if (frame->layout) { g_object_unref (frame->layout); @@ -1050,7 +1050,7 @@ meta_frames_repaint_frame (MetaFrames *frames, Window xwindow) { MetaUIFrame *frame; - + frame = meta_frames_lookup_window (frames, xwindow); g_assert (frame); @@ -1070,7 +1070,7 @@ show_tip_now (MetaFrames *frames) Window root, child; guint mask; MetaFrameControl control; - + frame = frames->last_motion_frame; if (frame == NULL) return; @@ -1081,9 +1081,9 @@ show_tip_now (MetaFrames *frames) &root_x, &root_y, &x, &y, &mask); - + control = get_control (frames, frame, x, y); - + tiptext = NULL; switch (control) { @@ -1138,7 +1138,7 @@ show_tip_now (MetaFrames *frames) break; case META_FRAME_CONTROL_RESIZE_E: break; - case META_FRAME_CONTROL_NONE: + case META_FRAME_CONTROL_NONE: break; case META_FRAME_CONTROL_CLIENT_AREA: break; @@ -1150,9 +1150,9 @@ show_tip_now (MetaFrames *frames) GdkRectangle *rect; int dx, dy; int screen_number; - + meta_frames_calc_geometry (frames, frame, &fgeom); - + rect = control_rect (control, &fgeom); /* get conversion delta for root-to-frame coords */ @@ -1164,7 +1164,7 @@ show_tip_now (MetaFrames *frames) dx += rect->width; screen_number = gdk_screen_get_number (gtk_widget_get_screen (GTK_WIDGET (frames))); - + meta_fixed_tip_show (screen_number, rect->x + dx, rect->y + rect->height + 2 + dy, @@ -1191,10 +1191,10 @@ static void queue_tip (MetaFrames *frames) { clear_tip (frames); - + frames->tooltip_timeout = g_timeout_add (TIP_DELAY, tip_timeout_func, - frames); + frames); } static void @@ -1215,7 +1215,7 @@ redraw_control (MetaFrames *frames, { MetaFrameGeometry fgeom; GdkRectangle *rect; - + meta_frames_calc_geometry (frames, frame, &fgeom); rect = control_rect (control, &fgeom); @@ -1230,7 +1230,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, int action) { MetaFrameFlags flags; - + switch (action) { case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_SHADE: @@ -1238,7 +1238,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_FRAME_FLAGS, &flags, META_CORE_GET_END); - + if (flags & META_FRAME_ALLOWS_SHADE) { if (flags & META_FRAME_SHADED) @@ -1251,14 +1251,14 @@ meta_frame_titlebar_event (MetaUIFrame *frame, event->time); } } - break; - + break; + case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE: { meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_FRAME_FLAGS, &flags, META_CORE_GET_END); - + if (flags & META_FRAME_ALLOWS_MAXIMIZE) { meta_core_toggle_maximize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); @@ -1271,7 +1271,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_FRAME_FLAGS, &flags, META_CORE_GET_END); - + if (flags & META_FRAME_ALLOWS_MAXIMIZE) { meta_core_toggle_maximize_horizontally (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); @@ -1284,7 +1284,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_FRAME_FLAGS, &flags, META_CORE_GET_END); - + if (flags & META_FRAME_ALLOWS_MAXIMIZE) { meta_core_toggle_maximize_vertically (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); @@ -1297,7 +1297,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_FRAME_FLAGS, &flags, META_CORE_GET_END); - + if (flags & META_FRAME_ALLOWS_MINIMIZE) { meta_core_minimize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); @@ -1308,7 +1308,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, case G_DESKTOP_TITLEBAR_ACTION_NONE: /* Yaay, a sane user that doesn't use that other weird crap! */ break; - + case G_DESKTOP_TITLEBAR_ACTION_LOWER: meta_core_user_lower_and_unfocus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, @@ -1324,7 +1324,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, event->time); break; } - + return TRUE; } @@ -1333,7 +1333,7 @@ meta_frame_double_click_event (MetaUIFrame *frame, GdkEventButton *event) { int action = meta_prefs_get_action_double_click_titlebar (); - + return meta_frame_titlebar_event (frame, event, action); } @@ -1342,7 +1342,7 @@ meta_frame_middle_click_event (MetaUIFrame *frame, GdkEventButton *event) { int action = meta_prefs_get_action_middle_click_titlebar(); - + return meta_frame_titlebar_event (frame, event, action); } @@ -1351,7 +1351,7 @@ meta_frame_right_click_event(MetaUIFrame *frame, GdkEventButton *event) { int action = meta_prefs_get_action_right_click_titlebar(); - + return meta_frame_titlebar_event (frame, event, action); } @@ -1362,19 +1362,19 @@ meta_frames_button_press_event (GtkWidget *widget, MetaUIFrame *frame; MetaFrames *frames; MetaFrameControl control; - + frames = META_FRAMES (widget); /* Remember that the display may have already done something with this event. * If so there's probably a GrabOp in effect. */ - + frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); if (frame == NULL) return FALSE; clear_tip (frames); - + control = get_control (frames, frame, event->x, event->y); /* focus on click, even if click was on client area */ @@ -1388,13 +1388,13 @@ meta_frames_button_press_event (GtkWidget *widget, frame->xwindow); meta_core_user_focus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, - event->time); + event->time); } /* don't do the rest of this if on client area */ if (control == META_FRAME_CONTROL_CLIENT_AREA) return FALSE; /* not on the frame, just passed through from client */ - + /* We want to shade even if we have a GrabOp, since we'll have a move grab * if we double click the titlebar. */ @@ -1408,7 +1408,7 @@ meta_frames_button_press_event (GtkWidget *widget, if (meta_core_get_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())) != META_GRAB_OP_NONE) - return FALSE; /* already up to something */ + return FALSE; /* already up to something */ if (event->button == 1 && (control == META_FRAME_CONTROL_MAXIMIZE || @@ -1474,8 +1474,8 @@ meta_frames_button_press_event (GtkWidget *widget, 0, event->time, event->x_root, - event->y_root); - + event->y_root); + frame->prelit_control = control; redraw_control (frames, frame, control); @@ -1484,15 +1484,15 @@ meta_frames_button_press_event (GtkWidget *widget, MetaFrameGeometry fgeom; GdkRectangle *rect; int dx, dy; - + meta_frames_calc_geometry (frames, frame, &fgeom); - + rect = control_rect (META_FRAME_CONTROL_MENU, &fgeom); /* get delta to convert to root coords */ dx = event->x_root - event->x; dy = event->y_root - event->y; - + /* Align to the right end of the menu rectangle if RTL */ if (meta_ui_get_direction() == META_UI_DIRECTION_RTL) dx += rect->width; @@ -1516,9 +1516,9 @@ meta_frames_button_press_event (GtkWidget *widget, control == META_FRAME_CONTROL_RESIZE_W)) { MetaGrabOp op; - + op = META_GRAB_OP_NONE; - + switch (control) { case META_FRAME_CONTROL_RESIZE_SE: @@ -1571,7 +1571,7 @@ meta_frames_button_press_event (GtkWidget *widget, META_CORE_GET_END); if (flags & META_FRAME_ALLOWS_MOVE) - { + { meta_core_begin_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_GRAB_OP_MOVING, @@ -1592,7 +1592,7 @@ meta_frames_button_press_event (GtkWidget *widget, { return meta_frame_right_click_event (frame, event); } - + return TRUE; } @@ -1629,9 +1629,9 @@ meta_frames_button_release_event (GtkWidget *widget, MetaUIFrame *frame; MetaFrames *frames; MetaGrabOp op; - + frames = META_FRAMES (widget); - + frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); if (frame == NULL) return FALSE; @@ -1653,13 +1653,13 @@ meta_frames_button_release_event (GtkWidget *widget, MetaFrameControl control; control = get_control (frames, frame, event->x, event->y); - + switch (op) { case META_GRAB_OP_CLICKING_MINIMIZE: if (control == META_FRAME_CONTROL_MINIMIZE) meta_core_minimize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); - + meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; @@ -1669,7 +1669,7 @@ meta_frames_button_release_event (GtkWidget *widget, /* Focus the window on the maximize */ meta_core_user_focus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, - event->time); + event->time); meta_core_maximize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); } meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); @@ -1678,17 +1678,17 @@ meta_frames_button_release_event (GtkWidget *widget, case META_GRAB_OP_CLICKING_UNMAXIMIZE: if (control == META_FRAME_CONTROL_UNMAXIMIZE) meta_core_unmaximize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); - + meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; - + case META_GRAB_OP_CLICKING_DELETE: if (control == META_FRAME_CONTROL_DELETE) meta_core_delete (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, event->time); - + meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; - + case META_GRAB_OP_CLICKING_MENU: meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; @@ -1696,10 +1696,10 @@ meta_frames_button_release_event (GtkWidget *widget, case META_GRAB_OP_CLICKING_SHADE: if (control == META_FRAME_CONTROL_SHADE) meta_core_shade (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, event->time); - + meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; - + case META_GRAB_OP_CLICKING_UNSHADE: if (control == META_FRAME_CONTROL_UNSHADE) meta_core_unshade (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, event->time); @@ -1710,10 +1710,10 @@ meta_frames_button_release_event (GtkWidget *widget, case META_GRAB_OP_CLICKING_ABOVE: if (control == META_FRAME_CONTROL_ABOVE) meta_core_make_above (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); - + meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; - + case META_GRAB_OP_CLICKING_UNABOVE: if (control == META_FRAME_CONTROL_UNABOVE) meta_core_unmake_above (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); @@ -1727,14 +1727,14 @@ meta_frames_button_release_event (GtkWidget *widget, meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; - + case META_GRAB_OP_CLICKING_UNSTICK: if (control == META_FRAME_CONTROL_UNSTICK) meta_core_unstick (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; - + default: break; } @@ -1746,7 +1746,7 @@ meta_frames_button_release_event (GtkWidget *widget, */ meta_frames_update_prelit_control (frames, frame, control); } - + return TRUE; } @@ -1761,9 +1761,9 @@ meta_frames_update_prelit_control (MetaFrames *frames, meta_verbose ("Updating prelit control from %u to %u\n", frame->prelit_control, control); - + cursor = META_CURSOR_DEFAULT; - + switch (control) { case META_FRAME_CONTROL_CLIENT_AREA: @@ -1818,12 +1818,12 @@ meta_frames_update_prelit_control (MetaFrames *frames, case META_FRAME_CONTROL_RESIZE_E: cursor = META_CURSOR_EAST_RESIZE; break; - } + } /* set/unset the prelight cursor */ meta_core_set_screen_cursor (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, - cursor); + cursor); switch (control) { @@ -1844,7 +1844,7 @@ meta_frames_update_prelit_control (MetaFrames *frames, /* Only prelight buttons */ control = META_FRAME_CONTROL_NONE; break; - } + } if (control == frame->prelit_control) return; @@ -1865,9 +1865,9 @@ meta_frames_motion_notify_event (GtkWidget *widget, MetaUIFrame *frame; MetaFrames *frames; MetaGrabOp grab_op; - + frames = META_FRAMES (widget); - + frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); if (frame == NULL) return FALSE; @@ -1877,7 +1877,7 @@ meta_frames_motion_notify_event (GtkWidget *widget, frames->last_motion_frame = frame; grab_op = meta_core_get_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); - + switch (grab_op) { case META_GRAB_OP_CLICKING_MENU: @@ -1925,7 +1925,7 @@ meta_frames_motion_notify_event (GtkWidget *widget, (control == META_FRAME_CONTROL_UNSTICK && grab_op == META_GRAB_OP_CLICKING_UNSTICK))) control = META_FRAME_CONTROL_NONE; - + /* Update prelit control and cursor */ meta_frames_update_prelit_control (frames, frame, control); @@ -1944,7 +1944,7 @@ meta_frames_motion_notify_event (GtkWidget *widget, /* Update prelit control and cursor */ meta_frames_update_prelit_control (frames, frame, control); - + queue_tip (frames); } break; @@ -1952,7 +1952,7 @@ meta_frames_motion_notify_event (GtkWidget *widget, default: break; } - + return TRUE; } @@ -1968,7 +1968,7 @@ meta_frames_destroy_event (GtkWidget *widget, frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); if (frame == NULL) return FALSE; - + return TRUE; } @@ -2056,7 +2056,7 @@ populate_cache (MetaFrames *frames, { return; } - + meta_theme_get_frame_borders (meta_theme_get_current (), frame_type, frame->text_height, @@ -2098,10 +2098,10 @@ populate_cache (MetaFrames *frames, if (!piece->pixmap) piece->pixmap = generate_pixmap (frames, frame, &piece->rect); } - + if (frames->invalidate_cache_timeout_id) g_source_remove (frames->invalidate_cache_timeout_id); - + frames->invalidate_cache_timeout_id = g_timeout_add (1000, invalidate_cache_timeout, frames); if (!g_list_find (frames->invalidate_frames, frame)) @@ -2115,7 +2115,7 @@ clip_to_screen (cairo_region_t *region, MetaUIFrame *frame) cairo_rectangle_int_t frame_area; cairo_rectangle_int_t screen_area = { 0, 0, 0, 0 }; cairo_region_t *tmp_region; - + /* Chop off stuff outside the screen; this optimization * is crucial to handle huge client windows, * like "xterm -geometry 1000x1000" @@ -2152,7 +2152,7 @@ subtract_client_area (cairo_region_t *region, MetaFrameBorders borders; cairo_region_t *tmp_region; Display *display; - + display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); meta_core_get (display, frame->xwindow, @@ -2244,11 +2244,11 @@ meta_frames_draw (GtkWidget *widget, populate_cache (frames, frame); region = cairo_region_create_rectangle (&clip); - + pixels = get_cache (frames, frame); cached_pixels_draw (pixels, cr, region); - + clip_to_screen (region, frame); subtract_client_area (region, frame); @@ -2311,7 +2311,7 @@ meta_frames_paint (MetaFrames *frames, grab_op = meta_core_get_grab_op (display); if (grab_frame != frame->xwindow) grab_op = META_GRAB_OP_NONE; - + /* Set prelight state */ switch (frame->prelit_control) { @@ -2464,7 +2464,7 @@ meta_frames_enter_notify_event (GtkWidget *widget, MetaUIFrame *frame; MetaFrames *frames; MetaFrameControl control; - + frames = META_FRAMES (widget); frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); @@ -2473,7 +2473,7 @@ meta_frames_enter_notify_event (GtkWidget *widget, control = get_control (frames, frame, event->x, event->y); meta_frames_update_prelit_control (frames, frame, control); - + return TRUE; } @@ -2491,7 +2491,7 @@ meta_frames_leave_notify_event (GtkWidget *widget, return FALSE; meta_frames_update_prelit_control (frames, frame, META_FRAME_CONTROL_NONE); - + clear_tip (frames); return TRUE; @@ -2502,7 +2502,7 @@ control_rect (MetaFrameControl control, MetaFrameGeometry *fgeom) { GdkRectangle *rect; - + rect = NULL; switch (control) { @@ -2576,17 +2576,17 @@ get_control (MetaFrames *frames, MetaFrameFlags flags; gboolean has_vert, has_horiz; GdkRectangle client; - + meta_frames_calc_geometry (frames, frame, &fgeom); client.x = fgeom.left_width; client.y = fgeom.top_height; client.width = fgeom.width - fgeom.left_width - fgeom.right_width; - client.height = fgeom.height - fgeom.top_height - fgeom.bottom_height; + client.height = fgeom.height - fgeom.top_height - fgeom.bottom_height; if (POINT_IN_RECT (x, y, client)) return META_FRAME_CONTROL_CLIENT_AREA; - + if (POINT_IN_RECT (x, y, fgeom.close_rect.clickable)) return META_FRAME_CONTROL_DELETE; @@ -2599,10 +2599,10 @@ get_control (MetaFrames *frames, meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, META_CORE_GET_FRAME_FLAGS, &flags, META_CORE_GET_END); - + has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0; has_horiz = (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) != 0; - + if (POINT_IN_RECT (x, y, fgeom.title_rect)) { if (has_vert && y <= TOP_RESIZE_HEIGHT) @@ -2618,7 +2618,7 @@ get_control (MetaFrames *frames, else return META_FRAME_CONTROL_MAXIMIZE; } - + if (POINT_IN_RECT (x, y, fgeom.shade_rect.clickable)) { return META_FRAME_CONTROL_SHADE; @@ -2731,7 +2731,7 @@ meta_frames_push_delay_exposes (MetaFrames *frames) gdk_window_process_all_updates (); XFlush (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); } - + frames->expose_delay_count += 1; } @@ -2755,7 +2755,7 @@ void meta_frames_pop_delay_exposes (MetaFrames *frames) { g_return_if_fail (frames->expose_delay_count > 0); - + frames->expose_delay_count -= 1; if (frames->expose_delay_count == 0) diff --git a/src/ui/frames.h b/src/ui/frames.h index 87b9ac73..1e83ffd4 100644 --- a/src/ui/frames.h +++ b/src/ui/frames.h @@ -2,9 +2,9 @@ /* Metacity window frame manager widget */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -80,7 +80,7 @@ struct _MetaUIFrame char *title; /* NULL once we have a layout */ guint expose_delayed : 1; guint shape_applied : 1; - + /* FIXME get rid of this, it can just be in the MetaFrames struct */ MetaFrameControl prelit_control; }; @@ -88,7 +88,7 @@ struct _MetaUIFrame struct _MetaFrames { GtkWindow parent_instance; - + GHashTable *text_heights; GHashTable *frames; diff --git a/src/ui/gradient.c b/src/ui/gradient.c index 982faf9c..39075f1d 100644 --- a/src/ui/gradient.c +++ b/src/ui/gradient.c @@ -2,11 +2,11 @@ /* Metacity gradient rendering */ -/* +/* * Copyright (C) 2001 Havoc Pennington, 99% copied from wrlib in * WindowMaker, Copyright (C) 1997-2000 Dan Pascu and Alfredo Kojima * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -72,7 +72,7 @@ blank_pixbuf (int width, int height, gboolean no_padding) if (no_padding) rowstride = width * 3; else - /* Always align rows to 32-bit boundaries */ + /* Always align rows to 32-bit boundaries */ rowstride = 4 * ((3 * width + 3) / 4); buf = g_try_malloc (height * rowstride); @@ -161,7 +161,7 @@ meta_gradient_create_interwoven (int width, const GdkRGBA colors2[2], int thickness2) { - + int i, j, k, l, ll; long r1, g1, b1, dr1, dg1, db1; long r2, g2, b2, dr2, dg2, db2; @@ -169,14 +169,14 @@ meta_gradient_create_interwoven (int width, unsigned char *ptr; unsigned char *pixels; int rowstride; - + pixbuf = blank_pixbuf (width, height, FALSE); if (pixbuf == NULL) return NULL; - + pixels = gdk_pixbuf_get_pixels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); - + r1 = (long)(colors1[0].red*0xffffff); g1 = (long)(colors1[0].green*0xffffff); b1 = (long)(colors1[0].blue*0xffffff); @@ -196,7 +196,7 @@ meta_gradient_create_interwoven (int width, for (i=0,k=0,l=0,ll=thickness1; i<height; i++) { ptr = pixels + i * rowstride; - + if (k == 0) { ptr[0] = (unsigned char) (r1>>16); @@ -231,7 +231,7 @@ meta_gradient_create_interwoven (int width, r1+=dr1; g1+=dg1; b1+=db1; - + r2+=dr2; g2+=dg2; b2+=db2; @@ -244,20 +244,20 @@ meta_gradient_create_interwoven (int width, *---------------------------------------------------------------------- * meta_gradient_create_horizontal-- * Renders a horizontal linear gradient of the specified size in the - * GdkPixbuf format with a border of the specified type. - * + * GdkPixbuf format with a border of the specified type. + * * Returns: * A 24bit GdkPixbuf with the gradient (no alpha channel). - * + * * Side effects: * None - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ static GdkPixbuf* meta_gradient_create_horizontal (int width, int height, const GdkRGBA *from, const GdkRGBA *to) -{ +{ int i; long r, g, b, dr, dg, db; GdkPixbuf *pixbuf; @@ -270,22 +270,22 @@ meta_gradient_create_horizontal (int width, int height, pixbuf = blank_pixbuf (width, height, FALSE); if (pixbuf == NULL) return NULL; - + pixels = gdk_pixbuf_get_pixels (pixbuf); ptr = pixels; rowstride = gdk_pixbuf_get_rowstride (pixbuf); - + r0 = (guchar) (from->red * 0xff); g0 = (guchar) (from->green * 0xff); b0 = (guchar) (from->blue * 0xff); rf = (guchar) (to->red * 0xff); gf = (guchar) (to->green * 0xff); - bf = (guchar) (to->blue * 0xff); - + bf = (guchar) (to->blue * 0xff); + r = r0 << 16; g = g0 << 16; b = b0 << 16; - + dr = ((rf-r0)<<16)/(int)width; dg = ((gf-g0)<<16)/(int)width; db = ((bf-b0)<<16)/(int)width; @@ -334,21 +334,21 @@ meta_gradient_create_vertical (int width, int height, int rf, gf, bf; int rowstride; unsigned char *pixels; - + pixbuf = blank_pixbuf (width, height, FALSE); if (pixbuf == NULL) return NULL; - + pixels = gdk_pixbuf_get_pixels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); - + r0 = (guchar) (from->red * 0xff); g0 = (guchar) (from->green * 0xff); b0 = (guchar) (from->blue * 0xff); rf = (guchar) (to->red * 0xff); gf = (guchar) (to->green * 0xff); bf = (guchar) (to->blue * 0xff); - + r = r0<<16; g = g0<<16; b = b0<<16; @@ -360,7 +360,7 @@ meta_gradient_create_vertical (int width, int height, for (i=0; i<height; i++) { ptr = pixels + i * rowstride; - + ptr[0] = (unsigned char)(r>>16); ptr[1] = (unsigned char)(g>>16); ptr[2] = (unsigned char)(b>>16); @@ -403,7 +403,7 @@ meta_gradient_create_diagonal (int width, int height, unsigned char *ptr; unsigned char *pixels; int rowstride; - + if (width == 1) return meta_gradient_create_vertical (width, height, from, to); else if (height == 1) @@ -412,7 +412,7 @@ meta_gradient_create_diagonal (int width, int height, pixbuf = blank_pixbuf (width, height, FALSE); if (pixbuf == NULL) return NULL; - + pixels = gdk_pixbuf_get_pixels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); @@ -450,27 +450,27 @@ meta_gradient_create_multi_horizontal (int width, int height, GdkPixbuf *pixbuf; unsigned char *ptr; unsigned char *pixels; - int width2; + int width2; int rowstride; - + g_return_val_if_fail (count > 2, NULL); pixbuf = blank_pixbuf (width, height, FALSE); if (pixbuf == NULL) return NULL; - + pixels = gdk_pixbuf_get_pixels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); ptr = pixels; - + if (count > width) count = width; - + if (count > 1) width2 = width/(count-1); else width2 = width; - + k = 0; r = (long)(colors[0].red * 0xffffff); @@ -503,7 +503,7 @@ meta_gradient_create_multi_horizontal (int width, int height, *ptr++ = (unsigned char)(g>>16); *ptr++ = (unsigned char)(b>>16); } - + /* copy the first line to the other lines */ for (i=1; i<height; i++) { @@ -524,25 +524,25 @@ meta_gradient_create_multi_vertical (int width, int height, int height2; int x; int rowstride; - + g_return_val_if_fail (count > 2, NULL); pixbuf = blank_pixbuf (width, height, FALSE); if (pixbuf == NULL) return NULL; - + pixels = gdk_pixbuf_get_pixels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); ptr = pixels; - + if (count > height) count = height; - + if (count > 1) height2 = height/(count-1); else height2 = height; - + k = 0; r = (long)(colors[0].red * 0xffffff); @@ -566,7 +566,7 @@ meta_gradient_create_multi_vertical (int width, int height, memcpy (&(ptr[x*3]), ptr, (width - x)*3); ptr += rowstride; - + r += dr; g += dg; b += db; @@ -590,14 +590,14 @@ meta_gradient_create_multi_vertical (int width, int height, memcpy (&(ptr[x*3]), ptr, (width - x)*3); ptr += rowstride; - + for (j=k+1; j<height; j++) { memcpy (ptr, tmp, rowstride); ptr += rowstride; } } - + return pixbuf; } @@ -613,7 +613,7 @@ meta_gradient_create_multi_diagonal (int width, int height, unsigned char *ptr; unsigned char *pixels; int rowstride; - + g_return_val_if_fail (count > 2, NULL); if (width == 1) @@ -625,10 +625,10 @@ meta_gradient_create_multi_diagonal (int width, int height, width, height); if (pixbuf == NULL) return NULL; - + pixels = gdk_pixbuf_get_pixels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); - + if (count > width) count = width; if (count > height) @@ -675,12 +675,12 @@ simple_multiply_alpha (GdkPixbuf *pixbuf, int row; g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); - + if (alpha == 255) return; - + g_assert (gdk_pixbuf_get_has_alpha (pixbuf)); - + pixels = gdk_pixbuf_get_pixels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); height = gdk_pixbuf_get_height (pixbuf); @@ -705,7 +705,7 @@ simple_multiply_alpha (GdkPixbuf *pixbuf, */ /* ((*p / 255.0) * (alpha / 255.0)) * 255; */ *p = (guchar) (((int) *p * (int) alpha) / (int) 255); - + ++p; /* skip A */ } @@ -722,13 +722,13 @@ meta_gradient_add_alpha_horizontal (GdkPixbuf *pixbuf, long a, da; unsigned char *p; unsigned char *pixels; - int width2; + int width2; int rowstride; int width, height; unsigned char *gradient; unsigned char *gradient_p; unsigned char *gradient_end; - + g_return_if_fail (n_alphas > 0); if (n_alphas == 1) @@ -737,24 +737,24 @@ meta_gradient_add_alpha_horizontal (GdkPixbuf *pixbuf, simple_multiply_alpha (pixbuf, alphas[0]); return; } - + width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); gradient = g_new (unsigned char, width); gradient_end = gradient + width; - + if (n_alphas > width) n_alphas = width; - + if (n_alphas > 1) width2 = width / (n_alphas - 1); else width2 = width; - + a = alphas[0] << 8; gradient_p = gradient; - + /* render the gradient into an array */ for (i = 1; i < n_alphas; i++) { @@ -763,7 +763,7 @@ meta_gradient_add_alpha_horizontal (GdkPixbuf *pixbuf, for (j = 0; j < width2; j++) { *gradient_p++ = (a >> 8); - + a += da; } @@ -775,11 +775,11 @@ meta_gradient_add_alpha_horizontal (GdkPixbuf *pixbuf, { *gradient_p++ = a >> 8; } - + /* Now for each line of the pixbuf, fill in with the gradient */ pixels = gdk_pixbuf_get_pixels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); - + p = pixels; i = 0; while (i < height) @@ -805,7 +805,7 @@ meta_gradient_add_alpha_horizontal (GdkPixbuf *pixbuf, p = row_end; ++i; } - + g_free (gradient); } @@ -818,21 +818,21 @@ meta_gradient_add_alpha (GdkPixbuf *pixbuf, g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); g_return_if_fail (gdk_pixbuf_get_has_alpha (pixbuf)); g_return_if_fail (n_alphas > 0); - + switch (type) { case META_GRADIENT_HORIZONTAL: meta_gradient_add_alpha_horizontal (pixbuf, alphas, n_alphas); break; - + case META_GRADIENT_VERTICAL: g_printerr ("metacity: vertical alpha channel gradient not implemented yet\n"); break; - + case META_GRADIENT_DIAGONAL: g_printerr ("metacity: diagonal alpha channel gradient not implemented yet\n"); break; - + case META_GRADIENT_LAST: g_assert_not_reached (); break; diff --git a/src/ui/gradient.h b/src/ui/gradient.h index 23ec0943..0f2fad24 100644 --- a/src/ui/gradient.h +++ b/src/ui/gradient.h @@ -2,10 +2,10 @@ /* Metacity gradient rendering */ -/* +/* * Copyright (C) 2001 Havoc Pennington, 99% copied from wrlib in * WindowMaker, Copyright (C) 1997-2000 Dan Pascu and Alfredo Kojima - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/ui/menu.c b/src/ui/menu.c index 8a35583d..c19a5c69 100644 --- a/src/ui/menu.c +++ b/src/ui/menu.c @@ -2,11 +2,11 @@ /* Metacity window menu */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2004 Rob Adams * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -108,18 +108,18 @@ popup_position_func (GtkMenu *menu, gboolean *push_in, gpointer user_data) { - GtkRequisition req; + GtkRequisition req; GdkPoint *pos; pos = user_data; - + gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL); *x = pos->x; *y = pos->y; - + if (meta_ui_get_direction() == META_UI_DIRECTION_RTL) - *x = MAX (0, *x - req.width); + *x = MAX (0, *x - req.width); /* Ensure onscreen */ *x = CLAMP (*x, 0, MAX (0, gdk_screen_width () - req.width)); @@ -131,7 +131,7 @@ menu_closed (GtkMenu *widget, gpointer data) { MetaWindowMenu *menu; - + menu = data; meta_frames_notify_menu_hide (menu->frames); @@ -141,7 +141,7 @@ menu_closed (GtkMenu *widget, gtk_get_current_event_time (), 0, 0, menu->data); - + /* menu may now be freed */ } @@ -149,9 +149,9 @@ static void activate_cb (GtkWidget *menuitem, gpointer data) { MenuData *md; - + g_return_if_fail (GTK_IS_WIDGET (menuitem)); - + md = data; meta_frames_notify_menu_hide (md->menu->frames); @@ -172,7 +172,7 @@ activate_cb (GtkWidget *menuitem, gpointer data) * accelerators. At the moment this means adding a _ if the name is of * the form "Workspace n" where n is less than 10, and escaping any * other '_'s so they do not create inadvertant accelerators. - * + * * The calling code owns the string, and is reponsible to free the * memory after use. * @@ -191,7 +191,7 @@ get_workspace_name_with_accel (Display *display, name = meta_core_get_workspace_name_with_index (display, xroot, index); g_assert (name != NULL); - + /* * If the name is of the form "Workspace x" where x is an unsigned * integer, insert a '_' before the number if it is less than 10 and @@ -202,7 +202,7 @@ get_workspace_name_with_accel (Display *display, *(name + charcount)=='\0') { char *new_name; - + /* * Above name is a pointer into the Workspace struct. Here we make * a copy copy so we can have our wicked way with it. @@ -274,10 +274,10 @@ menu_item_new (MenuItem *menuitem, int workspace_id) else if (menuitem->type == MENU_ITEM_CHECKBOX) { mi = gtk_check_menu_item_new (); - + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), menuitem->checked); - } + } else if (menuitem->type == MENU_ITEM_RADIOBUTTON) { mi = gtk_check_menu_item_new (); @@ -303,7 +303,7 @@ menu_item_new (MenuItem *menuitem, int workspace_id) meta_accel_label_set_accelerator (META_ACCEL_LABEL (accel_label), key, mods); - + return mi; } @@ -323,18 +323,18 @@ meta_window_menu_new (MetaFrames *frames, /* FIXME: Modifications to 'ops' should happen in meta_window_show_menu */ if (n_workspaces < 2) ops &= ~(META_MENU_OP_STICK | META_MENU_OP_UNSTICK | META_MENU_OP_WORKSPACES); - else if (n_workspaces == 2) + else if (n_workspaces == 2) /* #151183: If we only have two workspaces, disable the menu listing them. */ ops &= ~(META_MENU_OP_WORKSPACES); - + menu = g_new (MetaWindowMenu, 1); menu->frames = frames; menu->client_xwindow = client_xwindow; menu->func = func; menu->data = data; menu->ops = ops; - menu->insensitive = insensitive; - + menu->insensitive = insensitive; + menu->menu = gtk_menu_new (); gtk_menu_set_screen (GTK_MENU (menu->menu), @@ -454,12 +454,12 @@ meta_window_menu_new (MetaFrames *frames, if (insensitive & menuitem.op) gtk_widget_set_sensitive (mi, FALSE); - + md = g_new (MenuData, 1); - + md->menu = menu; md->op = menuitem.op; - + g_signal_connect_data (G_OBJECT (mi), "activate", G_CALLBACK (activate_cb), @@ -470,15 +470,15 @@ meta_window_menu_new (MetaFrames *frames, if (mi) { gtk_menu_shell_append (GTK_MENU_SHELL (menu->menu), mi); - + gtk_widget_show (mi); } } } - + g_signal_connect (menu->menu, "selection_done", - G_CALLBACK (menu_closed), menu); + G_CALLBACK (menu_closed), menu); return menu; } @@ -491,7 +491,7 @@ meta_window_menu_popup (MetaWindowMenu *menu, guint32 timestamp) { GdkPoint *pt; - + pt = g_new (GdkPoint, 1); g_object_set_data_full (G_OBJECT (menu->menu), @@ -501,7 +501,7 @@ meta_window_menu_popup (MetaWindowMenu *menu, pt->x = root_x; pt->y = root_y; - + gtk_menu_popup (GTK_MENU (menu->menu), NULL, NULL, popup_position_func, pt, diff --git a/src/ui/menu.h b/src/ui/menu.h index 5faf4430..aa8f6225 100644 --- a/src/ui/menu.h +++ b/src/ui/menu.h @@ -2,9 +2,9 @@ /* Metacity window menu */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/ui/metaaccellabel.c b/src/ui/metaaccellabel.c index 2289ca66..8751e7a9 100644 --- a/src/ui/metaaccellabel.c +++ b/src/ui/metaaccellabel.c @@ -271,9 +271,9 @@ meta_accel_label_draw (GtkWidget *widget, cairo_translate (cr, ac_width, 0); if (gtk_label_get_ellipsize (label)) pango_layout_set_width (label_layout, - pango_layout_get_width (label_layout) + pango_layout_get_width (label_layout) - ac_width * PANGO_SCALE); - + allocation.width -= ac_width; gtk_widget_set_allocation (widget, &allocation); if (GTK_WIDGET_CLASS (meta_accel_label_parent_class)->draw) @@ -283,7 +283,7 @@ meta_accel_label_draw (GtkWidget *widget, gtk_widget_set_allocation (widget, &allocation); if (gtk_label_get_ellipsize (label)) pango_layout_set_width (label_layout, - pango_layout_get_width (label_layout) + pango_layout_get_width (label_layout) + ac_width * PANGO_SCALE); cairo_restore (cr); @@ -318,7 +318,7 @@ meta_accel_label_draw (GtkWidget *widget, if (GTK_WIDGET_CLASS (meta_accel_label_parent_class)->draw) GTK_WIDGET_CLASS (meta_accel_label_parent_class)->draw (widget, cr); } - + return FALSE; } diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c index 458d9c01..85f489a3 100644 --- a/src/ui/preview-widget.c +++ b/src/ui/preview-widget.c @@ -2,9 +2,9 @@ /* Metacity theme preview widget */ -/* +/* * Copyright (C) 2002 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -62,7 +62,7 @@ static void meta_preview_init (MetaPreview *preview) { int i; - + gtk_widget_set_has_window (GTK_WIDGET (preview), FALSE); i = 0; @@ -72,13 +72,13 @@ meta_preview_init (MetaPreview *preview) preview->button_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST; ++i; } - + preview->button_layout.left_buttons[0] = META_BUTTON_FUNCTION_MENU; preview->button_layout.right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE; preview->button_layout.right_buttons[1] = META_BUTTON_FUNCTION_MAXIMIZE; preview->button_layout.right_buttons[2] = META_BUTTON_FUNCTION_CLOSE; - + preview->type = META_FRAME_TYPE_NORMAL; preview->flags = META_FRAME_ALLOWS_DELETE | @@ -90,7 +90,7 @@ meta_preview_init (MetaPreview *preview) META_FRAME_HAS_FOCUS | META_FRAME_ALLOWS_SHADE | META_FRAME_ALLOWS_MOVE; - + preview->borders_cached = FALSE; } @@ -98,9 +98,9 @@ GtkWidget* meta_preview_new (void) { MetaPreview *preview; - + preview = g_object_new (META_TYPE_PREVIEW, NULL); - + return GTK_WIDGET (preview); } @@ -113,7 +113,7 @@ meta_preview_finalize (GObject *object) g_free (preview->title); preview->title = NULL; - + G_OBJECT_CLASS (meta_preview_parent_class)->finalize (object); } @@ -123,7 +123,7 @@ ensure_info (MetaPreview *preview) GtkWidget *widget; widget = GTK_WIDGET (preview); - + if (preview->layout == NULL) { PangoFontDescription *font_desc; @@ -131,34 +131,34 @@ ensure_info (MetaPreview *preview) PangoAttrList *attrs; PangoAttribute *attr; - if (preview->theme) + if (preview->theme) scale = meta_theme_get_title_scale (preview->theme, preview->type, preview->flags); else scale = 1.0; - + preview->layout = gtk_widget_create_pango_layout (widget, preview->title); - + font_desc = meta_gtk_widget_get_font_desc (widget, scale, NULL); - + preview->text_height = meta_pango_font_desc_get_text_height (font_desc, gtk_widget_get_pango_context (widget)); - + attrs = pango_attr_list_new (); - + attr = pango_attr_size_new (pango_font_description_get_size (font_desc)); attr->start_index = 0; attr->end_index = G_MAXINT; - + pango_attr_list_insert (attrs, attr); - + pango_layout_set_attributes (preview->layout, attrs); - - pango_attr_list_unref (attrs); - + + pango_attr_list_unref (attrs); + pango_font_description_free (font_desc); } @@ -192,7 +192,7 @@ meta_preview_draw (GtkWidget *widget, META_BUTTON_STATE_NORMAL, META_BUTTON_STATE_NORMAL }; - + g_return_val_if_fail (META_IS_PREVIEW (widget), FALSE); preview = META_PREVIEW (widget); @@ -202,7 +202,7 @@ meta_preview_draw (GtkWidget *widget, cairo_save (cr); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - + gtk_widget_get_allocation (widget, &allocation); client_width = allocation.width - preview->borders.visible.left - preview->borders.visible.right - border_width * 2; client_height = allocation.height - preview->borders.visible.top - preview->borders.visible.bottom - border_width * 2; @@ -210,12 +210,12 @@ meta_preview_draw (GtkWidget *widget, if (client_width < 0) client_width = 1; if (client_height < 0) - client_height = 1; - + client_height = 1; + if (preview->theme) { border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - + meta_theme_draw_frame (preview->theme, widget, cr, @@ -319,15 +319,15 @@ meta_preview_size_allocate (GtkWidget *widget, int border_width; GtkAllocation widget_allocation, child_allocation; GtkWidget *child; - + preview = META_PREVIEW (widget); ensure_info (preview); - + gtk_widget_set_allocation (widget, allocation); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - + child = gtk_bin_get_child (GTK_BIN (widget)); if (child && gtk_widget_get_visible (child)) @@ -335,7 +335,7 @@ meta_preview_size_allocate (GtkWidget *widget, gtk_widget_get_allocation (widget, &widget_allocation); child_allocation.x = widget_allocation.x + border_width + preview->borders.visible.left; child_allocation.y = widget_allocation.y + border_width + preview->borders.visible.top; - + child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->borders.visible.left - preview->borders.visible.right); child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->borders.visible.top - preview->borders.visible.bottom); @@ -362,7 +362,7 @@ meta_preview_set_theme (MetaPreview *preview, g_return_if_fail (META_IS_PREVIEW (preview)); preview->theme = theme; - + clear_cache (preview); gtk_widget_queue_resize (GTK_WIDGET (preview)); @@ -376,7 +376,7 @@ meta_preview_set_title (MetaPreview *preview, g_free (preview->title); preview->title = g_strdup (title); - + clear_cache (preview); gtk_widget_queue_resize (GTK_WIDGET (preview)); @@ -413,9 +413,9 @@ meta_preview_set_button_layout (MetaPreview *preview, const MetaButtonLayout *button_layout) { g_return_if_fail (META_IS_PREVIEW (preview)); - - preview->button_layout = *button_layout; - + + preview->button_layout = *button_layout; + gtk_widget_queue_draw (GTK_WIDGET (preview)); } @@ -448,7 +448,7 @@ meta_preview_get_icon (void) g_assert (default_icon); } - + return default_icon; } @@ -481,6 +481,6 @@ meta_preview_get_mini_icon (void) g_assert (default_icon); } - + return default_icon; } diff --git a/src/ui/preview-widget.h b/src/ui/preview-widget.h index ad61a667..b59e231b 100644 --- a/src/ui/preview-widget.h +++ b/src/ui/preview-widget.h @@ -2,9 +2,9 @@ /* Metacity theme preview widget */ -/* +/* * Copyright (C) 2002 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -42,7 +42,7 @@ struct _MetaPreview MetaTheme *theme; char *title; MetaFrameType type; - MetaFrameFlags flags; + MetaFrameFlags flags; PangoLayout *layout; int text_height; diff --git a/src/ui/resizepopup.c b/src/ui/resizepopup.c index 7c63592f..84ad6a17 100644 --- a/src/ui/resizepopup.c +++ b/src/ui/resizepopup.c @@ -2,9 +2,9 @@ /* Metacity resizing-terminal-window feedback */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -30,13 +30,13 @@ struct _MetaResizePopup GtkWidget *size_window; GtkWidget *size_label; Display *display; - int screen_number; + int screen_number; int vertical_size; int horizontal_size; - + gboolean showing; - + MetaRectangle rect; }; @@ -50,7 +50,7 @@ meta_ui_resize_popup_new (Display *display, popup->display = display; popup->screen_number = screen_number; - + return popup; } @@ -58,10 +58,10 @@ void meta_ui_resize_popup_free (MetaResizePopup *popup) { g_return_if_fail (popup != NULL); - + if (popup->size_window) gtk_widget_destroy (popup->size_window); - + g_free (popup); } @@ -69,20 +69,20 @@ static void ensure_size_window (MetaResizePopup *popup) { GtkWidget *frame; - + if (popup->size_window) return; - + popup->size_window = gtk_window_new (GTK_WINDOW_POPUP); gtk_window_set_screen (GTK_WINDOW (popup->size_window), gdk_display_get_screen (gdk_x11_lookup_xdisplay (popup->display), popup->screen_number)); - + /* never shrink the size window */ gtk_window_set_resizable (GTK_WINDOW (popup->size_window), TRUE); - + frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); @@ -106,9 +106,9 @@ update_size_window (MetaResizePopup *popup) char *str; int x, y; int width, height; - + g_return_if_fail (popup->size_window != NULL); - + /* Translators: This represents the size of a window. The first number is * the width of the window and the second is the height. */ @@ -124,7 +124,7 @@ update_size_window (MetaResizePopup *popup) x = popup->rect.x + (popup->rect.width - width) / 2; y = popup->rect.y + (popup->rect.height - height) / 2; - + if (gtk_widget_get_realized (popup->size_window)) { /* using move_resize to avoid jumpiness */ @@ -146,7 +146,7 @@ sync_showing (MetaResizePopup *popup) { if (popup->size_window) gtk_widget_show (popup->size_window); - + if (popup->size_window && gtk_widget_get_realized (popup->size_window)) gdk_window_raise (gtk_widget_get_window (popup->size_window)); } @@ -167,11 +167,11 @@ meta_ui_resize_popup_set (MetaResizePopup *popup, { gboolean need_update_size; int display_w, display_h; - + g_return_if_fail (popup != NULL); need_update_size = FALSE; - + display_w = rect.width - base_width; if (width_inc > 0) display_w /= width_inc; @@ -184,17 +184,17 @@ meta_ui_resize_popup_set (MetaResizePopup *popup, display_w != popup->horizontal_size || display_h != popup->vertical_size) need_update_size = TRUE; - + popup->rect = rect; popup->vertical_size = display_h; popup->horizontal_size = display_w; - + if (need_update_size) { ensure_size_window (popup); update_size_window (popup); } - + sync_showing (popup); } @@ -203,7 +203,7 @@ meta_ui_resize_popup_set_showing (MetaResizePopup *popup, gboolean showing) { g_return_if_fail (popup != NULL); - + if (showing == popup->showing) return; @@ -214,6 +214,6 @@ meta_ui_resize_popup_set_showing (MetaResizePopup *popup, ensure_size_window (popup); update_size_window (popup); } - + sync_showing (popup); } diff --git a/src/ui/select-image.c b/src/ui/select-image.c index a99f7221..934126cd 100644 --- a/src/ui/select-image.c +++ b/src/ui/select-image.c @@ -1,10 +1,10 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat, Inc. * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/ui/select-image.h b/src/ui/select-image.h index 64466a33..cd7692a3 100644 --- a/src/ui/select-image.h +++ b/src/ui/select-image.h @@ -1,10 +1,10 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat, Inc. * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/ui/select-workspace.c b/src/ui/select-workspace.c index 70b7555a..76e63565 100644 --- a/src/ui/select-workspace.c +++ b/src/ui/select-workspace.c @@ -1,10 +1,10 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat, Inc. * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -48,7 +48,7 @@ meta_convert_meta_to_wnck (MetaWindow *window, MetaScreen *screen) WnckWindowDisplayInfo wnck_window; wnck_window.icon = window->icon; wnck_window.mini_icon = window->mini_icon; - + wnck_window.is_active = FALSE; if (window == window->display->expected_focus_window) wnck_window.is_active = TRUE; @@ -101,7 +101,7 @@ meta_select_workspace_draw (GtkWidget *widget, ignoreable_sticky = window->on_all_workspaces && workspace != workspace->screen->active_workspace; - if (window->skip_pager || + if (window->skip_pager || !meta_window_showing_on_its_workspace (window) || window->unmaps_pending || ignoreable_sticky) @@ -134,7 +134,7 @@ meta_select_workspace_draw (GtkWidget *widget, n_windows); g_free (windows); - + if (select->priv->selected) { GtkStyleContext *context; diff --git a/src/ui/select-workspace.h b/src/ui/select-workspace.h index d6fd793c..8181fec1 100644 --- a/src/ui/select-workspace.h +++ b/src/ui/select-workspace.h @@ -1,10 +1,10 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat, Inc. * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c index 94a5238d..e67bd71d 100644 --- a/src/ui/tabpopup.c +++ b/src/ui/tabpopup.c @@ -2,11 +2,11 @@ /* Metacity popup window thing showing windows you can tab to */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2002 Red Hat, Inc. * Copyright (C) 2005 Elijah Newren - * + * * 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; either version 2 of the @@ -16,7 +16,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -61,15 +61,15 @@ outline_window_draw (GtkWidget *widget, gpointer data) { MetaTabPopup *popup; - TabEntry *te; - + TabEntry *te; + popup = data; if (!popup->outline || popup->current_selected_entry == NULL) return FALSE; te = popup->current_selected_entry; - + cairo_set_line_width (cr, 1.0); cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); @@ -106,7 +106,7 @@ dimm_icon (GdkPixbuf *pixbuf) } w = gdk_pixbuf_get_width (dimmed_pixbuf); - h = gdk_pixbuf_get_height (dimmed_pixbuf); + h = gdk_pixbuf_get_height (dimmed_pixbuf); pixel_stride = 4; @@ -115,24 +115,24 @@ dimm_icon (GdkPixbuf *pixbuf) for (y = 0; y < h; y++) { - pixels = row; - for (x = 0; x < w; x++) + pixels = row; + for (x = 0; x < w; x++) { - pixels[3] /= 2; + pixels[3] /= 2; pixels += pixel_stride; - } + } row += row_stride; } return dimmed_pixbuf; } -static TabEntry* -tab_entry_new (const MetaTabEntry *entry, +static TabEntry* +tab_entry_new (const MetaTabEntry *entry, gint screen_width, gboolean outline) { TabEntry *te; - + te = g_new (TabEntry, 1); te->key = entry->key; te->title = NULL; @@ -153,9 +153,9 @@ tab_entry_new (const MetaTabEntry *entry, g_free (str); str = tmp; - if (entry->demands_attention) - { - /* Escape the whole line of text then markup the text and + if (entry->demands_attention) + { + /* Escape the whole line of text then markup the text and * copy it back into the original buffer. */ tmp = g_strdup_printf ("<b>%s</b>", str); @@ -177,7 +177,7 @@ tab_entry_new (const MetaTabEntry *entry, if (entry->hidden) te->dimmed_icon = dimm_icon (entry->icon); } - + if (outline) { te->rect.x = entry->rect.x; @@ -212,7 +212,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, GdkScreen *screen; GdkVisual *visual; int screen_width; - + popup = g_new (MetaTabPopup, 1); screen = gdk_display_get_screen (gdk_display_get_default (), @@ -268,7 +268,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, } popup->entries = g_list_reverse (popup->entries); - + g_assert (width > 0); height = i / width; if (i % width) @@ -276,7 +276,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, grid = gtk_grid_new (); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - + frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); gtk_container_set_border_width (GTK_CONTAINER (grid), 1); @@ -304,7 +304,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, tmp = popup->entries; while (tmp && top < height) - { + { left = 0; right = 1; @@ -328,14 +328,14 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, { image = meta_select_image_new (te->dimmed_icon); } - else + else { image = meta_select_image_new (te->icon); } gtk_widget_set_halign (image, GTK_ALIGN_CENTER); gtk_widget_set_valign (image, GTK_ALIGN_CENTER); - } + } else { image = meta_select_workspace_new ((MetaWorkspace *) te->key); @@ -350,13 +350,13 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, te->title); gtk_widget_get_preferred_size (popup->label, &req, NULL); max_label_width = MAX (max_label_width, req.width); - + tmp = tmp->next; - + ++left; ++right; } - + ++top; ++bottom; } @@ -367,17 +367,17 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, gtk_label_set_ellipsize (GTK_LABEL (popup->label), PANGO_ELLIPSIZE_END); /* Limit the window size to no bigger than screen_width/4 */ - if (max_label_width>(screen_width/4)) + if (max_label_width>(screen_width/4)) { max_label_width = screen_width/4; } max_label_width += 20; /* add random padding */ - + gtk_window_set_default_size (GTK_WINDOW (popup->window), max_label_width, -1); - + return popup; } @@ -387,7 +387,7 @@ free_tab_entry (gpointer data, gpointer user_data) TabEntry *te; te = data; - + g_free (te->title); if (te->icon) g_object_unref (G_OBJECT (te->icon)); @@ -405,11 +405,11 @@ meta_ui_tab_popup_free (MetaTabPopup *popup) if (popup->outline_window != NULL) gtk_widget_destroy (popup->outline_window); gtk_widget_destroy (popup->window); - + g_list_foreach (popup->entries, free_tab_entry, NULL); g_list_free (popup->entries); - + g_free (popup); } @@ -494,7 +494,7 @@ meta_ui_tab_popup_forward (MetaTabPopup *popup) if (popup->current == NULL) popup->current = popup->entries; - + if (popup->current != NULL) { TabEntry *te; @@ -513,7 +513,7 @@ meta_ui_tab_popup_backward (MetaTabPopup *popup) if (popup->current == NULL) popup->current = g_list_last (popup->entries); - + if (popup->current != NULL) { TabEntry *te; @@ -548,7 +548,7 @@ meta_ui_tab_popup_select (MetaTabPopup *popup, /* Note, "key" may not be in the list of entries; other code assumes * it's OK to pass in a key that isn't. */ - + tmp = popup->entries; while (tmp != NULL) { @@ -559,12 +559,12 @@ meta_ui_tab_popup_select (MetaTabPopup *popup, if (te->key == key) { popup->current = tmp; - + display_entry (popup, te); return; } - + tmp = tmp->next; } } diff --git a/src/ui/testgradient.c b/src/ui/testgradient.c index d24fc409..3c06192b 100644 --- a/src/ui/testgradient.c +++ b/src/ui/testgradient.c @@ -2,9 +2,9 @@ /* Metacity gradient test program */ -/* +/* * Copyright (C) 2002 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -32,10 +32,10 @@ draw_checkerboard (cairo_t *cr, { gint i, j, xcount, ycount; GdkRGBA color1, color2; - + #define CHECK_SIZE 10 -#define SPACING 2 - +#define SPACING 2 + color1.red = 30000. / 65535.; color1.green = 30000. / 65535.; color1.blue = 30000. / 65535.; @@ -83,7 +83,7 @@ render_simple (cairo_t *cr, { GdkPixbuf *pixbuf; GdkRGBA from, to; - + gdk_rgba_parse (&from, "blue"); gdk_rgba_parse (&to, "green"); @@ -94,23 +94,23 @@ render_simple (cairo_t *cr, if (with_alpha) { const unsigned char alphas[] = { 0xff, 0xaa, 0x2f, 0x0, 0xcc, 0xff, 0xff }; - + if (!gdk_pixbuf_get_has_alpha (pixbuf)) { GdkPixbuf *new_pixbuf; - + new_pixbuf = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0); g_object_unref (G_OBJECT (pixbuf)); pixbuf = new_pixbuf; } - + meta_gradient_add_alpha (pixbuf, alphas, G_N_ELEMENTS (alphas), META_GRADIENT_HORIZONTAL); - + draw_checkerboard (cr, width, height); } - + gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); @@ -253,13 +253,13 @@ create_gradient_window (const char *title, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), title); - + drawing_area = gtk_drawing_area_new (); gtk_widget_set_size_request (drawing_area, 1, 1); gtk_window_set_default_size (GTK_WINDOW (window), 175, 175); - + g_signal_connect (G_OBJECT (drawing_area), "draw", G_CALLBACK (draw_callback), @@ -268,7 +268,7 @@ create_gradient_window (const char *title, gtk_container_add (GTK_CONTAINER (window), drawing_area); gtk_widget_show_all (window); - + return window; } @@ -277,7 +277,7 @@ meta_gradient_test (void) { create_gradient_window ("Simple vertical", render_vertical_func); - + create_gradient_window ("Simple horizontal", render_horizontal_func); @@ -286,7 +286,7 @@ meta_gradient_test (void) create_gradient_window ("Multi vertical", render_vertical_multi_func); - + create_gradient_window ("Multi horizontal", render_horizontal_multi_func); diff --git a/src/ui/theme-parser.c b/src/ui/theme-parser.c index 9deecd22..d2a57db3 100644 --- a/src/ui/theme-parser.c +++ b/src/ui/theme-parser.c @@ -105,7 +105,7 @@ typedef struct const char *theme_file; /* theme filename */ const char *theme_dir; /* dir the theme is inside */ MetaTheme *theme; /* theme being parsed */ - guint format_version; /* version of format of theme file */ + guint format_version; /* version of format of theme file */ char *name; /* name of named thing being parsed */ MetaFrameLayout *layout; /* layout being parsed if any */ MetaDrawOpList *op_list; /* op list being parsed if any */ @@ -268,7 +268,7 @@ set_error (GError **err, int line, ch; va_list args; char *str; - + g_markup_parse_context_get_position (context, &line, &ch); va_start (args, format); @@ -324,7 +324,7 @@ parse_info_free (ParseInfo *info) { g_slist_free (info->states); g_slist_free (info->required_versions); - + if (info->theme) meta_theme_free (info->theme); @@ -336,7 +336,7 @@ parse_info_free (ParseInfo *info) if (info->op) meta_draw_op_free (info->op); - + if (info->style) meta_frame_style_unref (info->style); @@ -355,7 +355,7 @@ static void pop_state (ParseInfo *info) { g_return_if_fail (info->states != NULL); - + info->states = g_slist_remove (info->states, info->states->data); } @@ -436,7 +436,7 @@ locate_attributes (GMarkupParseContext *context, if (attrs[0].required) attrs[0].name++; /* skip past it */ *first_attribute_retloc = NULL; - + va_start (args, first_attribute_retloc); name = va_arg (args, const char*); @@ -451,7 +451,7 @@ locate_attributes (GMarkupParseContext *context, } g_assert (n_attrs < MAX_ATTRS); - + attrs[n_attrs].name = name; attrs[n_attrs].retloc = retloc; attrs[n_attrs].required = attrs[n_attrs].name[0]=='!'; @@ -459,7 +459,7 @@ locate_attributes (GMarkupParseContext *context, attrs[n_attrs].name++; /* skip past it */ n_attrs += 1; - *retloc = NULL; + *retloc = NULL; name = va_arg (args, const char*); retloc = va_arg (args, const char**); @@ -490,7 +490,7 @@ locate_attributes (GMarkupParseContext *context, if (*retloc != NULL) { - + set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, @@ -514,7 +514,7 @@ locate_attributes (GMarkupParseContext *context, { g_warning ("It could have been %s.\n", attrs[j++].name); } - + set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, @@ -588,9 +588,9 @@ parse_positive_integer (const char *str, int j; *val = 0; - + end = NULL; - + /* Is str a constant? */ if (META_THEME_ALLOWS (theme, META_THEME_UBIQUITOUS_CONSTANTS) && @@ -640,7 +640,7 @@ parse_positive_integer (const char *str, l, MAX_REASONABLE); return FALSE; } - + *val = (int) l; return TRUE; @@ -655,9 +655,9 @@ parse_double (const char *str, char *end; *val = 0; - + end = NULL; - + *val = g_ascii_strtod (str, &end); if (end == NULL || end == str) @@ -699,7 +699,7 @@ parse_boolean (const char *str, str); return FALSE; } - + return TRUE; } @@ -727,14 +727,14 @@ parse_rounding (const char *str, str); return FALSE; } - + result = parse_positive_integer (str, &tmp, context, theme, error); *val = tmp; - return result; + return result; } - + return TRUE; } @@ -770,7 +770,7 @@ parse_alpha (const char *str, MetaAlphaGradientSpec *spec; *spec_ret = NULL; - + split = g_strsplit (str, ":", -1); i = 0; @@ -784,7 +784,7 @@ parse_alpha (const char *str, str); g_strfreev (split); - + return FALSE; } @@ -800,13 +800,13 @@ parse_alpha (const char *str, while (i < n_alphas) { double v; - + if (!parse_double (split[i], &v, context, error)) { /* clear up, but don't set error: it was set by parse_double */ g_strfreev (split); meta_alpha_gradient_spec_free (spec); - + return FALSE; } @@ -817,20 +817,20 @@ parse_alpha (const char *str, v); g_strfreev (split); - meta_alpha_gradient_spec_free (spec); - + meta_alpha_gradient_spec_free (spec); + return FALSE; } spec->alphas[i] = (unsigned char) (v * 255); - + ++i; - } + } g_strfreev (split); - + *spec_ret = spec; - + return TRUE; } @@ -846,10 +846,10 @@ parse_color (MetaTheme *theme, { if (referent) return meta_color_spec_new_from_string (referent, err); - + /* no need to free referent: it's a pointer into the actual hash table */ } - + return meta_color_spec_new_from_string (str, err); } @@ -860,7 +860,7 @@ parse_title_scale (const char *str, GError **error) { double factor; - + if (strcmp (str, "xx-small") == 0) factor = PANGO_SCALE_XX_SMALL; else if (strcmp (str, "x-small") == 0) @@ -884,7 +884,7 @@ parse_title_scale (const char *str, } *val = factor; - + return TRUE; } @@ -913,7 +913,7 @@ parse_toplevel_element (GMarkupParseContext *context, const char *value; int ival = 0; double dval = 0.0; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!name", &name, "!value", &value, @@ -1023,14 +1023,14 @@ parse_toplevel_element (GMarkupParseContext *context, if (rounded_top_right && !parse_rounding (rounded_top_right, &rounded_top_right_val, context, info->theme, error)) return; if (rounded_bottom_left && !parse_rounding (rounded_bottom_left, &rounded_bottom_left_val, context, info->theme, error)) - return; + return; if (rounded_bottom_right && !parse_rounding (rounded_bottom_right, &rounded_bottom_right_val, context, info->theme, error)) return; - + title_scale_val = 1.0; if (title_scale && !parse_title_scale (title_scale, &title_scale_val, context, error)) return; - + if (meta_theme_lookup_layout (info->theme, name)) { set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, @@ -1079,7 +1079,7 @@ parse_toplevel_element (GMarkupParseContext *context, if (rounded_bottom_right) info->layout->bottom_right_corner_rounded_radius = rounded_bottom_right_val; - + meta_theme_insert_layout (info->theme, name, info->layout); push_state (info, STATE_FRAME_GEOMETRY); @@ -1189,16 +1189,16 @@ parse_toplevel_element (GMarkupParseContext *context, if (alpha != NULL) { - + gboolean success; MetaAlphaGradientSpec *alpha_vector; - + g_clear_error (error); /* fortunately, we already have a routine to parse alpha values, * though it produces a vector of them, which is a superset of * what we want. */ - success = parse_alpha (alpha, &alpha_vector, context, error); + success = parse_alpha (alpha, &alpha_vector, context, error); if (!success) return; @@ -1314,7 +1314,7 @@ parse_toplevel_element (GMarkupParseContext *context, * for backwards compatibility. */ g_assert (info->op_list == NULL); - + push_state (info, STATE_MENU_ICON); } else if (ELEMENT_IS ("fallback")) @@ -1408,7 +1408,7 @@ parse_distance (GMarkupParseContext *context, const char *name; const char *value; int val; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!name", &name, "!value", &value, @@ -1437,13 +1437,13 @@ parse_distance (GMarkupParseContext *context, else if (strcmp (name, "button_width") == 0) { info->layout->button_width = val; - + if (!(info->layout->button_sizing == META_BUTTON_SIZING_LAST || info->layout->button_sizing == META_BUTTON_SIZING_FIXED)) { set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, _("Cannot specify both \"button_width\"/\"button_height\" and \"aspect_ratio\" for buttons")); - return; + return; } info->layout->button_sizing = META_BUTTON_SIZING_FIXED; @@ -1451,13 +1451,13 @@ parse_distance (GMarkupParseContext *context, else if (strcmp (name, "button_height") == 0) { info->layout->button_height = val; - + if (!(info->layout->button_sizing == META_BUTTON_SIZING_LAST || info->layout->button_sizing == META_BUTTON_SIZING_FIXED)) { set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, _("Cannot specify both \"button_width\"/\"button_height\" and \"aspect_ratio\" for buttons")); - return; + return; } info->layout->button_sizing = META_BUTTON_SIZING_FIXED; @@ -1481,7 +1481,7 @@ parse_aspect_ratio (GMarkupParseContext *context, const char *name; const char *value; double val; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!name", &name, "!value", &value, @@ -1493,7 +1493,7 @@ parse_aspect_ratio (GMarkupParseContext *context, return; g_assert (info->layout); - + if (strcmp (name, "button") == 0) { info->layout->button_aspect = val; @@ -1504,7 +1504,7 @@ parse_aspect_ratio (GMarkupParseContext *context, _("Cannot specify both \"button_width\"/\"button_height\" and \"aspect_ratio\" for buttons")); return; } - + info->layout->button_sizing = META_BUTTON_SIZING_ASPECT; } else @@ -1533,7 +1533,7 @@ parse_border (GMarkupParseContext *context, int left_val; int right_val; GtkBorder *border; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!name", &name, @@ -1543,7 +1543,7 @@ parse_border (GMarkupParseContext *context, "!right", &right, NULL)) return; - + top_val = 0; if (!parse_positive_integer (top, &top_val, context, info->theme, error)) return; @@ -1559,11 +1559,11 @@ parse_border (GMarkupParseContext *context, right_val = 0; if (!parse_positive_integer (right, &right_val, context, info->theme, error)) return; - + g_assert (info->layout); border = NULL; - + if (strcmp (name, "title_border") == 0) border = &info->layout->title_border; else if (strcmp (name, "button_border") == 0) @@ -1639,7 +1639,7 @@ check_expression (PosToken *tokens, * it's possible we should instead guarantee that widths and heights * are at least 1. */ - + env.rect = meta_rect (0, 0, 0, 0); if (has_object) { @@ -1658,13 +1658,13 @@ check_expression (PosToken *tokens, env.bottom_height = 0; env.title_width = 0; env.title_height = 0; - + env.icon_width = 0; env.icon_height = 0; env.mini_icon_width = 0; env.mini_icon_height = 0; env.theme = theme; - + if (!meta_parse_position_expression (tokens, n_tokens, &env, &x, &y, @@ -1685,7 +1685,7 @@ parse_draw_op_element (GMarkupParseContext *context, const gchar **attribute_values, ParseInfo *info, GError **error) -{ +{ g_return_if_fail (peek_state (info) == STATE_DRAW_OPS); if (ELEMENT_IS ("line")) @@ -1703,7 +1703,7 @@ parse_draw_op_element (GMarkupParseContext *context, int dash_on_val; int dash_off_val; int width_val; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!color", &color, @@ -1724,11 +1724,11 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (x2, FALSE, info->theme, context, error)) return; - + if (!check_expression (y2, FALSE, info->theme, context, error)) return; #endif - + dash_on_val = 0; if (dash_on_length && !parse_positive_integer (dash_on_length, &dash_on_val, context, info->theme, error)) @@ -1753,7 +1753,7 @@ parse_draw_op_element (GMarkupParseContext *context, add_context_to_error (error, context); return; } - + op = meta_draw_op_new (META_DRAW_LINE); op->data.line.color_spec = color_spec; @@ -1776,7 +1776,7 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.line.dash_off_length = dash_off_val; g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_LINE); @@ -1792,7 +1792,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *filled; gboolean filled_val; MetaColorSpec *color_spec; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!color", &color, @@ -1811,7 +1811,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, FALSE, info->theme, context, error)) return; - + if (!check_expression (height, FALSE, info->theme, context, error)) return; #endif @@ -1819,7 +1819,7 @@ parse_draw_op_element (GMarkupParseContext *context, filled_val = FALSE; if (filled && !parse_boolean (filled, &filled_val, context, error)) return; - + /* Check last so we don't have to free it when other * stuff fails */ @@ -1829,20 +1829,20 @@ parse_draw_op_element (GMarkupParseContext *context, add_context_to_error (error, context); return; } - + op = meta_draw_op_new (META_DRAW_RECTANGLE); op->data.rectangle.color_spec = color_spec; op->data.rectangle.x = meta_draw_spec_new (info->theme, x, NULL); op->data.rectangle.y = meta_draw_spec_new (info->theme, y, NULL); op->data.rectangle.width = meta_draw_spec_new (info->theme, width, NULL); - op->data.rectangle.height = meta_draw_spec_new (info->theme, + op->data.rectangle.height = meta_draw_spec_new (info->theme, height, NULL); op->data.rectangle.filled = filled_val; g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_RECTANGLE); @@ -1864,7 +1864,7 @@ parse_draw_op_element (GMarkupParseContext *context, double start_angle_val; double extent_angle_val; MetaColorSpec *color_spec; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!color", &color, @@ -1911,7 +1911,7 @@ parse_draw_op_element (GMarkupParseContext *context, } } -#if 0 +#if 0 if (!check_expression (x, FALSE, info->theme, context, error)) return; @@ -1920,7 +1920,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, FALSE, info->theme, context, error)) return; - + if (!check_expression (height, FALSE, info->theme, context, error)) return; #endif @@ -1929,7 +1929,7 @@ parse_draw_op_element (GMarkupParseContext *context, { if (!parse_angle (from, &start_angle_val, context, error)) return; - + start_angle_val = (180-start_angle_val)/360.0; } else @@ -1937,12 +1937,12 @@ parse_draw_op_element (GMarkupParseContext *context, if (!parse_angle (start_angle, &start_angle_val, context, error)) return; } - + if (extent_angle == NULL) { if (!parse_angle (to, &extent_angle_val, context, error)) return; - + extent_angle_val = ((180-extent_angle_val)/360.0) - start_angle_val; } else @@ -1950,11 +1950,11 @@ parse_draw_op_element (GMarkupParseContext *context, if (!parse_angle (extent_angle, &extent_angle_val, context, error)) return; } - + filled_val = FALSE; if (filled && !parse_boolean (filled, &filled_val, context, error)) return; - + /* Check last so we don't have to free it when other * stuff fails */ @@ -1964,7 +1964,7 @@ parse_draw_op_element (GMarkupParseContext *context, add_context_to_error (error, context); return; } - + op = meta_draw_op_new (META_DRAW_ARC); op->data.arc.color_spec = color_spec; @@ -1977,9 +1977,9 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.arc.filled = filled_val; op->data.arc.start_angle = start_angle_val; op->data.arc.extent_angle = extent_angle_val; - + g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_ARC); @@ -1991,14 +1991,14 @@ parse_draw_op_element (GMarkupParseContext *context, const char *y; const char *width; const char *height; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!x", &x, "!y", &y, "!width", &width, "!height", &height, NULL)) return; - + #if 0 if (!check_expression (x, FALSE, info->theme, context, error)) return; @@ -2008,10 +2008,10 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, FALSE, info->theme, context, error)) return; - + if (!check_expression (height, FALSE, info->theme, context, error)) return; -#endif +#endif op = meta_draw_op_new (META_DRAW_CLIP); op->data.clip.x = meta_draw_spec_new (info->theme, x, NULL); @@ -2020,7 +2020,7 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.clip.height = meta_draw_spec_new (info->theme, height, NULL); g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_CLIP); @@ -2036,7 +2036,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *alpha; MetaAlphaGradientSpec *alpha_spec; MetaColorSpec *color_spec; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!color", &color, @@ -2055,14 +2055,14 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, FALSE, info->theme, context, error)) return; - + if (!check_expression (height, FALSE, info->theme, context, error)) return; #endif alpha_spec = NULL; if (!parse_alpha (alpha, &alpha_spec, context, error)) return; - + /* Check last so we don't have to free it when other * stuff fails */ @@ -2071,11 +2071,11 @@ parse_draw_op_element (GMarkupParseContext *context, { if (alpha_spec) meta_alpha_gradient_spec_free (alpha_spec); - + add_context_to_error (error, context); return; } - + op = meta_draw_op_new (META_DRAW_TINT); op->data.tint.color_spec = color_spec; @@ -2087,7 +2087,7 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.tint.height = meta_draw_spec_new (info->theme, height, NULL); g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_TINT); @@ -2102,7 +2102,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *alpha; MetaAlphaGradientSpec *alpha_spec; MetaGradientType type_val; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!type", &type, @@ -2121,11 +2121,11 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, FALSE, info->theme, context, error)) return; - + if (!check_expression (height, FALSE, info->theme, context, error)) return; #endif - + type_val = meta_gradient_type_from_string (type); if (type_val == META_GRADIENT_LAST) { @@ -2138,13 +2138,13 @@ parse_draw_op_element (GMarkupParseContext *context, alpha_spec = NULL; if (alpha && !parse_alpha (alpha, &alpha_spec, context, error)) return; - + g_assert (info->op == NULL); info->op = meta_draw_op_new (META_DRAW_GRADIENT); info->op->data.gradient.x = meta_draw_spec_new (info->theme, x, NULL); info->op->data.gradient.y = meta_draw_spec_new (info->theme, y, NULL); - info->op->data.gradient.width = meta_draw_spec_new (info->theme, + info->op->data.gradient.width = meta_draw_spec_new (info->theme, width, NULL); info->op->data.gradient.height = meta_draw_spec_new (info->theme, height, NULL); @@ -2152,7 +2152,7 @@ parse_draw_op_element (GMarkupParseContext *context, info->op->data.gradient.gradient_spec = meta_gradient_spec_new (type_val); info->op->data.gradient.alpha_spec = alpha_spec; - + push_state (info, STATE_GRADIENT); /* op gets appended on close tag */ @@ -2175,7 +2175,7 @@ parse_draw_op_element (GMarkupParseContext *context, int h, w, c; int pixbuf_width, pixbuf_height, pixbuf_n_channels, pixbuf_rowstride; guchar *pixbuf_pixels; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!x", &x, "!y", &y, @@ -2185,8 +2185,8 @@ parse_draw_op_element (GMarkupParseContext *context, "fill_type", &fill_type, NULL)) return; - -#if 0 + +#if 0 if (!check_expression (x, TRUE, info->theme, context, error)) return; @@ -2195,7 +2195,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, TRUE, info->theme, context, error)) return; - + if (!check_expression (height, TRUE, info->theme, context, error)) return; #endif @@ -2203,7 +2203,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (fill_type) { fill_type_val = meta_image_fill_type_from_string (fill_type); - + if (((int) fill_type_val) == -1) { set_error (error, context, G_MARKUP_ERROR, @@ -2212,7 +2212,7 @@ parse_draw_op_element (GMarkupParseContext *context, fill_type, element_name); } } - + /* Check last so we don't have to free it when other * stuff fails. * @@ -2230,7 +2230,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (colorize) { colorize_spec = parse_color (info->theme, colorize, error); - + if (colorize_spec == NULL) { add_context_to_error (error, context); @@ -2245,7 +2245,7 @@ parse_draw_op_element (GMarkupParseContext *context, g_object_unref (G_OBJECT (pixbuf)); return; } - + op = meta_draw_op_new (META_DRAW_IMAGE); op->data.image.pixbuf = pixbuf; @@ -2258,7 +2258,7 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.image.alpha_spec = alpha_spec; op->data.image.fill_type = fill_type_val; - + /* Check for vertical & horizontal stripes */ pixbuf_n_channels = gdk_pixbuf_get_n_channels(pixbuf); pixbuf_width = gdk_pixbuf_get_width(pixbuf); @@ -2286,11 +2286,11 @@ parse_draw_op_element (GMarkupParseContext *context, if (h >= pixbuf_height) { - op->data.image.horizontal_stripes = TRUE; + op->data.image.horizontal_stripes = TRUE; } else { - op->data.image.horizontal_stripes = FALSE; + op->data.image.horizontal_stripes = FALSE; } /* Check for vertical stripes */ @@ -2313,15 +2313,15 @@ parse_draw_op_element (GMarkupParseContext *context, if (w >= pixbuf_width) { - op->data.image.vertical_stripes = TRUE; + op->data.image.vertical_stripes = TRUE; } else { - op->data.image.vertical_stripes = FALSE; + op->data.image.vertical_stripes = FALSE; } - + g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_IMAGE); @@ -2341,7 +2341,7 @@ parse_draw_op_element (GMarkupParseContext *context, GtkStateFlags state_val; GtkShadowType shadow_val; GtkArrowType arrow_val; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!state", &state, @@ -2362,7 +2362,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, FALSE, info->theme, context, error)) return; - + if (!check_expression (height, FALSE, info->theme, context, error)) return; #endif @@ -2399,22 +2399,22 @@ parse_draw_op_element (GMarkupParseContext *context, arrow, element_name); return; } - + op = meta_draw_op_new (META_DRAW_GTK_ARROW); op->data.gtk_arrow.x = meta_draw_spec_new (info->theme, x, NULL); op->data.gtk_arrow.y = meta_draw_spec_new (info->theme, y, NULL); op->data.gtk_arrow.width = meta_draw_spec_new (info->theme, width, NULL); - op->data.gtk_arrow.height = meta_draw_spec_new (info->theme, + op->data.gtk_arrow.height = meta_draw_spec_new (info->theme, height, NULL); op->data.gtk_arrow.filled = filled_val; op->data.gtk_arrow.state = state_val; op->data.gtk_arrow.shadow = shadow_val; op->data.gtk_arrow.arrow = arrow_val; - + g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_GTK_ARROW); @@ -2430,7 +2430,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *height; GtkStateFlags state_val; GtkShadowType shadow_val; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!state", &state, @@ -2449,7 +2449,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, FALSE, info->theme, context, error)) return; - + if (!check_expression (height, FALSE, info->theme, context, error)) return; #endif @@ -2472,7 +2472,7 @@ parse_draw_op_element (GMarkupParseContext *context, shadow, element_name); return; } - + op = meta_draw_op_new (META_DRAW_GTK_BOX); op->data.gtk_box.x = meta_draw_spec_new (info->theme, x, NULL); @@ -2482,9 +2482,9 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.gtk_box.state = state_val; op->data.gtk_box.shadow = shadow_val; - + g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_GTK_BOX); @@ -2497,7 +2497,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *y1; const char *y2; GtkStateFlags state_val; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!state", &state, @@ -2525,7 +2525,7 @@ parse_draw_op_element (GMarkupParseContext *context, state, element_name); return; } - + op = meta_draw_op_new (META_DRAW_GTK_VLINE); op->data.gtk_vline.x = meta_draw_spec_new (info->theme, x, NULL); @@ -2533,9 +2533,9 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.gtk_vline.y2 = meta_draw_spec_new (info->theme, y2, NULL); op->data.gtk_vline.state = state_val; - + g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_GTK_VLINE); @@ -2551,7 +2551,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *fill_type; MetaAlphaGradientSpec *alpha_spec; MetaImageFillType fill_type_val; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!x", &x, "!y", &y, @@ -2560,8 +2560,8 @@ parse_draw_op_element (GMarkupParseContext *context, "fill_type", &fill_type, NULL)) return; - -#if 0 + +#if 0 if (!check_expression (x, FALSE, info->theme, context, error)) return; @@ -2570,7 +2570,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (width, FALSE, info->theme, context, error)) return; - + if (!check_expression (height, FALSE, info->theme, context, error)) return; #endif @@ -2587,13 +2587,13 @@ parse_draw_op_element (GMarkupParseContext *context, fill_type, element_name); } } - + alpha_spec = NULL; if (alpha && !parse_alpha (alpha, &alpha_spec, context, error)) return; - + op = meta_draw_op_new (META_DRAW_ICON); - + op->data.icon.x = meta_draw_spec_new (info->theme, x, NULL); op->data.icon.y = meta_draw_spec_new (info->theme, y, NULL); op->data.icon.width = meta_draw_spec_new (info->theme, width, NULL); @@ -2601,9 +2601,9 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.icon.alpha_spec = alpha_spec; op->data.icon.fill_type = fill_type_val; - + g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_ICON); @@ -2616,7 +2616,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *y; const char *ellipsize_width; MetaColorSpec *color_spec; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!color", &color, @@ -2652,7 +2652,7 @@ parse_draw_op_element (GMarkupParseContext *context, add_context_to_error (error, context); return; } - + op = meta_draw_op_new (META_DRAW_TITLE); op->data.title.color_spec = color_spec; @@ -2663,7 +2663,7 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.title.ellipsize_width = meta_draw_spec_new (info->theme, ellipsize_width, NULL); g_assert (info->op_list); - + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_TITLE); @@ -2677,7 +2677,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *width; const char *height; MetaDrawOpList *op_list; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "x", &x, "y", &y, @@ -2689,7 +2689,7 @@ parse_draw_op_element (GMarkupParseContext *context, /* x/y/width/height default to 0,0,width,height - should * probably do this for all the draw ops */ -#if 0 +#if 0 if (x && !check_expression (x, FALSE, info->theme, context, error)) return; @@ -2698,7 +2698,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (width && !check_expression (width, FALSE, info->theme, context, error)) return; - + if (height && !check_expression (height, FALSE, info->theme, context, error)) return; #endif @@ -2715,7 +2715,7 @@ parse_draw_op_element (GMarkupParseContext *context, } g_assert (info->op_list); - + if (op_list == info->op_list || meta_draw_op_list_contains (op_list, info->op_list)) { @@ -2725,15 +2725,15 @@ parse_draw_op_element (GMarkupParseContext *context, name); return; } - + op = meta_draw_op_new (META_DRAW_OP_LIST); meta_draw_op_list_ref (op_list); - op->data.op_list.op_list = op_list; + op->data.op_list.op_list = op_list; op->data.op_list.x = meta_draw_spec_new (info->theme, x ? x : "0", NULL); op->data.op_list.y = meta_draw_spec_new (info->theme, y ? y : "0", NULL); - op->data.op_list.width = meta_draw_spec_new (info->theme, + op->data.op_list.width = meta_draw_spec_new (info->theme, width ? width : "width", NULL); op->data.op_list.height = meta_draw_spec_new (info->theme, @@ -2757,7 +2757,7 @@ parse_draw_op_element (GMarkupParseContext *context, const char *tile_width; const char *tile_height; MetaDrawOpList *op_list; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "x", &x, "y", &y, @@ -2777,7 +2777,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (tile_yoffset && !check_expression (tile_yoffset, FALSE, info->theme, context, error)) return; - + /* x/y/width/height default to 0,0,width,height - should * probably do this for all the draw ops */ @@ -2789,7 +2789,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (width && !check_expression (width, FALSE, info->theme, context, error)) return; - + if (height && !check_expression (height, FALSE, info->theme, context, error)) return; @@ -2798,7 +2798,7 @@ parse_draw_op_element (GMarkupParseContext *context, if (!check_expression (tile_height, FALSE, info->theme, context, error)) return; -#endif +#endif op_list = meta_theme_lookup_draw_op_list (info->theme, name); if (op_list == NULL) @@ -2811,7 +2811,7 @@ parse_draw_op_element (GMarkupParseContext *context, } g_assert (info->op_list); - + if (op_list == info->op_list || meta_draw_op_list_contains (op_list, info->op_list)) { @@ -2821,7 +2821,7 @@ parse_draw_op_element (GMarkupParseContext *context, name); return; } - + op = meta_draw_op_new (META_DRAW_TILE); meta_draw_op_list_ref (op_list); @@ -2843,8 +2843,8 @@ parse_draw_op_element (GMarkupParseContext *context, op->data.tile.tile_width = meta_draw_spec_new (info->theme, tile_width, NULL); op->data.tile.tile_height = meta_draw_spec_new (info->theme, tile_height, NULL); - op->data.tile.op_list = op_list; - + op->data.tile.op_list = op_list; + meta_draw_op_list_append (info->op_list, op); push_state (info, STATE_TILE); @@ -2892,7 +2892,7 @@ parse_gradient_element (GMarkupParseContext *context, info->op->data.gradient.gradient_spec->color_specs = g_slist_append (info->op->data.gradient.gradient_spec->color_specs, color_spec); - + push_state (info, STATE_COLOR); } else @@ -2915,12 +2915,12 @@ parse_style_element (GMarkupParseContext *context, g_return_if_fail (peek_state (info) == STATE_FRAME_STYLE); g_assert (info->style); - + if (ELEMENT_IS ("piece")) { const char *position = NULL; const char *draw_ops = NULL; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!position", &position, @@ -2936,7 +2936,7 @@ parse_style_element (GMarkupParseContext *context, position); return; } - + if (info->style->pieces[info->piece] != NULL) { set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, @@ -2946,7 +2946,7 @@ parse_style_element (GMarkupParseContext *context, } g_assert (info->op_list == NULL); - + if (draw_ops) { MetaDrawOpList *op_list; @@ -2965,7 +2965,7 @@ parse_style_element (GMarkupParseContext *context, meta_draw_op_list_ref (op_list); info->op_list = op_list; } - + push_state (info, STATE_PIECE); } else if (ELEMENT_IS ("button")) @@ -2974,7 +2974,7 @@ parse_style_element (GMarkupParseContext *context, const char *state = NULL; const char *draw_ops = NULL; gint required_version; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!function", &function, @@ -3013,7 +3013,7 @@ parse_style_element (GMarkupParseContext *context, state); return; } - + if (info->style->buttons[info->button_type][info->button_state] != NULL) { set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, @@ -3023,7 +3023,7 @@ parse_style_element (GMarkupParseContext *context, } g_assert (info->op_list == NULL); - + if (draw_ops) { MetaDrawOpList *op_list; @@ -3042,7 +3042,7 @@ parse_style_element (GMarkupParseContext *context, meta_draw_op_list_ref (op_list); info->op_list = op_list; } - + push_state (info, STATE_BUTTON); } else if (ELEMENT_IS ("shadow")) @@ -3140,7 +3140,7 @@ parse_style_set_element (GMarkupParseContext *context, MetaFrameState frame_state; MetaFrameResize frame_resize; MetaFrameStyle *frame_style; - + if (!locate_attributes (context, element_name, attribute_names, attribute_values, error, "!focus", &focus, @@ -3158,7 +3158,7 @@ parse_style_set_element (GMarkupParseContext *context, focus); return; } - + frame_state = meta_frame_state_from_string (state); if (frame_state == META_FRAME_STATE_LAST) { @@ -3189,7 +3189,7 @@ parse_style_set_element (GMarkupParseContext *context, return; } - + frame_resize = meta_frame_resize_from_string (resize); if (frame_resize == META_FRAME_RESIZE_LAST) { @@ -3198,7 +3198,7 @@ parse_style_set_element (GMarkupParseContext *context, focus); return; } - + break; case META_FRAME_STATE_SHADED: @@ -3237,7 +3237,7 @@ parse_style_set_element (GMarkupParseContext *context, frame_resize = META_FRAME_RESIZE_BOTH; } break; - + default: if (resize != NULL) { @@ -3249,7 +3249,7 @@ parse_style_set_element (GMarkupParseContext *context, frame_resize = META_FRAME_RESIZE_LAST; } - + switch (frame_state) { case META_FRAME_STATE_NORMAL: @@ -3345,7 +3345,7 @@ parse_style_set_element (GMarkupParseContext *context, break; } - push_state (info, STATE_FRAME); + push_state (info, STATE_FRAME); } else { @@ -3375,7 +3375,7 @@ parse_piece_element (GMarkupParseContext *context, _("Can't have a two draw_ops for a <piece> element (theme specified a draw_ops attribute and also a <draw_ops> element, or specified two elements)")); return; } - + if (!check_no_attributes (context, element_name, attribute_names, attribute_values, error)) return; @@ -3403,7 +3403,7 @@ parse_button_element (GMarkupParseContext *context, GError **error) { g_return_if_fail (peek_state (info) == STATE_BUTTON); - + if (ELEMENT_IS ("draw_ops")) { if (info->op_list) @@ -3413,7 +3413,7 @@ parse_button_element (GMarkupParseContext *context, _("Can't have a two draw_ops for a <button> element (theme specified a draw_ops attribute and also a <draw_ops> element, or specified two elements)")); return; } - + if (!check_no_attributes (context, element_name, attribute_names, attribute_values, error)) return; @@ -3483,7 +3483,7 @@ parse_menu_icon_element (GMarkupParseContext *context, _("Can't have a two draw_ops for a <menu_icon> element (theme specified a draw_ops attribute and also a <draw_ops> element, or specified two elements)")); return; } - + if (!check_no_attributes (context, element_name, attribute_names, attribute_values, error)) return; @@ -3665,7 +3665,7 @@ start_element_handler (GMarkupParseContext *context, info->theme->filename = g_strdup (info->theme_file); info->theme->dirname = g_strdup (info->theme_dir); info->theme->format_version = info->format_version; - + push_state (info, STATE_THEME); } else @@ -3822,7 +3822,7 @@ end_element_handler (GMarkupParseContext *context, meta_theme_free (info->theme); info->theme = NULL; } - + pop_state (info); g_assert (peek_state (info) == STATE_START); break; @@ -3886,7 +3886,7 @@ end_element_handler (GMarkupParseContext *context, case STATE_DRAW_OPS: { g_assert (info->op_list); - + if (!meta_draw_op_list_validate (info->op_list, error)) { @@ -4102,10 +4102,10 @@ all_whitespace (const char *text, { const char *p; const char *end; - + p = text; end = text + text_len; - + while (p != end) { if (!g_ascii_isspace (*p)) @@ -4131,7 +4131,7 @@ text_handler (GMarkupParseContext *context, if (all_whitespace (text, text_len)) return; - + /* FIXME http://bugzilla.gnome.org/show_bug.cgi?id=70448 would * allow a nice cleanup here. */ diff --git a/src/ui/theme-parser.h b/src/ui/theme-parser.h index dc36dd4a..9ddc333e 100644 --- a/src/ui/theme-parser.h +++ b/src/ui/theme-parser.h @@ -2,9 +2,9 @@ /* Metacity theme parsing */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ diff --git a/src/ui/theme-viewer.c b/src/ui/theme-viewer.c index 9c7a2649..e6145219 100644 --- a/src/ui/theme-viewer.c +++ b/src/ui/theme-viewer.c @@ -174,7 +174,7 @@ normal_contents (void) GtkWidget *contents; GtkWidget *sw; GtkBuilder *builder; - + grid = gtk_grid_new (); builder = gtk_builder_new_from_string (xml, -1); @@ -200,7 +200,7 @@ normal_contents (void) gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); - + gtk_grid_attach (GTK_GRID (grid), sw, 0, 2, 1, 1); gtk_widget_set_hexpand (sw, TRUE); @@ -209,7 +209,7 @@ normal_contents (void) contents = gtk_text_view_new (); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents), PANGO_WRAP_WORD); - + gtk_container_add (GTK_CONTAINER (sw), contents); @@ -244,19 +244,19 @@ dialog_contents (void) GtkWidget *label; GtkWidget *image; GtkWidget *button; - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); action_area = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area), - GTK_BUTTONBOX_END); + GTK_BUTTONBOX_END); button = gtk_button_new_with_label (_("OK")); gtk_box_pack_end (GTK_BOX (action_area), button, FALSE, TRUE, 0); - + gtk_box_pack_end (GTK_BOX (vbox), action_area, FALSE, TRUE, 0); @@ -266,10 +266,10 @@ dialog_contents (void) image = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_DIALOG); gtk_widget_set_halign (image, GTK_ALIGN_CENTER); gtk_widget_set_valign (image, GTK_ALIGN_START); - + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_selectable (GTK_LABEL (label), TRUE); - + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (hbox), image, @@ -305,11 +305,11 @@ utility_contents (void) char *str; str = g_strdup_printf ("_%c", (char) ('A' + 4*i + j)); - + button = gtk_button_new_with_mnemonic (str); g_free (str); - + gtk_grid_attach (GTK_GRID (grid), button, i, j, 1, 1); ++j; @@ -319,7 +319,7 @@ utility_contents (void) } gtk_widget_show_all (grid); - + return grid; } @@ -327,7 +327,7 @@ static GtkWidget* menu_contents (void) { GtkWidget *vbox; - GtkWidget *mi; + GtkWidget *mi; int i; GtkWidget *frame; @@ -346,14 +346,14 @@ menu_contents (void) gtk_widget_set_valign (mi, GTK_ALIGN_CENTER); g_free (str); gtk_box_pack_start (GTK_BOX (vbox), mi, FALSE, FALSE, 0); - + ++i; } gtk_container_add (GTK_CONTAINER (frame), vbox); - + gtk_widget_show_all (frame); - + return frame; } @@ -372,19 +372,19 @@ border_only_contents (void) color.blue = 0.6; color.alpha = 1.0; gtk_widget_override_background_color (event_box, 0, &color); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), 3); - + w = gtk_label_new (_("Border-only window")); gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); w = gtk_button_new_with_label (_("Bar")); gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (event_box), vbox); - + gtk_widget_show_all (event_box); - + return event_box; } @@ -444,7 +444,7 @@ get_window_flags (MetaFrameType type) META_FRAME_HAS_FOCUS | META_FRAME_ALLOWS_SHADE | META_FRAME_ALLOWS_MOVE; - + switch (type) { case META_FRAME_TYPE_NORMAL: @@ -475,8 +475,8 @@ get_window_flags (MetaFrameType type) case META_FRAME_TYPE_LAST: g_assert_not_reached (); break; - } - + } + return flags; } @@ -501,7 +501,7 @@ preview_collection (int font_size, eventbox = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (eventbox), box); - + gtk_container_add (GTK_CONTAINER (sw), eventbox); GSimpleActionGroup *action_group = g_simple_action_group_new (); @@ -530,23 +530,23 @@ preview_collection (int font_size, GtkWidget *preview; PangoFontDescription *font_desc; double scale; - + eventbox2 = gtk_event_box_new (); - + preview = meta_preview_new (); - + gtk_container_add (GTK_CONTAINER (eventbox2), preview); - + meta_preview_set_frame_type (META_PREVIEW (preview), i); meta_preview_set_frame_flags (META_PREVIEW (preview), get_window_flags (i)); - + meta_preview_set_theme (META_PREVIEW (preview), global_theme); - + contents = get_window_contents (i, &title); - + meta_preview_set_title (META_PREVIEW (preview), title); - + gtk_container_add (GTK_CONTAINER (preview), contents); if (i == META_FRAME_TYPE_MENU) @@ -559,10 +559,10 @@ preview_collection (int font_size, xalign = 0.5; yalign = 0.5; } - + align = gtk_alignment_new (0.0, 0.0, xalign, yalign); gtk_container_add (GTK_CONTAINER (align), eventbox2); - + gtk_box_pack_start (GTK_BOX (box), align, TRUE, TRUE, 0); switch (font_size) @@ -581,17 +581,17 @@ preview_collection (int font_size, if (scale != 1.0) { font_desc = pango_font_description_new (); - + pango_font_description_set_size (font_desc, MAX (pango_font_description_get_size (base_desc) * scale, 1)); - + gtk_widget_override_font (preview, font_desc); pango_font_description_free (font_desc); } - + previews[font_size*META_FRAME_TYPE_LAST + i] = preview; - + ++i; } @@ -620,13 +620,13 @@ init_layouts (void) } ++i; } - + #ifndef ALLOW_DUPLICATE_BUTTONS i = 0; while (i <= MAX_BUTTONS_PER_CORNER) { int j; - + j = 0; while (j < i) { @@ -638,34 +638,34 @@ init_layouts (void) different_layouts[i].left_buttons[j-i] = (MetaButtonFunction) j; ++j; } - + ++i; } /* Special extra case for no buttons on either side */ different_layouts[i].left_buttons[0] = META_BUTTON_FUNCTION_LAST; different_layouts[i].right_buttons[0] = META_BUTTON_FUNCTION_LAST; - + #else /* FIXME this code is if we allow duplicate buttons, * which we currently do not */ int left; int i; - + left = 0; i = 0; while (left < MAX_BUTTONS_PER_CORNER) { int right; - + right = 0; - + while (right < MAX_BUTTONS_PER_CORNER) { int j; - + static MetaButtonFunction left_functions[MAX_BUTTONS_PER_CORNER] = { META_BUTTON_FUNCTION_MENU, META_BUTTON_FUNCTION_MINIMIZE, @@ -680,7 +680,7 @@ init_layouts (void) }; g_assert (i < BUTTON_LAYOUT_COMBINATIONS); - + j = 0; while (j <= left) { @@ -694,12 +694,12 @@ init_layouts (void) different_layouts[i].right_buttons[j] = right_functions[j]; ++j; } - + ++i; - + ++right; } - + ++left; } #endif @@ -715,13 +715,13 @@ previews_of_button_layouts (void) GdkRGBA desktop_color; int i; GtkWidget *eventbox; - + if (!initted) { init_layouts (); initted = TRUE; } - + sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, @@ -733,7 +733,7 @@ previews_of_button_layouts (void) eventbox = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (eventbox), box); - + gtk_container_add (GTK_CONTAINER (sw), eventbox); desktop_color.red = 0.32; @@ -753,11 +753,11 @@ previews_of_button_layouts (void) char *title; eventbox2 = gtk_event_box_new (); - + preview = meta_preview_new (); - - gtk_container_add (GTK_CONTAINER (eventbox2), preview); - + + gtk_container_add (GTK_CONTAINER (eventbox2), preview); + meta_preview_set_theme (META_PREVIEW (preview), global_theme); title = g_strdup_printf (_("Button layout test %d"), i+1); @@ -766,20 +766,20 @@ previews_of_button_layouts (void) meta_preview_set_button_layout (META_PREVIEW (preview), &different_layouts[i]); - + xalign = 0.5; yalign = 0.5; - + align = gtk_alignment_new (0.0, 0.0, xalign, yalign); gtk_container_add (GTK_CONTAINER (align), eventbox2); - + gtk_box_pack_start (GTK_BOX (box), align, TRUE, TRUE, 0); previews[META_FRAME_TYPE_LAST*FONT_SIZE_LAST + i] = preview; - + ++i; } - + return sw; } @@ -788,7 +788,7 @@ benchmark_summary (void) { char *msg; GtkWidget *label; - + msg = g_strdup_printf (_("%g milliseconds to draw one window frame"), milliseconds_to_draw_frame); label = gtk_label_new (msg); @@ -808,7 +808,7 @@ main (int argc, char **argv) clock_t start, end; GtkWidget *notebook; int i; - + bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR); textdomain(GETTEXT_PACKAGE); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); @@ -825,7 +825,7 @@ main (int argc, char **argv) meta_set_debugging (TRUE); meta_set_verbose (TRUE); } - + start = clock (); err = NULL; if (argc == 1) @@ -852,7 +852,7 @@ main (int argc, char **argv) (end - start) / (double) CLOCKS_PER_SEC); run_theme_benchmark (); - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 350, 350); @@ -872,7 +872,7 @@ main (int argc, char **argv) title); g_free (title); - } + } g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL); @@ -883,7 +883,7 @@ main (int argc, char **argv) g_assert (style); g_assert (font_desc); - + notebook = gtk_notebook_new (); gtk_container_add (GTK_CONTAINER (window), notebook); @@ -892,13 +892,13 @@ main (int argc, char **argv) gtk_notebook_append_page (GTK_NOTEBOOK (notebook), collection, gtk_label_new (_("Normal Title Font"))); - + collection = preview_collection (FONT_SIZE_SMALL, font_desc); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), collection, gtk_label_new (_("Small Title Font"))); - + collection = preview_collection (FONT_SIZE_LARGE, font_desc); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), @@ -927,7 +927,7 @@ main (int argc, char **argv) ++i; } - + gtk_widget_show_all (window); gtk_main (); @@ -999,18 +999,18 @@ run_theme_benchmark (void) int client_height; cairo_t *cr; int inc; - + widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_realize (widget); - + meta_theme_get_frame_borders (global_theme, META_FRAME_TYPE_NORMAL, get_text_height (widget), get_flags (widget), &borders); - + layout = create_title_layout (widget); - + i = 0; while (i < MAX_BUTTONS_PER_CORNER) { @@ -1018,7 +1018,7 @@ run_theme_benchmark (void) button_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST; ++i; } - + button_layout.left_buttons[0] = META_BUTTON_FUNCTION_MENU; button_layout.right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE; @@ -1033,7 +1033,7 @@ run_theme_benchmark (void) inc = 1000 / ITERATIONS; /* Increment to grow width/height, * eliminates caching effects. */ - + i = 0; while (i < ITERATIONS) { @@ -1061,7 +1061,7 @@ run_theme_benchmark (void) cairo_destroy (cr); cairo_surface_destroy (pixmap); - + ++i; client_width += inc; client_height += inc; @@ -1071,7 +1071,7 @@ run_theme_benchmark (void) g_timer_stop (timer); milliseconds_to_draw_frame = (g_timer_elapsed (timer, NULL) / (double) ITERATIONS) * 1000; - + g_print (_("Drew %d frames in %g client-side seconds (%g milliseconds per frame) and %g seconds wall clock time including X server resources (%g milliseconds per frame)\n"), ITERATIONS, ((double)end - (double)start) / CLOCKS_PER_SEC, @@ -1265,7 +1265,7 @@ run_position_expression_tests (void) test->expr, test->expected_x, test->expected_y); err = NULL; - + env.rect = meta_rect (test->rect.x, test->rect.y, test->rect.width, test->rect.height); env.object_width = -1; diff --git a/src/ui/theme.c b/src/ui/theme.c index 002ec683..d637d7ac 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -108,14 +108,14 @@ colorize_pixbuf (GdkPixbuf *orig, gboolean has_alpha; const guchar *src_pixels; guchar *dest_pixels; - + pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (orig), gdk_pixbuf_get_has_alpha (orig), gdk_pixbuf_get_bits_per_sample (orig), gdk_pixbuf_get_width (orig), gdk_pixbuf_get_height (orig)); if (pixbuf == NULL) return NULL; - + orig_rowstride = gdk_pixbuf_get_rowstride (orig); dest_rowstride = gdk_pixbuf_get_rowstride (pixbuf); width = gdk_pixbuf_get_width (pixbuf); @@ -123,7 +123,7 @@ colorize_pixbuf (GdkPixbuf *orig, has_alpha = gdk_pixbuf_get_has_alpha (orig); src_pixels = gdk_pixbuf_get_pixels (orig); dest_pixels = gdk_pixbuf_get_pixels (pixbuf); - + for (y = 0; y < height; y++) { src = src_pixels + y * orig_rowstride; @@ -132,7 +132,7 @@ colorize_pixbuf (GdkPixbuf *orig, for (x = 0; x < width; x++) { double dr, dg, db; - + intensity = INTENSITY (src[0], src[1], src[2]) / 255.0; if (intensity <= 0.5) @@ -149,11 +149,11 @@ colorize_pixbuf (GdkPixbuf *orig, dg = new_color->green + (1.0 - new_color->green) * (intensity - 0.5) * 2.0; db = new_color->blue + (1.0 - new_color->blue) * (intensity - 0.5) * 2.0; } - + dest[0] = CLAMP_UCHAR (255 * dr); dest[1] = CLAMP_UCHAR (255 * dg); dest[2] = CLAMP_UCHAR (255 * db); - + if (has_alpha) { dest[3] = src[3]; @@ -221,7 +221,7 @@ meta_frame_layout_new (void) init_border (&layout->title_border); layout->title_vertical_pad = -1; - + layout->right_titlebar_edge = -1; layout->left_titlebar_edge = -1; @@ -232,7 +232,7 @@ meta_frame_layout_new (void) layout->has_title = TRUE; layout->title_scale = 1.0; - + init_border (&layout->button_border); return layout; @@ -246,7 +246,7 @@ validate_border (const GtkBorder *border, const char **bad) { *bad = NULL; - + if (border->top < 0) *bad = _("top"); else if (border->bottom < 0) @@ -402,12 +402,12 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout, MetaFrameBorders *borders) { int buttons_height, title_height; - + g_return_if_fail (layout != NULL); if (!layout->has_title) text_height = 0; - + buttons_height = layout->button_height + layout->button_border.top + layout->button_border.bottom; title_height = text_height + @@ -469,7 +469,7 @@ rect_for_function (MetaFrameGeometry *fgeom, { /* Firstly, check version-specific things. */ - + if (META_THEME_ALLOWS(theme, META_THEME_SHADE_STICK_ABOVE_BUTTONS)) { switch (function) @@ -543,7 +543,7 @@ rect_for_function (MetaFrameGeometry *fgeom, * be well. */ return NULL; - + case META_BUTTON_FUNCTION_LAST: return NULL; } @@ -558,7 +558,7 @@ strip_button (MetaButtonSpace *func_rects[MAX_BUTTONS_PER_CORNER], MetaButtonSpace *to_strip) { int i; - + i = 0; while (i < *n_rects) { @@ -577,7 +577,7 @@ strip_button (MetaButtonSpace *func_rects[MAX_BUTTONS_PER_CORNER], func_rects[i] = NULL; bg_rects[i] = NULL; - + return TRUE; } @@ -604,7 +604,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, int width, height; int button_width, button_height; int min_size_for_rounding; - + /* the left/right rects in order; the max # of rects * is the number of button functions */ @@ -642,7 +642,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, /* gcc warnings */ button_width = -1; button_height = -1; - + switch (layout->button_sizing) { case META_BUTTON_SIZING_ASPECT: @@ -663,11 +663,11 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, * code in frames.c, so isn't really allowed right now. * Would need left_close_rect, right_close_rect, etc. */ - + /* Init all button rects to 0, lame hack */ memset (ADDRESS_OF_BUTTON_RECTS (fgeom), '\0', LENGTH_OF_BUTTON_RECTS); - + n_left = 0; n_right = 0; n_left_spacers = 0; @@ -690,7 +690,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, ++n_left; } } - + for (i = 0; i < MAX_BUTTONS_PER_CORNER && button_layout->right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++) { right_func_rects[n_right] = rect_for_function (fgeom, flags, @@ -736,7 +736,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, else right_bg_rects[i] = &fgeom->right_middle_backgrounds[i - 1]; } - + /* Be sure buttons fit */ while (n_left > 0 || n_right > 0) { @@ -744,7 +744,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, int space_available; space_available = fgeom->width - layout->left_titlebar_edge - layout->right_titlebar_edge; - + space_used_by_buttons = 0; space_used_by_buttons += button_width * n_left; @@ -759,7 +759,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, if (space_used_by_buttons <= space_available) break; /* Everything fits, bail out */ - + /* First try to remove separators */ if (n_left_spacers > 0) { @@ -836,7 +836,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, /* right edge of farthest-right button */ x = width - layout->right_titlebar_edge; - + i = n_right - 1; while (i >= 0) { @@ -844,7 +844,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, if (x < 0) /* if we go negative, leave the buttons we don't get to as 0-width */ break; - + rect = right_func_rects[i]; rect->visible.x = x - layout->button_border.right - button_width; if (right_buttons_has_spacer[i]) @@ -871,9 +871,9 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable)); *(right_bg_rects[i]) = rect->visible; - + x = rect->visible.x - layout->button_border.left; - + --i; } @@ -889,7 +889,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, MetaButtonSpace *rect; rect = left_func_rects[i]; - + rect->visible.x = x + layout->button_border.left; rect->visible.y = button_y; rect->visible.width = button_width; @@ -932,7 +932,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, min_size_for_rounding = 0; else min_size_for_rounding = 5; - + fgeom->top_left_corner_rounded_radius = 0; fgeom->top_right_corner_rounded_radius = 0; fgeom->bottom_left_corner_rounded_radius = 0; @@ -975,7 +975,7 @@ meta_gradient_spec_free (MetaGradientSpec *spec) g_slist_foreach (spec->color_specs, free_color_spec, NULL); g_slist_free (spec->color_specs); - + DEBUG_FILL_STRUCT (spec); g_free (spec); } @@ -1023,7 +1023,7 @@ meta_gradient_spec_validate (MetaGradientSpec *spec, GError **error) { g_return_val_if_fail (spec != NULL, FALSE); - + if (g_slist_length (spec->color_specs) < 2) { g_set_error (error, META_THEME_ERROR, @@ -1042,7 +1042,7 @@ meta_alpha_gradient_spec_new (MetaGradientType type, MetaAlphaGradientSpec *spec; g_return_val_if_fail (n_alphas > 0, NULL); - + spec = g_new0 (MetaAlphaGradientSpec, 1); spec->type = type; @@ -1065,7 +1065,7 @@ MetaShadowProperties* meta_shadow_properties_new (void) { MetaShadowProperties *properties; - + properties = g_new0 (MetaShadowProperties, 1); if (properties) @@ -1092,7 +1092,7 @@ MetaInvisibleGrabAreaProperties* meta_invisible_grab_area_properties_new (void) { MetaInvisibleGrabAreaProperties *properties; - + properties = g_new0 (MetaInvisibleGrabAreaProperties, 1); return properties; @@ -1193,7 +1193,7 @@ meta_color_spec_new_from_string (const char *str, MetaColorSpec *spec; spec = NULL; - + if (strncmp (str, "gtk:custom", 10) == 0) { const char *color_name_start, *fallback_str_start, *end; @@ -1276,7 +1276,7 @@ meta_color_spec_new_from_string (const char *str, char *tmp; GtkStateFlags state; MetaGtkColorComponent component; - + bracket = str; while (*bracket && *bracket != '[') ++bracket; @@ -1294,7 +1294,7 @@ meta_color_spec_new_from_string (const char *str, ++end_bracket; while (*end_bracket && *end_bracket != ']') ++end_bracket; - + if (*end_bracket == '\0') { g_set_error (err, META_THEME_ERROR, @@ -1316,7 +1316,7 @@ meta_color_spec_new_from_string (const char *str, return NULL; } g_free (tmp); - + tmp = g_strndup (str + 4, bracket - str - 4); component = meta_color_component_from_string (tmp); if (component == META_GTK_COLOR_LAST) @@ -1343,9 +1343,9 @@ meta_color_spec_new_from_string (const char *str, char *end; MetaColorSpec *fg; MetaColorSpec *bg; - + split = g_strsplit (str, "/", 4); - + if (split[0] == NULL || split[1] == NULL || split[2] == NULL || split[3] == NULL) { @@ -1377,7 +1377,7 @@ meta_color_spec_new_from_string (const char *str, g_strfreev (split); return NULL; } - + fg = NULL; bg = NULL; @@ -1397,7 +1397,7 @@ meta_color_spec_new_from_string (const char *str, } g_strfreev (split); - + spec = meta_color_spec_new (META_COLOR_SPEC_BLEND); spec->data.blend.alpha = alpha; spec->data.blend.background = bg; @@ -1410,9 +1410,9 @@ meta_color_spec_new_from_string (const char *str, double factor; char *end; MetaColorSpec *base; - + split = g_strsplit (str, "/", 3); - + if (split[0] == NULL || split[1] == NULL || split[2] == NULL) { @@ -1444,7 +1444,7 @@ meta_color_spec_new_from_string (const char *str, g_strfreev (split); return NULL; } - + base = NULL; base = meta_color_spec_new_from_string (split[1], err); @@ -1455,7 +1455,7 @@ meta_color_spec_new_from_string (const char *str, } g_strfreev (split); - + spec = meta_color_spec_new (META_COLOR_SPEC_SHADE); spec->data.shade.factor = factor; spec->data.shade.base = base; @@ -1463,7 +1463,7 @@ meta_color_spec_new_from_string (const char *str, else { spec = meta_color_spec_new (META_COLOR_SPEC_BASIC); - + if (!gdk_rgba_parse (&spec->data.basic.color, str)) { g_set_error (err, META_THEME_ERROR, @@ -1476,7 +1476,7 @@ meta_color_spec_new_from_string (const char *str, } g_assert (spec); - + return spec; } @@ -1606,7 +1606,7 @@ meta_color_spec_render (MetaColorSpec *spec, meta_color_spec_render (spec->data.blend.background, context, &bg); meta_color_spec_render (spec->data.blend.foreground, context, &fg); - color_composite (&bg, &fg, spec->data.blend.alpha, + color_composite (&bg, &fg, spec->data.blend.alpha, &spec->data.blend.color); *color = spec->data.blend.color; @@ -1615,10 +1615,10 @@ meta_color_spec_render (MetaColorSpec *spec, case META_COLOR_SPEC_SHADE: { - meta_color_spec_render (spec->data.shade.base, context, + meta_color_spec_render (spec->data.shade.base, context, &spec->data.shade.color); - - gtk_style_shade (&spec->data.shade.color, + + gtk_style_shade (&spec->data.shade.color, &spec->data.shade.color, spec->data.shade.factor); *color = spec->data.shade.color; @@ -1672,7 +1672,7 @@ op_from_string (const char *p, int *len) { *len = 0; - + switch (*p) { case '+': @@ -1833,7 +1833,7 @@ debug_print_tokens (PosToken *tokens, int n_tokens) { int i; - + for (i = 0; i < n_tokens; i++) { PosToken *t = &tokens[i]; @@ -1889,7 +1889,7 @@ pos_tokenize (const char *expr, int n_tokens; int allocated; const char *p; - + *tokens_p = NULL; *n_tokens_p = 0; @@ -1902,7 +1902,7 @@ pos_tokenize (const char *expr, { PosToken *next; int len; - + if (n_tokens == allocated) { allocated *= 2; @@ -1932,7 +1932,7 @@ pos_tokenize (const char *expr, META_THEME_ERROR_FAILED, _("Coordinate expression contained unknown operator at the start of this text: \"%s\""), p); - + goto error; } break; @@ -1949,7 +1949,7 @@ pos_tokenize (const char *expr, case ' ': case '\t': - case '\n': + case '\n': break; default: @@ -2389,7 +2389,7 @@ pos_eval_get_variable (PosToken *t, return FALSE; } } - else + else { if (strcmp (t->d.v.name, "width") == 0) *result = env->rect.width; @@ -2446,7 +2446,7 @@ pos_eval_get_variable (PosToken *t, * \param n_tokens How many tokens are in the list. * \param env The environment context in which to evaluate the expression. * \param[out] result The current value of the expression - * + * * \bug Yes, we really do reparse the expression every time it's evaluated. * We should keep the parse tree around all the time and just * run the new values through it. @@ -2467,7 +2467,7 @@ pos_eval_helper (PosToken *tokens, PosExpr exprs[MAX_EXPRS]; int n_exprs; int precedence; - + /* Our first goal is to get a list of PosExpr, essentially * substituting variables and handling parentheses. */ @@ -2524,7 +2524,7 @@ pos_eval_helper (PosToken *tokens, */ if (!pos_eval_get_variable (t, &exprs[n_exprs].d.int_val, env, err)) return FALSE; - + ++n_exprs; break; @@ -2712,7 +2712,7 @@ meta_parse_size_expression (MetaDrawSpec *spec, if (spec->constant) val = spec->value; - else + else { if (pos_eval (spec, env, &spec->value, err) == FALSE) { @@ -2745,11 +2745,11 @@ meta_theme_replace_constants (MetaTheme *theme, double dval; int ival; gboolean is_constant = TRUE; - + /* Loop through tokenized string looking for variables to replace */ for (i = 0; i < n_tokens; i++) { - PosToken *t = &tokens[i]; + PosToken *t = &tokens[i]; if (t->type == POS_TOKEN_VARIABLE) { @@ -2765,17 +2765,17 @@ meta_theme_replace_constants (MetaTheme *theme, t->type = POS_TOKEN_DOUBLE; t->d.d.val = dval; } - else + else { /* If we've found a variable that cannot be replaced then the - expression is not a constant expression and we want to + expression is not a constant expression and we want to replace it with a GQuark */ t->d.v.name_quark = g_quark_from_string (t->d.v.name); is_constant = FALSE; } } - } + } return is_constant; } @@ -2793,10 +2793,10 @@ parse_x_position_unchecked (MetaDrawSpec *spec, { meta_warning (_("Theme contained an expression that resulted in an error: %s\n"), error->message); - + g_error_free (error); } - + return retval; } @@ -2858,10 +2858,10 @@ meta_draw_spec_new (MetaTheme *theme, spec = g_slice_new0 (MetaDrawSpec); pos_tokenize (expr, &spec->tokens, &spec->n_tokens, NULL); - - spec->constant = meta_theme_replace_constants (theme, spec->tokens, + + spec->constant = meta_theme_replace_constants (theme, spec->tokens, spec->n_tokens, NULL); - if (spec->constant) + if (spec->constant) { gboolean result; @@ -2872,7 +2872,7 @@ meta_draw_spec_new (MetaTheme *theme, return NULL; } } - + return spec; } @@ -2902,7 +2902,7 @@ meta_draw_op_new (MetaDrawType type) case META_DRAW_CLIP: size += sizeof (dummy.data.clip); break; - + case META_DRAW_TINT: size += sizeof (dummy.data.tint); break; @@ -2992,7 +2992,7 @@ meta_draw_op_free (MetaDrawOp *op) meta_draw_spec_free (op->data.clip.width); meta_draw_spec_free (op->data.clip.height); break; - + case META_DRAW_TINT: if (op->data.tint.color_spec) meta_color_spec_free (op->data.tint.color_spec); @@ -3113,15 +3113,15 @@ apply_alpha (GdkPixbuf *pixbuf, { GdkPixbuf *new_pixbuf; gboolean needs_alpha; - + g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); - + needs_alpha = spec && (spec->n_alphas > 1 || spec->alphas[0] != 0xff); if (!needs_alpha) return pixbuf; - + if (!gdk_pixbuf_get_has_alpha (pixbuf)) { new_pixbuf = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0); @@ -3134,11 +3134,11 @@ apply_alpha (GdkPixbuf *pixbuf, g_object_unref (G_OBJECT (pixbuf)); pixbuf = new_pixbuf; } - + g_assert (gdk_pixbuf_get_has_alpha (pixbuf)); meta_gradient_add_alpha (pixbuf, spec->alphas, spec->n_alphas, spec->type); - + return pixbuf; } @@ -3151,10 +3151,10 @@ pixbuf_tile (GdkPixbuf *tile, int tile_width; int tile_height; int i, j; - + tile_width = gdk_pixbuf_get_width (tile); tile_height = gdk_pixbuf_get_height (tile); - + pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, gdk_pixbuf_get_has_alpha (tile), 8, width, height); @@ -3169,7 +3169,7 @@ pixbuf_tile (GdkPixbuf *tile, w = MIN (tile_width, width - i); h = MIN (tile_height, height - j); - + gdk_pixbuf_copy_area (tile, 0, 0, w, h, @@ -3178,10 +3178,10 @@ pixbuf_tile (GdkPixbuf *tile, j += tile_height; } - + i += tile_width; } - + return pixbuf; } @@ -3205,7 +3205,7 @@ replicate_rows (GdkPixbuf *src, width, height); dest_rowstride = gdk_pixbuf_get_rowstride (result); dest_pixels = gdk_pixbuf_get_pixels (result); - + for (i = 0; i < height; i++) memcpy (dest_pixels + dest_rowstride * i, pixels, n_channels * width); @@ -3241,18 +3241,18 @@ replicate_cols (GdkPixbuf *src, unsigned char r = *(q++); unsigned char g = *(q++); unsigned char b = *(q++); - + if (n_channels == 4) { unsigned char a; - + a = *(q++); - + for (j = 0; j < width; j++) { *(p++) = r; *(p++) = g; - *(p++) = b; + *(p++) = b; *(p++) = a; } } @@ -3348,7 +3348,7 @@ scale_and_alpha_pixbuf (GdkPixbuf *src, pixbuf = replicate_rows (temp_pixbuf, 0, 0, width, height); g_object_unref (G_OBJECT (temp_pixbuf)); } - else + else { pixbuf = temp_pixbuf; } @@ -3357,7 +3357,7 @@ scale_and_alpha_pixbuf (GdkPixbuf *src, if (pixbuf) pixbuf = apply_alpha (pixbuf, alpha_spec, pixbuf == src); - + return pixbuf; } @@ -3403,7 +3403,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op, case META_DRAW_CLIP: break; - + case META_DRAW_TINT: { GdkRGBA color; @@ -3418,7 +3418,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op, op->data.tint.alpha_spec && (op->data.tint.alpha_spec->n_alphas > 1 || op->data.tint.alpha_spec->alphas[0] != 0xff); - + pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, has_alpha, 8, width, height); @@ -3426,7 +3426,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op, if (!has_alpha) { rgba = GDK_COLOR_RGBA (color); - + gdk_pixbuf_fill (pixbuf, rgba); } else if (op->data.tint.alpha_spec->n_alphas == 1) @@ -3434,13 +3434,13 @@ draw_op_as_pixbuf (const MetaDrawOp *op, rgba = GDK_COLOR_RGBA (color); rgba &= ~0xff; rgba |= op->data.tint.alpha_spec->alphas[0]; - + gdk_pixbuf_fill (pixbuf, rgba); } else { rgba = GDK_COLOR_RGBA (color); - + gdk_pixbuf_fill (pixbuf, rgba); meta_gradient_add_alpha (pixbuf, @@ -3462,7 +3462,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op, } break; - + case META_DRAW_IMAGE: { if (op->data.image.colorize_spec) @@ -3471,13 +3471,13 @@ draw_op_as_pixbuf (const MetaDrawOp *op, meta_color_spec_render (op->data.image.colorize_spec, context, &color); - + if (op->data.image.colorize_cache_pixbuf == NULL || op->data.image.colorize_cache_pixel != GDK_COLOR_RGB (color)) { if (op->data.image.colorize_cache_pixbuf) g_object_unref (G_OBJECT (op->data.image.colorize_cache_pixbuf)); - + /* const cast here */ ((MetaDrawOp*)op)->data.image.colorize_cache_pixbuf = colorize_pixbuf (op->data.image.pixbuf, @@ -3485,7 +3485,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op, ((MetaDrawOp*)op)->data.image.colorize_cache_pixel = GDK_COLOR_RGB (color); } - + if (op->data.image.colorize_cache_pixbuf) { pixbuf = scale_and_alpha_pixbuf (op->data.image.colorize_cache_pixbuf, @@ -3507,7 +3507,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op, } break; } - + case META_DRAW_GTK_ARROW: case META_DRAW_GTK_BOX: case META_DRAW_GTK_VLINE: @@ -3571,7 +3571,7 @@ fill_env (MetaPositionExprEnv *env, env->frame_x_center = 0; env->frame_y_center = 0; } - + env->mini_icon_width = info->mini_icon ? gdk_pixbuf_get_width (info->mini_icon) : 0; env->mini_icon_height = info->mini_icon ? gdk_pixbuf_get_height (info->mini_icon) : 0; env->icon_width = info->icon ? gdk_pixbuf_get_width (info->icon) : 0; @@ -3630,7 +3630,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op, } x1 = parse_x_position_unchecked (op->data.line.x1, env); - y1 = parse_y_position_unchecked (op->data.line.y1, env); + y1 = parse_y_position_unchecked (op->data.line.y1, env); if (!op->data.line.x2 && !op->data.line.y2 && @@ -3757,16 +3757,16 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op, case META_DRAW_CLIP: break; - + case META_DRAW_TINT: { int rx, ry, rwidth, rheight; gboolean needs_alpha; - + needs_alpha = op->data.tint.alpha_spec && (op->data.tint.alpha_spec->n_alphas > 1 || op->data.tint.alpha_spec->alphas[0] != 0xff); - + rx = parse_x_position_unchecked (op->data.tint.x, env); ry = parse_y_position_unchecked (op->data.tint.y, env); rwidth = parse_size_unchecked (op->data.tint.width, env); @@ -3834,7 +3834,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op, rwidth = parse_size_unchecked (op->data.image.width, env); rheight = parse_size_unchecked (op->data.image.height, env); - + pixbuf = draw_op_as_pixbuf (op, style_gtk, info, rwidth, rheight); @@ -3908,7 +3908,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op, rx = parse_x_position_unchecked (op->data.gtk_vline.x, env); ry1 = parse_y_position_unchecked (op->data.gtk_vline.y1, env); ry2 = parse_y_position_unchecked (op->data.gtk_vline.y2, env); - + gtk_style_context_set_state (style_gtk, op->data.gtk_vline.state); gtk_render_line (style_gtk, cr, rx, ry1, rx, ry2); } @@ -3921,7 +3921,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op, rwidth = parse_size_unchecked (op->data.icon.width, env); rheight = parse_size_unchecked (op->data.icon.height, env); - + pixbuf = draw_op_as_pixbuf (op, style_gtk, info, rwidth, rheight); @@ -4036,9 +4036,9 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op, case META_DRAW_TILE: { int rx, ry, rwidth, rheight; - int tile_xoffset, tile_yoffset; + int tile_xoffset, tile_yoffset; MetaRectangle tile; - + rx = parse_x_position_unchecked (op->data.tile.x, env); ry = parse_y_position_unchecked (op->data.tile.y, env); rwidth = parse_size_unchecked (op->data.tile.width, env); @@ -4054,12 +4054,12 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op, /* tile offset should not include x/y */ tile_xoffset -= rect.x; tile_yoffset -= rect.y; - + tile.width = parse_size_unchecked (op->data.tile.tile_width, env); tile.height = parse_size_unchecked (op->data.tile.tile_height, env); tile.x = rx - tile_xoffset; - + while (tile.x < (rx + rwidth)) { tile.y = ry - tile_yoffset; @@ -4141,7 +4141,7 @@ meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list, MetaPositionExprEnv env; fill_env (&env, info, rect); - + /* FIXME this can be optimized, potentially a lot, by * compressing multiple ops when possible. For example, * anything convertible to a pixbuf can be composited @@ -4158,18 +4158,18 @@ meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list, for (i = 0; i < op_list->n_ops; i++) { MetaDrawOp *op = op_list->ops[i]; - + if (op->type == META_DRAW_CLIP) { cairo_restore (cr); - cairo_rectangle (cr, + cairo_rectangle (cr, parse_x_position_unchecked (op->data.clip.x, &env), parse_y_position_unchecked (op->data.clip.y, &env), parse_size_unchecked (op->data.clip.width, &env), parse_size_unchecked (op->data.clip.height, &env)); cairo_clip (cr); - + cairo_save (cr); } else if (gdk_cairo_get_clip_rectangle (cr, NULL)) @@ -4224,7 +4224,7 @@ meta_draw_op_list_contains (MetaDrawOpList *op_list, { if (op_list->ops[i]->data.op_list.op_list == child) return TRUE; - + if (meta_draw_op_list_contains (op_list->ops[i]->data.op_list.op_list, child)) return TRUE; @@ -4233,7 +4233,7 @@ meta_draw_op_list_contains (MetaDrawOpList *op_list, { if (op_list->ops[i]->data.tile.op_list == child) return TRUE; - + if (meta_draw_op_list_contains (op_list->ops[i]->data.tile.op_list, child)) return TRUE; @@ -4402,7 +4402,7 @@ get_button (MetaFrameStyle *style, { MetaDrawOpList *op_list; MetaFrameStyle *parent; - + parent = style; op_list = NULL; while (parent && op_list == NULL) @@ -4435,7 +4435,7 @@ get_button (MetaFrameStyle *style, type == META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND)) return get_button (style, META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND, state); - + /* We fall back to normal if no prelight */ if (op_list == NULL && state == META_BUTTON_STATE_PRELIGHT) @@ -4450,7 +4450,7 @@ meta_frame_style_validate (MetaFrameStyle *style, GError **error) { int i, j; - + g_return_val_if_fail (style != NULL, FALSE); g_return_val_if_fail (style->layout != NULL, FALSE); @@ -4475,7 +4475,7 @@ meta_frame_style_validate (MetaFrameStyle *style, } } } - + return TRUE; } @@ -4494,7 +4494,7 @@ button_rect (MetaButtonType type, case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND: *rect = fgeom->left_middle_backgrounds[middle_background_offset]; break; - + case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND: *rect = fgeom->left_right_background; break; @@ -4506,11 +4506,11 @@ button_rect (MetaButtonType type, case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND: *rect = fgeom->right_left_background; break; - + case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND: *rect = fgeom->right_middle_backgrounds[middle_background_offset]; break; - + case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND: *rect = fgeom->right_right_background; break; @@ -4558,7 +4558,7 @@ button_rect (MetaButtonType type, case META_BUTTON_TYPE_MENU: *rect = fgeom->menu_rect.visible; break; - + case META_BUTTON_TYPE_LAST: g_assert_not_reached (); break; @@ -4638,13 +4638,13 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style, draw_info.title_layout_width = title_layout ? extents.width : 0; draw_info.title_layout_height = title_layout ? extents.height : 0; draw_info.fgeom = fgeom; - + /* The enum is in the order the pieces should be rendered. */ i = 0; while (i < META_FRAME_PIECE_LAST) { GdkRectangle rect; - + switch ((MetaFramePiece) i) { case META_FRAME_PIECE_ENTIRE_BACKGROUND: @@ -4755,16 +4755,16 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style, MetaButtonState button_state; button_rect (j, fgeom, middle_bg_offset, &rect); - + button_state = map_button_state (j, fgeom, middle_bg_offset, button_states); op_list = get_button (style, j, button_state); - + if (op_list) { cairo_save (cr); gdk_cairo_rectangle (cr, &rect); cairo_clip (cr); - + if (gdk_cairo_get_clip_rectangle (cr, NULL)) { MetaRectangle m_rect; @@ -4793,7 +4793,7 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style, } } } - + ++i; } } @@ -4821,7 +4821,7 @@ meta_frame_style_set_new (MetaFrameStyleSet *parent) meta_frame_style_set_ref (parent); style_set->refcount = 1; - + return style_set; } @@ -4883,8 +4883,8 @@ get_style (MetaFrameStyleSet *style_set, MetaFrameResize resize, MetaFrameFocus focus) { - MetaFrameStyle *style; - + MetaFrameStyle *style; + style = NULL; switch (state) @@ -4900,7 +4900,7 @@ get_style (MetaFrameStyleSet *style_set, /* Try parent if we failed here */ if (style == NULL && style_set->parent) style = get_style (style_set->parent, state, resize, focus); - + /* Allow people to omit the vert/horz/none resize modes */ if (style == NULL && resize != META_FRAME_RESIZE_BOTH) @@ -4912,7 +4912,7 @@ get_style (MetaFrameStyleSet *style_set, MetaFrameStyle **styles; styles = NULL; - + switch (state) { case META_FRAME_STATE_MAXIMIZED: @@ -4957,7 +4957,7 @@ get_style (MetaFrameStyleSet *style_set, /* Try parent if we failed here */ if (style == NULL && style_set->parent) - style = get_style (style_set->parent, state, resize, focus); + style = get_style (style_set->parent, state, resize, focus); } } @@ -4998,7 +4998,7 @@ meta_frame_style_set_validate (MetaFrameStyleSet *style_set, GError **error) { int i, j; - + g_return_val_if_fail (style_set != NULL, FALSE); for (i = 0; i < META_FRAME_RESIZE_LAST; i++) @@ -5016,13 +5016,13 @@ meta_frame_style_set_validate (MetaFrameStyleSet *style_set, if (!check_state (style_set, META_FRAME_STATE_SHADED, error)) return FALSE; - + if (!check_state (style_set, META_FRAME_STATE_MAXIMIZED, error)) return FALSE; if (!check_state (style_set, META_FRAME_STATE_MAXIMIZED_AND_SHADED, error)) return FALSE; - + return TRUE; } @@ -5040,12 +5040,12 @@ meta_theme_set_current (const char *name, GError *err; meta_topic (META_DEBUG_THEMES, "Setting current theme to \"%s\"\n", name); - + if (!force_reload && meta_current_theme && strcmp (name, meta_current_theme->name) == 0) return; - + err = NULL; new_theme = meta_theme_load (name, &err); @@ -5078,7 +5078,7 @@ meta_theme_new (void) g_str_equal, g_free, (GDestroyNotify) g_object_unref); - + theme->layouts_by_name = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -5102,7 +5102,7 @@ meta_theme_new (void) g_str_equal, g_free, (GDestroyNotify) meta_frame_style_set_unref); - + /* Create our variable quarks so we can look up variables without having to strcmp for the names */ theme->quark_width = g_quark_from_static_string ("width"); @@ -5149,11 +5149,11 @@ meta_theme_free (MetaTheme *theme) g_hash_table_destroy (theme->images_by_filename); if (theme->layouts_by_name) g_hash_table_destroy (theme->layouts_by_name); - if (theme->draw_op_lists_by_name) + if (theme->draw_op_lists_by_name) g_hash_table_destroy (theme->draw_op_lists_by_name); - if (theme->styles_by_name) + if (theme->styles_by_name) g_hash_table_destroy (theme->styles_by_name); - if (theme->style_sets_by_name) + if (theme->style_sets_by_name) g_hash_table_destroy (theme->style_sets_by_name); for (i = 0; i < META_FRAME_TYPE_LAST; i++) @@ -5169,13 +5169,13 @@ meta_theme_validate (MetaTheme *theme, GError **error) { int i; - + g_return_val_if_fail (theme != NULL, FALSE); /* FIXME what else should be checked? */ g_assert (theme->name); - + if (theme->readable_name == NULL) { /* Translators: This error means that a necessary XML tag (whose name @@ -5223,8 +5223,8 @@ meta_theme_validate (MetaTheme *theme, meta_frame_type_to_string (i), theme->name, meta_frame_type_to_string (i)); - - return FALSE; + + return FALSE; } return TRUE; @@ -5243,7 +5243,7 @@ meta_theme_load_image (MetaTheme *theme, if (pixbuf == NULL) { - + if (g_str_has_prefix (filename, "theme:") && META_THEME_ALLOWS (theme, META_THEME_IMAGES_FROM_ICON_THEMES)) { @@ -5259,23 +5259,23 @@ meta_theme_load_image (MetaTheme *theme, { char *full_path; full_path = g_build_filename (theme->dirname, filename, NULL); - + pixbuf = gdk_pixbuf_new_from_file (full_path, error); if (pixbuf == NULL) { g_free (full_path); return NULL; } - + g_free (full_path); - } + } g_hash_table_replace (theme->images_by_filename, g_strdup (filename), pixbuf); } g_assert (pixbuf); - + g_object_ref (G_OBJECT (pixbuf)); return pixbuf; @@ -5304,7 +5304,7 @@ theme_get_style (MetaTheme *theme, style_set = theme->style_sets_by_type[META_FRAME_TYPE_NORMAL]; if (style_set == NULL) return NULL; - + switch (flags & (META_FRAME_MAXIMIZED | META_FRAME_SHADED | META_FRAME_TILED_LEFT | META_FRAME_TILED_RIGHT)) { case 0: @@ -5356,7 +5356,7 @@ theme_get_style (MetaTheme *theme, resize = META_FRAME_RESIZE_LAST; /* compiler */ break; } - + /* re invert the styles used for focus/unfocussed while flashing a frame */ if (((flags & META_FRAME_HAS_FOCUS) && !(flags & META_FRAME_IS_FLASHING)) || (!(flags & META_FRAME_HAS_FOCUS) && (flags & META_FRAME_IS_FLASHING))) @@ -5377,7 +5377,7 @@ meta_theme_get_frame_style (MetaTheme *theme, MetaFrameStyle *style; g_return_val_if_fail (type < META_FRAME_TYPE_LAST, NULL); - + style = theme_get_style (theme, type, flags); return style; @@ -5391,9 +5391,9 @@ meta_theme_get_title_scale (MetaTheme *theme, MetaFrameStyle *style; g_return_val_if_fail (type < META_FRAME_TYPE_LAST, 1.0); - + style = theme_get_style (theme, type, flags); - + /* Parser is not supposed to allow this currently */ if (style == NULL) return 1.0; @@ -5420,20 +5420,20 @@ meta_theme_draw_frame_with_style (MetaTheme *theme, MetaFrameStyle *style; g_return_if_fail (type < META_FRAME_TYPE_LAST); - + style = theme_get_style (theme, type, flags); - + /* Parser is not supposed to allow this currently */ if (style == NULL) return; - + meta_frame_layout_calc_geometry (style->layout, text_height, flags, client_width, client_height, button_layout, &fgeom, - theme); + theme); meta_frame_style_draw_with_style (style, style_gtk, @@ -5507,9 +5507,9 @@ meta_theme_calc_geometry (MetaTheme *theme, MetaFrameStyle *style; g_return_if_fail (type < META_FRAME_TYPE_LAST); - + style = theme_get_style (theme, type, flags); - + /* Parser is not supposed to allow this currently */ if (style == NULL) return; @@ -5589,7 +5589,7 @@ meta_theme_insert_style_set (MetaTheme *theme, static gboolean first_uppercase (const char *str) -{ +{ return g_ascii_isupper (*str); } @@ -5612,13 +5612,13 @@ meta_theme_define_int_constant (MetaTheme *theme, name); return FALSE; } - + if (g_hash_table_lookup_extended (theme->integer_constants, name, NULL, NULL)) { g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED, _("Constant \"%s\" has already been defined"), name); - + return FALSE; } @@ -5637,10 +5637,10 @@ meta_theme_lookup_int_constant (MetaTheme *theme, gpointer old_value; *value = 0; - + if (theme->integer_constants == NULL) return FALSE; - + if (g_hash_table_lookup_extended (theme->integer_constants, name, NULL, &old_value)) { @@ -5660,7 +5660,7 @@ meta_theme_define_float_constant (MetaTheme *theme, GError **error) { double *d; - + if (theme->float_constants == NULL) theme->float_constants = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -5674,19 +5674,19 @@ meta_theme_define_float_constant (MetaTheme *theme, name); return FALSE; } - + if (g_hash_table_lookup_extended (theme->float_constants, name, NULL, NULL)) { g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED, _("Constant \"%s\" has already been defined"), name); - + return FALSE; } d = g_new (double, 1); *d = value; - + g_hash_table_insert (theme->float_constants, g_strdup (name), d); @@ -5701,7 +5701,7 @@ meta_theme_lookup_float_constant (MetaTheme *theme, double *d; *value = 0.0; - + if (theme->float_constants == NULL) return FALSE; @@ -5737,13 +5737,13 @@ meta_theme_define_color_constant (MetaTheme *theme, name); return FALSE; } - + if (g_hash_table_lookup_extended (theme->color_constants, name, NULL, NULL)) { g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED, _("Constant \"%s\" has already been defined"), name); - + return FALSE; } @@ -5771,7 +5771,7 @@ meta_theme_lookup_color_constant (MetaTheme *theme, char *result; *value = NULL; - + if (theme->color_constants == NULL) return FALSE; @@ -5796,7 +5796,7 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget, { GtkStyleContext *style; PangoFontDescription *font_desc; - + g_return_val_if_fail (gtk_widget_get_realized (widget), NULL); style = gtk_widget_get_style_context (widget); @@ -5829,11 +5829,11 @@ meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc, lang = pango_context_get_language (context); metrics = pango_context_get_metrics (context, font_desc, lang); - retval = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + + retval = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics)); - + pango_font_metrics_unref (metrics); - + return retval; } @@ -6281,7 +6281,7 @@ meta_image_fill_type_from_string (const char *str) * \param a the starting colour * \param b [out] the resulting colour * \param k amount to scale lightness and saturation by - */ + */ static void gtk_style_shade (GdkRGBA *a, GdkRGBA *b, @@ -6290,27 +6290,27 @@ gtk_style_shade (GdkRGBA *a, gdouble red; gdouble green; gdouble blue; - + red = a->red; green = a->green; blue = a->blue; - + rgb_to_hls (&red, &green, &blue); - + green *= k; if (green > 1.0) green = 1.0; else if (green < 0.0) green = 0.0; - + blue *= k; if (blue > 1.0) blue = 1.0; else if (blue < 0.0) blue = 0.0; - + hls_to_rgb (&red, &green, &blue); - + b->red = red; b->green = green; b->blue = blue; @@ -6336,18 +6336,18 @@ rgb_to_hls (gdouble *r, gdouble blue; gdouble h, l, s; gdouble delta; - + red = *r; green = *g; blue = *b; - + if (red > green) { if (red > blue) max = red; else max = blue; - + if (green < blue) min = green; else @@ -6359,24 +6359,24 @@ rgb_to_hls (gdouble *r, max = green; else max = blue; - + if (red < blue) min = red; else min = blue; } - + l = (max + min) / 2; s = 0; h = 0; - + if (max != min) { if (l <= 0.5) s = (max - min) / (max + min); else s = (max - min) / (2 - max - min); - + delta = max -min; if (red == max) h = (green - blue) / delta; @@ -6384,12 +6384,12 @@ rgb_to_hls (gdouble *r, h = 2 + (blue - red) / delta; else if (blue == max) h = 4 + (red - green) / delta; - + h *= 60; if (h < 0.0) h += 360; } - + *r = h; *g = l; *b = s; @@ -6412,16 +6412,16 @@ hls_to_rgb (gdouble *h, gdouble saturation; gdouble m1, m2; gdouble r, g, b; - + lightness = *l; saturation = *s; - + if (lightness <= 0.5) m2 = lightness * (1 + saturation); else m2 = lightness + saturation - lightness * saturation; m1 = 2 * lightness - m2; - + if (saturation == 0) { *h = lightness; @@ -6435,7 +6435,7 @@ hls_to_rgb (gdouble *h, hue -= 360; while (hue < 0) hue += 360; - + if (hue < 60) r = m1 + (m2 - m1) * hue / 60; else if (hue < 180) @@ -6444,13 +6444,13 @@ hls_to_rgb (gdouble *h, r = m1 + (m2 - m1) * (240 - hue) / 60; else r = m1; - + hue = *h; while (hue > 360) hue -= 360; while (hue < 0) hue += 360; - + if (hue < 60) g = m1 + (m2 - m1) * hue / 60; else if (hue < 180) @@ -6459,13 +6459,13 @@ hls_to_rgb (gdouble *h, g = m1 + (m2 - m1) * (240 - hue) / 60; else g = m1; - + hue = *h - 120; while (hue > 360) hue -= 360; while (hue < 0) hue += 360; - + if (hue < 60) b = m1 + (m2 - m1) * hue / 60; else if (hue < 180) @@ -6474,7 +6474,7 @@ hls_to_rgb (gdouble *h, b = m1 + (m2 - m1) * (240 - hue) / 60; else b = m1; - + *h = r; *l = g; *s = b; @@ -6505,7 +6505,7 @@ meta_theme_earliest_version_with_button (MetaButtonType type) case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND: case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND: return 1000; - + case META_BUTTON_TYPE_SHADE: case META_BUTTON_TYPE_ABOVE: case META_BUTTON_TYPE_STICK: @@ -6520,6 +6520,6 @@ meta_theme_earliest_version_with_button (MetaButtonType type) default: meta_warning("Unknown button %d\n", type); - return 1000; + return 1000; } } diff --git a/src/ui/theme.h b/src/ui/theme.h index 7b6bacd2..2e97d351 100644 --- a/src/ui/theme.h +++ b/src/ui/theme.h @@ -2,9 +2,9 @@ /* Metacity Theme Rendering */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -14,7 +14,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -32,7 +32,7 @@ typedef struct _MetaFrameStyleSet MetaFrameStyleSet; typedef struct _MetaDrawOp MetaDrawOp; typedef struct _MetaDrawOpList MetaDrawOpList; typedef struct _MetaGradientSpec MetaGradientSpec; -typedef struct _MetaAlphaGradientSpec MetaAlphaGradientSpec; +typedef struct _MetaAlphaGradientSpec MetaAlphaGradientSpec; typedef struct _MetaColorSpec MetaColorSpec; typedef struct _MetaFrameLayout MetaFrameLayout; typedef struct _MetaButtonSpace MetaButtonSpace; @@ -130,14 +130,14 @@ struct _MetaFrameLayout { /** Reference count. */ int refcount; - + /** Size of left side */ int left_width; /** Size of right side */ int right_width; /** Size of bottom side */ int bottom_height; - + /** Border of blue title region * \bug (blue?!) **/ @@ -145,12 +145,12 @@ struct _MetaFrameLayout /** Extra height for inside of title region, above the font height */ int title_vertical_pad; - + /** Right indent of buttons from edges of frame */ int right_titlebar_edge; /** Left indent of buttons from edges of frame */ int left_titlebar_edge; - + /** * Sizing rule of buttons, either META_BUTTON_SIZING_ASPECT * (in which case button_aspect will be honoured, and @@ -166,7 +166,7 @@ struct _MetaFrameLayout * Otherwise we figure out the height from the button_border. */ double button_aspect; - + /** Width of a button; set even when we are using aspect sizing */ int button_width; @@ -178,7 +178,7 @@ struct _MetaFrameLayout /** scale factor for title text */ double title_scale; - + /** Whether title text will be displayed */ guint has_title : 1; @@ -220,7 +220,7 @@ struct _MetaFrameGeometry int bottom_height; int width; - int height; + int height; GdkRectangle title_rect; @@ -232,7 +232,7 @@ struct _MetaFrameGeometry /* used for a memset hack */ #define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect)) #define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_single_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect)) - + /* The button rects (if changed adjust memset hack) */ MetaButtonSpace close_rect; MetaButtonSpace max_rect; @@ -365,14 +365,14 @@ typedef enum /** Clip to a rectangle */ META_DRAW_CLIP, - + /* Texture thingies */ /** Just a filled rectangle with alpha */ META_DRAW_TINT, META_DRAW_GRADIENT, META_DRAW_IMAGE, - + /** GTK theme engine stuff */ META_DRAW_GTK_ARROW, META_DRAW_GTK_BOX, @@ -458,7 +458,7 @@ typedef struct _MetaDrawSpec * otherwise it is zero. */ int value; - + /** A list of tokens in the expression. */ PosToken *tokens; @@ -516,7 +516,7 @@ struct _MetaDrawOp MetaDrawSpec *width; MetaDrawSpec *height; } clip; - + struct { MetaColorSpec *color_spec; MetaAlphaGradientSpec *alpha_spec; @@ -550,7 +550,7 @@ struct _MetaDrawOp unsigned int vertical_stripes : 1; unsigned int horizontal_stripes : 1; } image; - + struct { GtkStateFlags state; GtkShadowType shadow; @@ -576,7 +576,7 @@ struct _MetaDrawOp GtkStateFlags state; MetaDrawSpec *x; MetaDrawSpec *y1; - MetaDrawSpec *y2; + MetaDrawSpec *y2; } gtk_vline; struct { @@ -614,7 +614,7 @@ struct _MetaDrawOp MetaDrawSpec *tile_width; MetaDrawSpec *tile_height; } tile; - + } data; }; @@ -689,7 +689,7 @@ typedef enum * | rather than | * */ - + /* entire frame */ META_FRAME_PIECE_ENTIRE_BACKGROUND, /* entire titlebar background */ @@ -763,7 +763,7 @@ struct _MetaFrameStyle }; /* Kinds of frame... - * + * * normal -> noresize / vert only / horz only / both * focused / unfocused * max -> focused / unfocused @@ -775,7 +775,7 @@ struct _MetaFrameStyle * * 14 window states times 7 or 8 window types. Except some * window types never get a frame so that narrows it down a bit. - * + * */ typedef enum { diff --git a/src/ui/ui.c b/src/ui/ui.c index 2b225ae5..f4a12e03 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -2,10 +2,10 @@ /* Metacity interface for talking to GTK+ UI module */ -/* +/* * Copyright (C) 2002 Havoc Pennington * stock icon code Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.org> - * + * * 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; either version 2 of the @@ -15,7 +15,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -257,7 +257,7 @@ meta_ui_remove_event_func (Display *xdisplay, gpointer data) { g_return_if_fail (ef != NULL); - + gdk_window_remove_filter (NULL, filter_func, ef); g_free (ef); @@ -327,7 +327,7 @@ meta_ui_create_frame_window (MetaUI *ui, gint attributes_mask; GdkWindow *window; GdkVisual *visual; - + /* Default depth/visual handles clients with weird visuals; they can * always be children of the root depth/visual obviously, but * e.g. DRI games can't be children of a parent that has the same @@ -370,7 +370,7 @@ meta_ui_create_frame_window (MetaUI *ui, &attrs, attributes_mask); gdk_window_resize (window, width, height); - + meta_frames_manage_window (ui->frames, GDK_WINDOW_XID (window), window); return GDK_WINDOW_XID (window); @@ -599,7 +599,7 @@ meta_ui_get_default_window_icon (MetaUI *ui) } g_object_ref (G_OBJECT (default_icon)); - + return default_icon; } @@ -632,7 +632,7 @@ meta_ui_get_default_mini_icon (MetaUI *ui) } g_object_ref (G_OBJECT (default_icon)); - + return default_icon; } @@ -663,7 +663,7 @@ meta_text_property_to_utf8 (Display *xdisplay, char **list; int count; char *retval; - + list = NULL; display = gdk_x11_lookup_xdisplay (xdisplay); @@ -681,7 +681,7 @@ meta_text_property_to_utf8 (Display *xdisplay, retval = list[0]; list[0] = g_strdup (""); /* something to free */ } - + g_strfreev (list); return retval; @@ -814,24 +814,24 @@ meta_ui_parse_accelerator (const char *accel, GdkModifierType gdk_mask = 0; guint gdk_sym = 0; guint gdk_code = 0; - + *keysym = 0; *keycode = 0; *mask = 0; if (strcmp (accel, "disabled") == 0) return TRUE; - + meta_ui_accelerator_parse (accel, &gdk_sym, &gdk_code, &gdk_mask); if (gdk_mask == 0 && gdk_sym == 0 && gdk_code == 0) return FALSE; if (gdk_sym == None && gdk_code == 0) return FALSE; - + if (gdk_mask & GDK_RELEASE_MASK) /* we don't allow this */ return FALSE; - + *keysym = gdk_sym; *keycode = gdk_code; @@ -855,7 +855,7 @@ meta_ui_parse_accelerator (const char *accel, *mask |= META_VIRTUAL_HYPER_MASK; if (gdk_mask & GDK_META_MASK) *mask |= META_VIRTUAL_META_MASK; - + return TRUE; } @@ -865,7 +865,7 @@ meta_ui_accelerator_name (unsigned int keysym, MetaVirtualModifier mask) { GdkModifierType mods = 0; - + if (keysym == 0 && mask == 0) { return g_strdup ("disabled"); @@ -903,19 +903,19 @@ meta_ui_parse_modifier (const char *accel, GdkModifierType gdk_mask = 0; guint gdk_sym = 0; guint gdk_code = 0; - + *mask = 0; if (accel == NULL || strcmp (accel, "disabled") == 0) return TRUE; - + meta_ui_accelerator_parse (accel, &gdk_sym, &gdk_code, &gdk_mask); if (gdk_mask == 0 && gdk_sym == 0 && gdk_code == 0) return FALSE; if (gdk_sym != None || gdk_code != 0) return FALSE; - + if (gdk_mask & GDK_RELEASE_MASK) /* we don't allow this */ return FALSE; @@ -939,7 +939,7 @@ meta_ui_parse_modifier (const char *accel, *mask |= META_VIRTUAL_HYPER_MASK; if (gdk_mask & GDK_META_MASK) *mask |= META_VIRTUAL_META_MASK; - + return TRUE; } diff --git a/src/wm-tester/focus-window.c b/src/wm-tester/focus-window.c index dc33bd25..01cb4d3e 100644 --- a/src/wm-tester/focus-window.c +++ b/src/wm-tester/focus-window.c @@ -9,18 +9,18 @@ int main (int argc, char **argv) Window w; const char *w_str; char *end; - + if (argc != 2) { fprintf (stderr, "Usage: focus-window WINDOWID\n"); exit (1); } - + d = XOpenDisplay (NULL); w_str = argv[1]; end = NULL; - + w = strtoul (w_str, &end, 16); if (end == w_str) { @@ -31,7 +31,7 @@ int main (int argc, char **argv) printf ("Setting input focus to 0x%lx\n", w); XSetInputFocus (d, w, RevertToPointerRoot, CurrentTime); XFlush (d); - + return 0; } diff --git a/src/wm-tester/main.c b/src/wm-tester/main.c index 8971f3a8..c0cbd8fa 100644 --- a/src/wm-tester/main.c +++ b/src/wm-tester/main.c @@ -1,8 +1,8 @@ /* WM tester main() */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * 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; either version 2 of the @@ -12,7 +12,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ @@ -41,17 +41,17 @@ main (int argc, char **argv) int i; gboolean do_evil; gboolean do_icon_windows; - - gtk_init (&argc, &argv); - + + gtk_init (&argc, &argv); + do_evil = FALSE; do_icon_windows = FALSE; - + i = 1; while (i < argc) { const char *arg = argv[i]; - + if (strcmp (arg, "--help") == 0 || strcmp (arg, "-h") == 0 || strcmp (arg, "-?") == 0) @@ -62,20 +62,20 @@ main (int argc, char **argv) do_icon_windows = TRUE; else usage (); - + ++i; } /* Be sure some option was provided */ if (! (do_evil || do_icon_windows)) return 1; - + if (do_evil) set_up_the_evil (); if (do_icon_windows) set_up_icon_windows (); - + gtk_main (); return 0; @@ -91,9 +91,9 @@ evil_timeout (gpointer data) int len; int create_count; int destroy_count; - - len = g_slist_length (evil_windows); - + + len = g_slist_length (evil_windows); + if (len > 35) { create_count = 2; @@ -107,7 +107,7 @@ evil_timeout (gpointer data) /* Create some windows */ n_windows = g_random_int_range (0, create_count); - + i = 0; while (i < n_windows) { @@ -115,7 +115,7 @@ evil_timeout (gpointer data) GtkWidget *c; int t; GtkWidget *parent; - + w = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_move (GTK_WINDOW (w), @@ -125,7 +125,7 @@ evil_timeout (gpointer data) gdk_screen_height ())); parent = NULL; - + /* set transient for random window (may create all kinds of weird cycles) */ if (len > 0) { @@ -133,22 +133,22 @@ evil_timeout (gpointer data) if (t >= 0) { parent = g_slist_nth_data (evil_windows, t); - + if (parent != NULL) gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (parent)); } } - + if (parent != NULL) c = gtk_button_new_with_label ("Evil Transient!"); else c = gtk_button_new_with_label ("Evil Window!"); gtk_container_add (GTK_CONTAINER (w), c); - + gtk_widget_show_all (w); - + evil_windows = g_slist_prepend (evil_windows, w); - + ++i; } @@ -160,7 +160,7 @@ evil_timeout (gpointer data) while (i < n_windows) { GtkWidget *w; - + w = g_slist_nth_data (evil_windows, g_random_int_range (0, len)); if (w) @@ -169,11 +169,11 @@ evil_timeout (gpointer data) evil_windows = g_slist_remove (evil_windows, w); gtk_widget_destroy (w); } - + ++i; } } - + return TRUE; } @@ -191,7 +191,7 @@ set_up_icon_windows (void) /* Create some windows */ n_windows = 9; - + i = 0; while (i < n_windows) { @@ -200,7 +200,7 @@ set_up_icon_windows (void) GList *icons; GdkPixbuf *pix; int size = 0; - + w = gtk_window_new (GTK_WINDOW_TOPLEVEL); c = gtk_button_new_with_label ("Icon window"); gtk_container_add (GTK_CONTAINER (w), c); @@ -209,7 +209,7 @@ set_up_icon_windows (void) gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, NULL, &size); pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gtk-save", size, 0, NULL); - + icons = g_list_append (icons, pix); if (i % 2) @@ -230,9 +230,9 @@ set_up_icon_windows (void) g_list_foreach (icons, (GFunc) g_object_unref, NULL); g_list_free (icons); - + gtk_widget_show_all (w); - + ++i; } } diff --git a/src/wm-tester/test-gravity.c b/src/wm-tester/test-gravity.c index 8e5b581c..4276549b 100644 --- a/src/wm-tester/test-gravity.c +++ b/src/wm-tester/test-gravity.c @@ -4,11 +4,11 @@ #include <string.h> static int gravities[10] = { - NorthWestGravity, - NorthGravity, + NorthWestGravity, + NorthGravity, NorthEastGravity, - WestGravity, - CenterGravity, + WestGravity, + CenterGravity, EastGravity, SouthWestGravity, SouthGravity, @@ -73,7 +73,7 @@ calculate_position (int i, int doubled, int *x, int *y) *x = 150; *y = 150; } - else + else { int xoff = x_offset[i % 3]; int yoff = y_offset[i / 3]; @@ -82,7 +82,7 @@ calculate_position (int i, int doubled, int *x, int *y) xoff *= 2; yoff *= 2; } - + *x = screen_x_fraction[i % 3] * screen_width + xoff; *y = screen_y_fraction[i / 3] * screen_height + yoff; } @@ -123,12 +123,12 @@ int main (int argc, char **argv) int screen; XEvent ev; int noframes; - + if (argc > 1 && strcmp (argv[1], "--noframes") == 0) noframes = 1; else noframes = 0; - + d = XOpenDisplay (NULL); screen = DefaultScreen (d); @@ -138,11 +138,11 @@ int main (int argc, char **argv) for (i=0; i<10; i++) { int x, y; - + calculate_position (i, doubled[i], &x, &y); - w = XCreateSimpleWindow (d, RootWindow (d, screen), - x, y, WINDOW_WIDTH, WINDOW_HEIGHT, 0, + w = XCreateSimpleWindow (d, RootWindow (d, screen), + x, y, WINDOW_WIDTH, WINDOW_HEIGHT, 0, WhitePixel (d, screen), WhitePixel (d, screen)); windows[i] = w; @@ -150,11 +150,11 @@ int main (int argc, char **argv) window_rects[i].y = y; window_rects[i].width = WINDOW_WIDTH; window_rects[i].height = WINDOW_HEIGHT; - + XSelectInput (d, w, ButtonPressMask | ExposureMask | StructureNotifyMask); - + hints.flags = USPosition | PMinSize | PMaxSize | PWinGravity; - + hints.min_width = WINDOW_WIDTH / 2; hints.min_height = WINDOW_HEIGHT / 2; @@ -170,7 +170,7 @@ int main (int argc, char **argv) hints.max_height = WINDOW_HEIGHT * 2 + WINDOW_HEIGHT / 2; #endif hints.win_gravity = gravities[i]; - + XSetWMNormalHints (d, w, &hints); XStoreName (d, w, window_gravity_to_string (hints.win_gravity)); @@ -179,10 +179,10 @@ int main (int argc, char **argv) { MotifWmHints mwm; Atom mwm_atom; - + mwm.decorations = 0; mwm.flags = MWM_HINTS_DECORATIONS; - + mwm_atom = XInternAtom (d, "_MOTIF_WM_HINTS", False); XChangeProperty (d, w, mwm_atom, mwm_atom, @@ -190,7 +190,7 @@ int main (int argc, char **argv) (unsigned char *)&mwm, sizeof (MotifWmHints)/sizeof (long)); } - + XMapWindow (d, w); } @@ -201,14 +201,14 @@ int main (int argc, char **argv) if (ev.xany.type == ConfigureNotify) { i = find_window (ev.xconfigure.window); - + if (i >= 0) { Window ignored; - + window_rects[i].width = ev.xconfigure.width; window_rects[i].height = ev.xconfigure.height; - + XClearArea (d, windows[i], 0, 0, ev.xconfigure.width, ev.xconfigure.height, @@ -227,17 +227,17 @@ int main (int argc, char **argv) } } else if (ev.xany.type == Expose) - { + { i = find_window (ev.xexpose.window); - + if (i >= 0) { GC gc; XGCValues values; char buf[256]; - + values.foreground = BlackPixel (d, screen); - + gc = XCreateGC (d, windows[i], GCForeground, &values); @@ -245,7 +245,7 @@ int main (int argc, char **argv) "%d,%d", window_rects[i].x, window_rects[i].y); - + XDrawString (d, windows[i], gc, 10, 15, buf, strlen (buf)); @@ -253,10 +253,10 @@ int main (int argc, char **argv) "%dx%d", window_rects[i].width, window_rects[i].height); - + XDrawString (d, windows[i], gc, 10, 35, buf, strlen (buf)); - + XFreeGC (d, gc); } } @@ -267,13 +267,13 @@ int main (int argc, char **argv) if (i >= 0) { /* Button 1 = move, 2 = resize, 3 = both at once */ - - if (ev.xbutton.button == Button1) - { + + if (ev.xbutton.button == Button1) + { int x, y; - + calculate_position (i, doubled[i], &x, &y); - XMoveWindow (d, windows[i], x, y); + XMoveWindow (d, windows[i], x, y); } else if (ev.xbutton.button == Button2) { @@ -287,7 +287,7 @@ int main (int argc, char **argv) else if (ev.xbutton.button == Button3) { int x, y; - + calculate_position (i, !doubled[i], &x, &y); if (doubled[i]) diff --git a/src/wm-tester/test-resizing.c b/src/wm-tester/test-resizing.c index f9481004..344b8325 100644 --- a/src/wm-tester/test-resizing.c +++ b/src/wm-tester/test-resizing.c @@ -17,7 +17,7 @@ calc_rects (XRectangle *rects, int width, int height) rects[i].height = h; ++i; } - + /* NW */ rects[0].x = 0; rects[0].y = 0; @@ -70,7 +70,7 @@ get_size (Display *d, Drawable draw, int x, y; unsigned int width=0, height=0, border=0, depth=0; Window root; - + XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth); if (xp) @@ -93,20 +93,20 @@ main (int argc, char **argv) XEvent ev; int x, y, width, height; Pixmap pix; - GC gc; + GC gc; XGCValues gc_vals; XSetWindowAttributes set_attrs; XWindowChanges changes; XRectangle rects[9]; gboolean redraw_pending; unsigned int mask; - + d = XOpenDisplay (NULL); screen = DefaultScreen (d); - /* Print some debug spew to show how StaticGravity works */ - w = XCreateSimpleWindow (d, RootWindow (d, screen), + /* Print some debug spew to show how StaticGravity works */ + w = XCreateSimpleWindow (d, RootWindow (d, screen), 0, 0, 100, 100, 0, WhitePixel (d, screen), WhitePixel (d, screen)); @@ -115,21 +115,21 @@ main (int argc, char **argv) WhitePixel (d, screen), WhitePixel (d, screen)); set_attrs.win_gravity = StaticGravity; - + XChangeWindowAttributes (d, cw, CWWinGravity, &set_attrs); - + get_size (d, w, &x, &y, &width, &height); - + g_print ("Parent is %d,%d %d x %d before configuring parent\n", x, y, width, height); - + get_size (d, cw, &x, &y, &width, &height); g_print ("Child is %d,%d %d x %d before configuring parent\n", x, y, width, height); - + changes.x = 10; changes.y = 10; changes.width = 110; @@ -138,7 +138,7 @@ main (int argc, char **argv) mask = CWX | CWY; mask = CWWidth | CWHeight; mask = CWX | CWY | CWWidth | CWHeight; - + XConfigureWindow (d, w, mask, &changes); XSync (d, False); @@ -146,42 +146,42 @@ main (int argc, char **argv) g_print ("Parent is %d,%d %d x %d after configuring parent\n", x, y, width, height); - + get_size (d, cw, &x, &y, &width, &height); g_print ("Child is %d,%d %d x %d after configuring parent\n", - x, y, width, height); + x, y, width, height); XDestroyWindow (d, w); - + /* The window that gets displayed */ - + x = 20; y = 20; width = 100; height = 100; calc_rects (rects, width, height); - - w = XCreateSimpleWindow (d, RootWindow (d, screen), + + w = XCreateSimpleWindow (d, RootWindow (d, screen), x, y, width, height, 0, WhitePixel (d, screen), WhitePixel (d, screen)); - + set_attrs.bit_gravity = StaticGravity; - + XChangeWindowAttributes (d, w, CWBitGravity, &set_attrs); - + XSelectInput (d, w, ButtonPressMask | ExposureMask | StructureNotifyMask); - + hints.flags = PMinSize; - + hints.min_width = 100; hints.min_height = 100; - + XSetWMNormalHints (d, w, &hints); XMapWindow (d, w); @@ -189,7 +189,7 @@ main (int argc, char **argv) while (1) { XNextEvent (d, &ev); - + switch (ev.xany.type) { case ButtonPress: @@ -208,11 +208,11 @@ main (int argc, char **argv) redraw_pending = TRUE; break; - + case Expose: redraw_pending = TRUE; break; - + default: break; } @@ -225,24 +225,24 @@ main (int argc, char **argv) else if (redraw_pending) { calc_rects (rects, width, height); - + pix = XCreatePixmap (d, w, width, height, DefaultDepth (d, screen)); - + gc_vals.foreground = WhitePixel (d, screen); - + gc = XCreateGC (d, pix, GCForeground, &gc_vals); - + XFillRectangle (d, pix, gc, 0, 0, width, height); - + /* Draw rectangles at each gravity point */ gc_vals.foreground = BlackPixel (d, screen); XChangeGC (d, gc, GCForeground, &gc_vals); - + XFillRectangles (d, pix, gc, rects, G_N_ELEMENTS (rects)); - + XCopyArea (d, pix, w, gc, 0, 0, width, height, 0, 0); - + XFreePixmap (d, pix); XFreeGC (d, gc); diff --git a/src/wm-tester/test-size-hints.c b/src/wm-tester/test-size-hints.c index 72f1b486..0569efbd 100644 --- a/src/wm-tester/test-size-hints.c +++ b/src/wm-tester/test-size-hints.c @@ -19,7 +19,7 @@ get_size (Display *d, Drawable draw, int x, y; unsigned int width, height, border, depth; Window root; - + XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth); if (xp) @@ -43,10 +43,10 @@ main (int argc, char **argv) XEvent ev; int x, y, width, height; Pixmap pix; - GC gc; + GC gc; XGCValues gc_vals; gboolean redraw_pending; - + d = XOpenDisplay (NULL); screen = DefaultScreen (d); @@ -55,20 +55,20 @@ main (int argc, char **argv) y = 0; width = 100; height = 100; - - zero_min_size = XCreateSimpleWindow (d, RootWindow (d, screen), + + zero_min_size = XCreateSimpleWindow (d, RootWindow (d, screen), x, y, width, height, 0, WhitePixel (d, screen), - WhitePixel (d, screen)); - + WhitePixel (d, screen)); + XSelectInput (d, zero_min_size, ButtonPressMask | ExposureMask | StructureNotifyMask); - + hints.flags = PMinSize; - + hints.min_width = 0; hints.min_height = 0; - + XSetWMNormalHints (d, zero_min_size, &hints); XMapWindow (d, zero_min_size); @@ -76,7 +76,7 @@ main (int argc, char **argv) while (1) { XNextEvent (d, &ev); - + switch (ev.xany.type) { case ButtonPress: @@ -95,11 +95,11 @@ main (int argc, char **argv) redraw_pending = TRUE; break; - + case Expose: redraw_pending = TRUE; break; - + default: break; } @@ -113,15 +113,15 @@ main (int argc, char **argv) { pix = XCreatePixmap (d, zero_min_size, width, height, DefaultDepth (d, screen)); - + gc_vals.foreground = WhitePixel (d, screen); - + gc = XCreateGC (d, pix, GCForeground, &gc_vals); - + XFillRectangle (d, pix, gc, 0, 0, width, height); - + XCopyArea (d, pix, zero_min_size, gc, 0, 0, width, height, 0, 0); - + XFreePixmap (d, pix); XFreeGC (d, gc); diff --git a/test/tokentest/tokentest.c b/test/tokentest/tokentest.c index 107d9ee4..70f82925 100644 --- a/test/tokentest/tokentest.c +++ b/test/tokentest/tokentest.c @@ -1,8 +1,8 @@ -/* +/* * tokentest.c - test for Metacity's tokeniser * * Copyright (C) 2008 Thomas Thurman - * + * * 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; either version 2 of the @@ -12,7 +12,7 @@ * 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, see <http://www.gnu.org/licenses/>. */ |