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 /src/ui | |
parent | e132e2a700c4b50c93eae064d8fd1769b67baf06 (diff) | |
download | metacity-130f3686ffe5c914f7b721f4623bee825df7c3bb.tar.gz |
remove trailing whitespace
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/draw-workspace.c | 36 | ||||
-rw-r--r-- | src/ui/draw-workspace.h | 8 | ||||
-rw-r--r-- | src/ui/fixedtip.c | 18 | ||||
-rw-r--r-- | src/ui/fixedtip.h | 8 | ||||
-rw-r--r-- | src/ui/frames.c | 318 | ||||
-rw-r--r-- | src/ui/frames.h | 10 | ||||
-rw-r--r-- | src/ui/gradient.c | 128 | ||||
-rw-r--r-- | src/ui/gradient.h | 6 | ||||
-rw-r--r-- | src/ui/menu.c | 58 | ||||
-rw-r--r-- | src/ui/menu.h | 6 | ||||
-rw-r--r-- | src/ui/metaaccellabel.c | 8 | ||||
-rw-r--r-- | src/ui/preview-widget.c | 76 | ||||
-rw-r--r-- | src/ui/preview-widget.h | 8 | ||||
-rw-r--r-- | src/ui/resizepopup.c | 48 | ||||
-rw-r--r-- | src/ui/select-image.c | 6 | ||||
-rw-r--r-- | src/ui/select-image.h | 6 | ||||
-rw-r--r-- | src/ui/select-workspace.c | 12 | ||||
-rw-r--r-- | src/ui/select-workspace.h | 6 | ||||
-rw-r--r-- | src/ui/tabpopup.c | 76 | ||||
-rw-r--r-- | src/ui/testgradient.c | 34 | ||||
-rw-r--r-- | src/ui/theme-parser.c | 362 | ||||
-rw-r--r-- | src/ui/theme-parser.h | 6 | ||||
-rw-r--r-- | src/ui/theme-viewer.c | 158 | ||||
-rw-r--r-- | src/ui/theme.c | 430 | ||||
-rw-r--r-- | src/ui/theme.h | 44 | ||||
-rw-r--r-- | src/ui/ui.c | 40 |
26 files changed, 958 insertions, 958 deletions
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; } |