diff --git a/ChangeLog b/ChangeLog index 29cad9b50..c69b43ed7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-02-07 Havoc Pennington + + Throughout: move to meta_topic rather than meta_verbose so + metacity.log can start being more useful + + * src/util.h (enum): add more debug topics + + * src/frames.c: clean up some cruft that caused warnings + 2002-02-07 Havoc Pennington * src/theme.c (colorize_pixbuf): do random voodoo on the algorithm diff --git a/src/display.c b/src/display.c index 354055a9d..1438b82a9 100644 --- a/src/display.c +++ b/src/display.c @@ -692,8 +692,9 @@ event_callback (XEvent *event, event->xunmap.window)) { display->last_ignored_unmap_serial = event->xany.serial; - meta_verbose ("Will not focus on EnterNotify with serial %lu\n", - display->last_ignored_unmap_serial); + meta_topic (META_DEBUG_FOCUS, + "Will not focus on EnterNotify with serial %lu\n", + display->last_ignored_unmap_serial); } } @@ -968,8 +969,9 @@ event_callback (XEvent *event, { if (window->unmaps_pending == 0) { - meta_verbose ("Window %s withdrawn\n", - window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "Window %s withdrawn\n", + window->desc); window->withdrawn = TRUE; meta_window_free (window); /* Unmanage withdrawn window */ window = NULL; @@ -977,8 +979,9 @@ event_callback (XEvent *event, else { window->unmaps_pending -= 1; - meta_verbose ("Received pending unmap, %d now pending\n", - window->unmaps_pending); + meta_topic (META_DEBUG_WINDOW_STATE, + "Received pending unmap, %d now pending\n", + window->unmaps_pending); } } @@ -1078,7 +1081,6 @@ event_callback (XEvent *event, if (screen) { - meta_debug_spew ("client for screen\n"); if (event->xclient.message_type == display->atom_net_current_desktop) { @@ -1338,215 +1340,216 @@ static void meta_spew_event (MetaDisplay *display, XEvent *event) { - const char *name = NULL; - char *extra = NULL; - char *winname; - MetaScreen *screen; + const char *name = NULL; + char *extra = NULL; + char *winname; + MetaScreen *screen; - /* filter overnumerous events */ - if (event->type == Expose || event->type == MotionNotify || - event->type == NoExpose) - return; + /* filter overnumerous events */ + if (event->type == Expose || event->type == MotionNotify || + event->type == NoExpose) + return; - switch (event->type) - { - case KeyPress: - name = "KeyPress"; - extra = key_event_description (display->xdisplay, event); - break; - case KeyRelease: - name = "KeyRelease"; - extra = key_event_description (display->xdisplay, event); - break; - case ButtonPress: - name = "ButtonPress"; - break; - case ButtonRelease: - name = "ButtonRelease"; - break; - case MotionNotify: - name = "MotionNotify"; - break; - case EnterNotify: - name = "EnterNotify"; - extra = g_strdup_printf ("win: 0x%lx root: 0x%lx subwindow: 0x%lx mode: %d detail: %d", - event->xcrossing.window, - event->xcrossing.root, - event->xcrossing.subwindow, - event->xcrossing.mode, - event->xcrossing.detail); - break; - case LeaveNotify: - name = "LeaveNotify"; - extra = g_strdup_printf ("win: 0x%lx root: 0x%lx subwindow: 0x%lx mode: %d detail: %d", - event->xcrossing.window, - event->xcrossing.root, - event->xcrossing.subwindow, - event->xcrossing.mode, - event->xcrossing.detail); - break; - case FocusIn: - name = "FocusIn"; - extra = g_strdup_printf ("detail: %s mode: %s\n", - meta_focus_detail_to_string (event->xfocus.detail), - meta_focus_mode_to_string (event->xfocus.mode)); - break; - case FocusOut: - name = "FocusOut"; - extra = g_strdup_printf ("detail: %s mode: %s\n", - meta_focus_detail_to_string (event->xfocus.detail), - meta_focus_mode_to_string (event->xfocus.mode)); - break; - case KeymapNotify: - name = "KeymapNotify"; - break; - case Expose: - name = "Expose"; - break; - case GraphicsExpose: - name = "GraphicsExpose"; - break; - case NoExpose: - name = "NoExpose"; - break; - case VisibilityNotify: - name = "VisibilityNotify"; - break; - case CreateNotify: - name = "CreateNotify"; - break; - case DestroyNotify: - name = "DestroyNotify"; - break; - case UnmapNotify: - name = "UnmapNotify"; - break; - case MapNotify: - name = "MapNotify"; - break; - case MapRequest: - name = "MapRequest"; - break; - case ReparentNotify: - name = "ReparentNotify"; - break; - case ConfigureNotify: - name = "ConfigureNotify"; - extra = g_strdup_printf ("x: %d y: %d w: %d h: %d above: 0x%lx", - event->xconfigure.x, - event->xconfigure.y, - event->xconfigure.width, - event->xconfigure.height, - event->xconfigure.above); - break; - case ConfigureRequest: - name = "ConfigureRequest"; - extra = g_strdup_printf ("parent: 0x%lx window: 0x%lx x: %d %sy: %d %sw: %d %sh: %d %sborder: %d %s", - event->xconfigurerequest.parent, - event->xconfigurerequest.window, - event->xconfigurerequest.x, - event->xconfigurerequest.value_mask & - CWX ? "" : "(unset) ", - event->xconfigurerequest.y, - event->xconfigurerequest.value_mask & - CWY ? "" : "(unset) ", - event->xconfigurerequest.width, - event->xconfigurerequest.value_mask & - CWWidth ? "" : "(unset) ", - event->xconfigurerequest.height, - event->xconfigurerequest.value_mask & - CWHeight ? "" : "(unset) ", - event->xconfigurerequest.border_width, - event->xconfigurerequest.value_mask & - CWBorderWidth ? "" : "(unset)"); - break; - case GravityNotify: - name = "GravityNotify"; - break; - case ResizeRequest: - name = "ResizeRequest"; - break; - case CirculateNotify: - name = "CirculateNotify"; - break; - case CirculateRequest: - name = "CirculateRequest"; - break; - case PropertyNotify: - { - char *str; - const char *state; + switch (event->type) + { + case KeyPress: + name = "KeyPress"; + extra = key_event_description (display->xdisplay, event); + break; + case KeyRelease: + name = "KeyRelease"; + extra = key_event_description (display->xdisplay, event); + break; + case ButtonPress: + name = "ButtonPress"; + break; + case ButtonRelease: + name = "ButtonRelease"; + break; + case MotionNotify: + name = "MotionNotify"; + break; + case EnterNotify: + name = "EnterNotify"; + extra = g_strdup_printf ("win: 0x%lx root: 0x%lx subwindow: 0x%lx mode: %d detail: %d", + event->xcrossing.window, + event->xcrossing.root, + event->xcrossing.subwindow, + event->xcrossing.mode, + event->xcrossing.detail); + break; + case LeaveNotify: + name = "LeaveNotify"; + extra = g_strdup_printf ("win: 0x%lx root: 0x%lx subwindow: 0x%lx mode: %d detail: %d", + event->xcrossing.window, + event->xcrossing.root, + event->xcrossing.subwindow, + event->xcrossing.mode, + event->xcrossing.detail); + break; + case FocusIn: + name = "FocusIn"; + extra = g_strdup_printf ("detail: %s mode: %s\n", + meta_focus_detail_to_string (event->xfocus.detail), + meta_focus_mode_to_string (event->xfocus.mode)); + break; + case FocusOut: + name = "FocusOut"; + extra = g_strdup_printf ("detail: %s mode: %s\n", + meta_focus_detail_to_string (event->xfocus.detail), + meta_focus_mode_to_string (event->xfocus.mode)); + break; + case KeymapNotify: + name = "KeymapNotify"; + break; + case Expose: + name = "Expose"; + break; + case GraphicsExpose: + name = "GraphicsExpose"; + break; + case NoExpose: + name = "NoExpose"; + break; + case VisibilityNotify: + name = "VisibilityNotify"; + break; + case CreateNotify: + name = "CreateNotify"; + break; + case DestroyNotify: + name = "DestroyNotify"; + break; + case UnmapNotify: + name = "UnmapNotify"; + break; + case MapNotify: + name = "MapNotify"; + break; + case MapRequest: + name = "MapRequest"; + break; + case ReparentNotify: + name = "ReparentNotify"; + break; + case ConfigureNotify: + name = "ConfigureNotify"; + extra = g_strdup_printf ("x: %d y: %d w: %d h: %d above: 0x%lx", + event->xconfigure.x, + event->xconfigure.y, + event->xconfigure.width, + event->xconfigure.height, + event->xconfigure.above); + break; + case ConfigureRequest: + name = "ConfigureRequest"; + extra = g_strdup_printf ("parent: 0x%lx window: 0x%lx x: %d %sy: %d %sw: %d %sh: %d %sborder: %d %s", + event->xconfigurerequest.parent, + event->xconfigurerequest.window, + event->xconfigurerequest.x, + event->xconfigurerequest.value_mask & + CWX ? "" : "(unset) ", + event->xconfigurerequest.y, + event->xconfigurerequest.value_mask & + CWY ? "" : "(unset) ", + event->xconfigurerequest.width, + event->xconfigurerequest.value_mask & + CWWidth ? "" : "(unset) ", + event->xconfigurerequest.height, + event->xconfigurerequest.value_mask & + CWHeight ? "" : "(unset) ", + event->xconfigurerequest.border_width, + event->xconfigurerequest.value_mask & + CWBorderWidth ? "" : "(unset)"); + break; + case GravityNotify: + name = "GravityNotify"; + break; + case ResizeRequest: + name = "ResizeRequest"; + break; + case CirculateNotify: + name = "CirculateNotify"; + break; + case CirculateRequest: + name = "CirculateRequest"; + break; + case PropertyNotify: + { + char *str; + const char *state; - name = "PropertyNotify"; + name = "PropertyNotify"; - meta_error_trap_push (display); - str = XGetAtomName (display->xdisplay, - event->xproperty.atom); - meta_error_trap_pop (display); + meta_error_trap_push (display); + str = XGetAtomName (display->xdisplay, + event->xproperty.atom); + meta_error_trap_pop (display); - if (event->xproperty.state == PropertyNewValue) - state = "PropertyNewValue"; - else if (event->xproperty.state == PropertyDelete) - state = "PropertyDelete"; - else - state = "???"; + if (event->xproperty.state == PropertyNewValue) + state = "PropertyNewValue"; + else if (event->xproperty.state == PropertyDelete) + state = "PropertyDelete"; + else + state = "???"; - extra = g_strdup_printf ("atom: %s state: %s", - str ? str : "(unknown atom)", - state); - XFree (str); - } - break; - case SelectionClear: - name = "SelectionClear"; - break; - case SelectionRequest: - name = "SelectionRequest"; - break; - case SelectionNotify: - name = "SelectionNotify"; - break; - case ColormapNotify: - name = "ColormapNotify"; - break; - case ClientMessage: - { - char *str; - name = "ClientMessage"; - meta_error_trap_push (display); - str = XGetAtomName (display->xdisplay, - event->xclient.message_type); - meta_error_trap_pop (display); - extra = g_strdup_printf ("type: %s format: %d\n", - str ? str : "(unknown atom)", - event->xclient.format); - XFree (str); - } - break; - case MappingNotify: - name = "MappingNotify"; - break; - default: - meta_verbose ("Unknown event type %d\n", event->xany.type); - name = "Unknown event type"; - break; - } + extra = g_strdup_printf ("atom: %s state: %s", + str ? str : "(unknown atom)", + state); + XFree (str); + } + break; + case SelectionClear: + name = "SelectionClear"; + break; + case SelectionRequest: + name = "SelectionRequest"; + break; + case SelectionNotify: + name = "SelectionNotify"; + break; + case ColormapNotify: + name = "ColormapNotify"; + break; + case ClientMessage: + { + char *str; + name = "ClientMessage"; + meta_error_trap_push (display); + str = XGetAtomName (display->xdisplay, + event->xclient.message_type); + meta_error_trap_pop (display); + extra = g_strdup_printf ("type: %s format: %d\n", + str ? str : "(unknown atom)", + event->xclient.format); + XFree (str); + } + break; + case MappingNotify: + name = "MappingNotify"; + break; + default: + meta_verbose ("Unknown event type %d\n", event->xany.type); + name = "Unknown event type"; + break; + } - screen = meta_display_screen_for_root (display, event->xany.window); + screen = meta_display_screen_for_root (display, event->xany.window); - if (screen) - winname = g_strdup_printf ("root %d", screen->number); - else - winname = g_strdup_printf ("0x%lx", event->xany.window); + if (screen) + winname = g_strdup_printf ("root %d", screen->number); + else + winname = g_strdup_printf ("0x%lx", event->xany.window); - meta_verbose ("%s on %s%s %s serial %lu\n", name, winname, - extra ? ":" : "", extra ? extra : "", - event->xany.serial); + meta_topic (META_DEBUG_EVENTS, + "%s on %s%s %s serial %lu\n", name, winname, + extra ? ":" : "", extra ? extra : "", + event->xany.serial); - g_free (winname); + g_free (winname); - if (extra) - g_free (extra); + if (extra) + g_free (extra); } MetaWindow* diff --git a/src/frame.c b/src/frame.c index 6532a9e55..f02c42647 100644 --- a/src/frame.c +++ b/src/frame.c @@ -105,7 +105,8 @@ meta_window_ensure_frame (MetaWindow *window) window->mapped = FALSE; /* the reparent will unmap the window, * we don't want to take that as a withdraw */ - meta_verbose ("Incrementing unmaps_pending on %s for reparent\n", window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "Incrementing unmaps_pending on %s for reparent\n", window->desc); window->unmaps_pending += 1; } /* window was reparented to this position */ @@ -158,7 +159,8 @@ meta_window_destroy_frame (MetaWindow *window) * can identify a withdraw initiated * by the client. */ - meta_verbose ("Incrementing unmaps_pending on %s for reparent back to root\n", window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "Incrementing unmaps_pending on %s for reparent back to root\n", window->desc); window->unmaps_pending += 1; } XReparentWindow (window->display->xdisplay, diff --git a/src/frames.c b/src/frames.c index 990eb04bc..bd5640825 100644 --- a/src/frames.c +++ b/src/frames.c @@ -48,30 +48,10 @@ static gboolean meta_frames_destroy_event (GtkWidget *widget, GdkEventAny *event); static gboolean meta_frames_expose_event (GtkWidget *widget, GdkEventExpose *event); -static gboolean meta_frames_key_press_event (GtkWidget *widget, - GdkEventKey *event); -static gboolean meta_frames_key_release_event (GtkWidget *widget, - GdkEventKey *event); static gboolean meta_frames_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event); static gboolean meta_frames_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event); -static gboolean meta_frames_configure_event (GtkWidget *widget, - GdkEventConfigure *event); -static gboolean meta_frames_focus_in_event (GtkWidget *widget, - GdkEventFocus *event); -static gboolean meta_frames_focus_out_event (GtkWidget *widget, - GdkEventFocus *event); -static gboolean meta_frames_map_event (GtkWidget *widget, - GdkEventAny *event); -static gboolean meta_frames_unmap_event (GtkWidget *widget, - GdkEventAny *event); -static gboolean meta_frames_property_notify_event (GtkWidget *widget, - GdkEventProperty *event); -static gboolean meta_frames_client_event (GtkWidget *widget, - GdkEventClient *event); -static gboolean meta_frames_window_state_event (GtkWidget *widget, - GdkEventWindowState *event); static void meta_frames_paint_to_drawable (MetaFrames *frames, MetaUIFrame *frame, @@ -94,14 +74,7 @@ static MetaFrameControl get_control (MetaFrames *frames, int y); static void clear_tip (MetaFrames *frames); -enum -{ - dummy, /* remove this when you add more signals */ - LAST_SIGNAL -}; - static GtkWidgetClass *parent_class = NULL; -static guint signals[LAST_SIGNAL]; GtkType meta_frames_get_type (void) @@ -150,11 +123,11 @@ meta_frames_class_init (MetaFramesClass *class) widget_class->unrealize = meta_frames_unrealize; widget_class->expose_event = meta_frames_expose_event; - widget_class->unmap_event = meta_frames_unmap_event; - 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; + widget_class->enter_notify_event = meta_frames_enter_notify_event; widget_class->leave_notify_event = meta_frames_leave_notify_event; } @@ -1252,38 +1225,6 @@ meta_frames_paint_to_drawable (MetaFrames *frames, mini_icon, icon); } -static gboolean -meta_frames_key_press_event (GtkWidget *widget, - GdkEventKey *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - -static gboolean -meta_frames_key_release_event (GtkWidget *widget, - GdkEventKey *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - static gboolean meta_frames_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event) @@ -1322,134 +1263,6 @@ meta_frames_leave_notify_event (GtkWidget *widget, return TRUE; } -static gboolean -meta_frames_configure_event (GtkWidget *widget, - GdkEventConfigure *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - -static gboolean -meta_frames_focus_in_event (GtkWidget *widget, - GdkEventFocus *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - -static gboolean -meta_frames_focus_out_event (GtkWidget *widget, - GdkEventFocus *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - -static gboolean -meta_frames_map_event (GtkWidget *widget, - GdkEventAny *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - -static gboolean -meta_frames_unmap_event (GtkWidget *widget, - GdkEventAny *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - -static gboolean -meta_frames_property_notify_event (GtkWidget *widget, - GdkEventProperty *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - -static gboolean -meta_frames_client_event (GtkWidget *widget, - GdkEventClient *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - -static gboolean -meta_frames_window_state_event (GtkWidget *widget, - GdkEventWindowState *event) -{ - MetaUIFrame *frame; - MetaFrames *frames; - - frames = META_FRAMES (widget); - - frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window)); - if (frame == NULL) - return FALSE; - - return TRUE; -} - static GdkRectangle* control_rect (MetaFrameControl control, MetaFrameGeometry *fgeom) diff --git a/src/place.c b/src/place.c index 6574d5098..941951550 100644 --- a/src/place.c +++ b/src/place.c @@ -214,7 +214,7 @@ meta_window_place (MetaWindow *window, * placement coordinates. */ - meta_verbose ("Placing window %s\n", window->desc); + meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc); /* FIXME copying Mac, when placing a dialog * put it at 1/5 down and horizontally centered @@ -245,8 +245,8 @@ meta_window_place (MetaWindow *window, if (fgeom) y += fgeom->top_height; - meta_verbose ("Centered window %s over transient parent\n", - window->desc); + meta_topic (META_DEBUG_PLACEMENT, "Centered window %s over transient parent\n", + window->desc); goto done; } @@ -265,8 +265,8 @@ meta_window_place (MetaWindow *window, x = (w - window->rect.width) / 2; y = (y - window->rect.height) / 2; - meta_verbose ("Centered window %s on screen\n", - window->desc); + meta_topic (META_DEBUG_PLACEMENT, "Centered window %s on screen\n", + window->desc); goto done; } diff --git a/src/prefs.c b/src/prefs.c index ed0ea0486..90177d466 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -36,7 +36,7 @@ #define KEY_NUM_WORKSPACES "/apps/metacity/general/num_workspaces" #define KEY_APPLICATION_BASED "/apps/metacity/general/application_based" -static GConfClient *client = NULL; +static GConfClient *default_client = NULL; static GList *listeners = NULL; static GList *changes = NULL; static guint changed_idle; @@ -198,24 +198,24 @@ meta_prefs_init (void) int int_val; gboolean bool_val; - if (client != NULL) + if (default_client != NULL) return; /* returns a reference which we hold forever */ - client = gconf_client_get_default (); + default_client = gconf_client_get_default (); - gconf_client_add_dir (client, "/apps/metacity", + gconf_client_add_dir (default_client, "/apps/metacity", GCONF_CLIENT_PRELOAD_RECURSIVE, &err); cleanup_error (&err); - str_val = gconf_client_get_string (client, KEY_FOCUS_MODE, + str_val = gconf_client_get_string (default_client, KEY_FOCUS_MODE, &err); cleanup_error (&err); update_focus_mode (str_val); g_free (str_val); - str_val = gconf_client_get_string (client, KEY_THEME, + str_val = gconf_client_get_string (default_client, KEY_THEME, &err); cleanup_error (&err); update_theme (str_val); @@ -226,33 +226,33 @@ meta_prefs_init (void) * just lazy. But they keys ought to be set, anyhow. */ - bool_val = gconf_client_get_bool (client, KEY_USE_DESKTOP_FONT, + bool_val = gconf_client_get_bool (default_client, KEY_USE_DESKTOP_FONT, &err); cleanup_error (&err); update_use_desktop_font (bool_val); - int_val = gconf_client_get_int (client, KEY_TITLEBAR_FONT_SIZE, + int_val = gconf_client_get_int (default_client, KEY_TITLEBAR_FONT_SIZE, &err); cleanup_error (&err); update_titlebar_font_size (int_val); - str_val = gconf_client_get_string (client, KEY_TITLEBAR_FONT, + str_val = gconf_client_get_string (default_client, KEY_TITLEBAR_FONT, &err); cleanup_error (&err); update_titlebar_font (str_val); g_free (str_val); - int_val = gconf_client_get_int (client, KEY_NUM_WORKSPACES, + int_val = gconf_client_get_int (default_client, KEY_NUM_WORKSPACES, &err); cleanup_error (&err); update_num_workspaces (int_val); - bool_val = gconf_client_get_bool (client, KEY_APPLICATION_BASED, + bool_val = gconf_client_get_bool (default_client, KEY_APPLICATION_BASED, &err); cleanup_error (&err); update_application_based (bool_val); - gconf_client_notify_add (client, "/apps/metacity", + gconf_client_notify_add (default_client, "/apps/metacity", change_notify, NULL, NULL, @@ -422,7 +422,7 @@ update_focus_mode (const char *value) static gboolean update_theme (const char *value) { - const char *old_theme; + char *old_theme; gboolean changed; old_theme = current_theme; diff --git a/src/session.c b/src/session.c index e3a49acb1..8a61fe952 100644 --- a/src/session.c +++ b/src/session.c @@ -27,7 +27,7 @@ void meta_session_init (const char *previous_id) { - meta_verbose ("Compiled without session management support\n"); + meta_topic (META_DEBUG_SM, "Compiled without session management support\n"); } const MetaWindowSessionInfo* @@ -208,8 +208,8 @@ meta_session_init (const char *previous_id) unsigned long mask; SmcCallbacks callbacks; - meta_verbose ("Initializing session with session ID '%s'\n", - previous_id ? previous_id : "(none)"); + meta_topic (META_DEBUG_SM, "Initializing session with session ID '%s'\n", + previous_id ? previous_id : "(none)"); if (previous_id) load_state (previous_id); @@ -251,7 +251,7 @@ meta_session_init (const char *previous_id) { if (client_id == NULL) meta_bug ("Session manager gave us a NULL client ID?"); - meta_verbose ("Obtained session ID '%s'\n", client_id); + meta_topic (META_DEBUG_SM, "Obtained session ID '%s'\n", client_id); } if (previous_id && strcmp (previous_id, client_id) == 0) @@ -439,7 +439,7 @@ save_yourself_callback (SmcConn smc_conn, static void die_callback (SmcConn smc_conn, SmPointer client_data) { - meta_verbose ("Exiting at request of session manager\n"); + meta_topic (META_DEBUG_SM, "Exiting at request of session manager\n"); disconnect (); meta_quit (META_EXIT_SUCCESS); } @@ -768,7 +768,7 @@ save_state (void) session_dir, g_strerror (errno)); } - meta_verbose ("Saving session to '%s'\n", session_file); + meta_topic (META_DEBUG_SM, "Saving session to '%s'\n", session_file); outfile = fopen (session_file, "w"); @@ -833,8 +833,8 @@ save_state (void) role = window->role ? encode_text_as_utf8_markup (window->role) : NULL; - meta_verbose ("Saving session managed window %s, client ID '%s'\n", - window->desc, window->sm_client_id); + meta_topic (META_DEBUG_SM, "Saving session managed window %s, client ID '%s'\n", + window->desc, window->sm_client_id); fprintf (outfile, " \n", @@ -884,8 +884,8 @@ save_state (void) } else { - meta_verbose ("Not saving window '%s', not session managed\n", - window->desc); + meta_topic (META_DEBUG_SM, "Not saving window '%s', not session managed\n", + window->desc); } tmp = tmp->next; @@ -992,7 +992,7 @@ load_state (const char *previous_id) return; } - meta_verbose ("Parsing saved session file %s\n", session_file); + meta_topic (META_DEBUG_SM, "Parsing saved session file %s\n", session_file); g_free (session_file); session_file = NULL; @@ -1207,12 +1207,12 @@ start_element_handler (GMarkupParseContext *context, ++i; } - meta_verbose ("Loaded geometry %d,%d %dx%d gravity %s\n", - pd->info->rect.x, - pd->info->rect.y, - pd->info->rect.width, - pd->info->rect.height, - window_gravity_to_string (pd->info->gravity)); + meta_topic (META_DEBUG_SM, "Loaded geometry %d,%d %dx%d gravity %s\n", + pd->info->rect.x, + pd->info->rect.y, + pd->info->rect.width, + pd->info->rect.height, + window_gravity_to_string (pd->info->gravity)); } else { @@ -1242,10 +1242,10 @@ end_element_handler (GMarkupParseContext *context, window_info_list = g_slist_prepend (window_info_list, pd->info); - meta_verbose ("Loaded window info from session with class: %s name: %s role: %s\n", - pd->info->res_class ? pd->info->res_class : "(none)", - pd->info->res_name ? pd->info->res_name : "(none)", - pd->info->role ? pd->info->role : "(none)"); + meta_topic (META_DEBUG_SM, "Loaded window info from session with class: %s name: %s role: %s\n", + pd->info->res_class ? pd->info->res_class : "(none)", + pd->info->res_name ? pd->info->res_name : "(none)", + pd->info->role ? pd->info->role : "(none)"); pd->info = NULL; } @@ -1305,11 +1305,11 @@ get_possible_matches (MetaWindow *window) both_null_or_matching (info->res_name, window->res_name) && both_null_or_matching (info->role, window->role)) { - meta_verbose ("Window %s may match saved window with class: %s name: %s role: %s\n", - window->desc, - info->res_class ? info->res_class : "(none)", - info->res_name ? info->res_name : "(none)", - info->role ? info->role : "(none)"); + meta_topic (META_DEBUG_SM, "Window %s may match saved window with class: %s name: %s role: %s\n", + window->desc, + info->res_class ? info->res_class : "(none)", + info->res_name ? info->res_name : "(none)", + info->role ? info->role : "(none)"); retval = g_slist_prepend (retval, info); } @@ -1318,29 +1318,29 @@ get_possible_matches (MetaWindow *window) if (meta_is_verbose ()) { if (!both_null_or_matching (info->id, window->sm_client_id)) - meta_verbose ("Window %s has SM client ID %s, saved state has %s, no match\n", - window->desc, - window->sm_client_id ? window->sm_client_id : "(none)", - info->id ? info->id : "(none)"); + meta_topic (META_DEBUG_SM, "Window %s has SM client ID %s, saved state has %s, no match\n", + window->desc, + window->sm_client_id ? window->sm_client_id : "(none)", + info->id ? info->id : "(none)"); else if (!both_null_or_matching (info->res_class, window->res_class)) - meta_verbose ("Window %s has class %s doesn't match saved class %s, no match\n", - window->desc, - window->res_class ? window->res_class : "(none)", - info->res_class ? info->res_class : "(none)"); - + meta_topic (META_DEBUG_SM, "Window %s has class %s doesn't match saved class %s, no match\n", + window->desc, + window->res_class ? window->res_class : "(none)", + info->res_class ? info->res_class : "(none)"); + else if (!both_null_or_matching (info->res_name, window->res_name)) - meta_verbose ("Window %s has name %s doesn't match saved name %s, no match\n", - window->desc, - window->res_name ? window->res_name : "(none)", - info->res_name ? info->res_name : "(none)"); + meta_topic (META_DEBUG_SM, "Window %s has name %s doesn't match saved name %s, no match\n", + window->desc, + window->res_name ? window->res_name : "(none)", + info->res_name ? info->res_name : "(none)"); else if (!both_null_or_matching (info->role, window->role)) - meta_verbose ("Window %s has role %s doesn't match saved role %s, no match\n", - window->desc, - window->role ? window->role : "(none)", - info->role ? info->role : "(none)"); + meta_topic (META_DEBUG_SM, "Window %s has role %s doesn't match saved role %s, no match\n", + window->desc, + window->role ? window->role : "(none)", + info->role ? info->role : "(none)"); else - meta_verbose ("???? should not happen - window %s doesn't match saved state %s for no good reason\n", - window->desc, info->id); + meta_topic (META_DEBUG_SM, "???? should not happen - window %s doesn't match saved state %s for no good reason\n", + window->desc, info->id); } } @@ -1408,7 +1408,9 @@ meta_window_lookup_saved_state (MetaWindow *window) */ if (window->sm_client_id == NULL) { - meta_verbose ("Window %s is not session managed, not checking for saved state\n", window->desc); + meta_topic (META_DEBUG_SM, + "Window %s is not session managed, not checking for saved state\n", + window->desc); return NULL; } @@ -1416,8 +1418,8 @@ meta_window_lookup_saved_state (MetaWindow *window) if (possibles == NULL) { - meta_verbose ("Window %s has no possible matches in the list of saved window states\n", - window->desc); + meta_topic (META_DEBUG_SM, "Window %s has no possible matches in the list of saved window states\n", + window->desc); return NULL; } diff --git a/src/stack.c b/src/stack.c index c78a62b4b..cf70f12bf 100644 --- a/src/stack.c +++ b/src/stack.c @@ -133,7 +133,7 @@ meta_stack_add (MetaStack *stack, { MetaStackOp *op; - meta_verbose ("Adding window %s to the stack\n", window->desc); + meta_topic (META_DEBUG_STACK, "Adding window %s to the stack\n", window->desc); op = ensure_op (stack, window); @@ -160,7 +160,7 @@ meta_stack_remove (MetaStack *stack, { MetaStackOp *op; - meta_verbose ("Removing window %s from the stack\n", window->desc); + meta_topic (META_DEBUG_STACK, "Removing window %s from the stack\n", window->desc); op = ensure_op (stack, window); @@ -275,8 +275,8 @@ compute_layer (MetaWindow *window) break; } - meta_verbose ("Window %s on layer %d\n", - window->desc, window->layer); + meta_topic (META_DEBUG_STACK, "Window %s on layer %d\n", + window->desc, window->layer); } static GList* @@ -353,8 +353,8 @@ sort_window_list (GList *list) if (parent) { - meta_verbose ("Stacking %s above %s due to transiency\n", - w->desc, parent->desc); + meta_topic (META_DEBUG_STACK, "Stacking %s above %s due to transiency\n", + w->desc, parent->desc); list = ensure_before (list, w, parent); } } @@ -388,7 +388,7 @@ meta_stack_sync_to_server (MetaStack *stack) if (stack->pending == NULL) return; - meta_verbose ("Syncing window stack to server\n"); + meta_topic (META_DEBUG_STACK, "Syncing window stack to server\n"); /* Here comes the fun - figure out all the stacking. * We make no pretense of efficiency. @@ -596,12 +596,12 @@ meta_stack_sync_to_server (MetaStack *stack) /* Sort each layer... */ if (needs_sort[i]) { - meta_verbose ("Sorting layer %d\n", i); + meta_topic (META_DEBUG_STACK, "Sorting layer %d\n", i); stack->layers[i] = sort_window_list (stack->layers[i]); } /* ... then append it */ - meta_verbose ("Layer %d: ", i); + meta_topic (META_DEBUG_STACK, "Layer %d: ", i); meta_push_no_msg_prefix (); tmp = stack->layers[i]; while (tmp != NULL) @@ -617,12 +617,12 @@ meta_stack_sync_to_server (MetaStack *stack) else g_array_append_val (root_children_stacked, w->xwindow); - meta_verbose ("%s ", w->desc); + meta_topic (META_DEBUG_STACK, "%s ", w->desc); tmp = tmp->next; } - meta_verbose ("\n"); + meta_topic (META_DEBUG_STACK, "\n"); meta_pop_no_msg_prefix (); } while (i > 0); @@ -634,8 +634,8 @@ meta_stack_sync_to_server (MetaStack *stack) /* Sync to server */ - meta_verbose ("Restacking %d windows\n", - root_children_stacked->len); + meta_topic (META_DEBUG_STACK, "Restacking %d windows\n", + root_children_stacked->len); meta_error_trap_push (stack->screen->display); @@ -644,7 +644,7 @@ meta_stack_sync_to_server (MetaStack *stack) /* Just impose our stack, we don't know the previous state. * This involves a ton of circulate requests and may flicker. */ - meta_verbose ("Don't know last stack state, restacking everything\n"); + meta_topic (META_DEBUG_STACK, "Don't know last stack state, restacking everything\n"); if (root_children_stacked->len > 0) XRestackWindows (stack->screen->display->xdisplay, @@ -693,7 +693,7 @@ meta_stack_sync_to_server (MetaStack *stack) /* Move *newp below last_window */ if (last_window == None) { - meta_verbose ("Raising window 0x%lx to the top\n", *newp); + meta_topic (META_DEBUG_STACK, "Raising window 0x%lx to the top\n", *newp); XRaiseWindow (stack->screen->display->xdisplay, *newp); @@ -710,7 +710,7 @@ meta_stack_sync_to_server (MetaStack *stack) changes.sibling = last_window; changes.stack_mode = Below; - meta_verbose ("Placing window 0x%lx below 0x%lx\n", + meta_topic (META_DEBUG_STACK, "Placing window 0x%lx below 0x%lx\n", *newp, last_window); XConfigureWindow (stack->screen->display->xdisplay, @@ -727,7 +727,7 @@ meta_stack_sync_to_server (MetaStack *stack) if (newp != new_end) { /* Restack remaining windows */ - meta_verbose ("Restacking remaining %d windows\n", + meta_topic (META_DEBUG_STACK, "Restacking remaining %d windows\n", (int) (new_end - newp)); /* We need to include an already-stacked window * in the restack call, so we get in the proper position diff --git a/src/theme-parser.c b/src/theme-parser.c index 12f43c0ca..c1805f475 100644 --- a/src/theme-parser.c +++ b/src/theme-parser.c @@ -3790,8 +3790,8 @@ meta_theme_load (const char *theme_name, &length, &error)) { - meta_verbose ("Failed to read theme from file %s: %s\n", - theme_file, error->message); + meta_topic (META_DEBUG_THEMES, "Failed to read theme from file %s: %s\n", + theme_file, error->message); g_error_free (error); g_free (theme_dir); g_free (theme_file); @@ -3814,8 +3814,8 @@ meta_theme_load (const char *theme_name, &length, &error)) { - meta_verbose ("Failed to read theme from file %s: %s\n", - theme_file, error->message); + meta_topic (META_DEBUG_THEMES, "Failed to read theme from file %s: %s\n", + theme_file, error->message); g_error_free (error); g_free (theme_dir); g_free (theme_file); @@ -3838,8 +3838,8 @@ meta_theme_load (const char *theme_name, &length, &error)) { - meta_verbose ("Failed to read theme from file %s: %s\n", - theme_file, error->message); + meta_topic (META_DEBUG_THEMES, "Failed to read theme from file %s: %s\n", + theme_file, error->message); g_error_free (error); g_free (theme_dir); g_free (theme_file); @@ -3874,7 +3874,7 @@ meta_theme_load (const char *theme_name, g_assert (text); - meta_verbose ("Parsing theme file %s\n", theme_file); + meta_topic (META_DEBUG_THEMES, "Parsing theme file %s\n", theme_file); parse_info_init (&info); info.theme_name = theme_name; diff --git a/src/theme.c b/src/theme.c index 06811390f..c7448fa0a 100644 --- a/src/theme.c +++ b/src/theme.c @@ -3853,7 +3853,7 @@ meta_theme_set_current (const char *name, MetaTheme *new_theme; GError *err; - meta_verbose ("Setting current theme to \"%s\"\n", name); + meta_topic (META_DEBUG_THEMES, "Setting current theme to \"%s\"\n", name); if (!force_reload && meta_current_theme && @@ -3876,7 +3876,7 @@ meta_theme_set_current (const char *name, meta_current_theme = new_theme; - meta_verbose ("New theme is \"%s\"\n", meta_current_theme->name); + meta_topic (META_DEBUG_THEMES, "New theme is \"%s\"\n", meta_current_theme->name); } } diff --git a/src/util.c b/src/util.c index da8594251..db4ae6b1a 100644 --- a/src/util.c +++ b/src/util.c @@ -147,9 +147,24 @@ topic_name (MetaDebugTopic topic) { case META_DEBUG_FOCUS: return "FOCUS"; - break; - case META_DEBUG_GRADIENT_CACHE: - return "GRADIENT_CACHE"; + case META_DEBUG_WORKAREA: + return "WORKAREA"; + case META_DEBUG_STACK: + return "STACK"; + case META_DEBUG_THEMES: + return "THEMES"; + case META_DEBUG_SM: + return "SM"; + case META_DEBUG_EVENTS: + return "EVENTS"; + case META_DEBUG_WINDOW_STATE: + return "WINDOW_STATE"; + case META_DEBUG_WINDOW_OPS: + return "WINDOW_OPS"; + case META_DEBUG_PLACEMENT: + return "PLACEMENT"; + case META_DEBUG_GEOMETRY: + return "GEOMETRY"; break; } diff --git a/src/util.h b/src/util.h index 1e324cbc1..afd9bdc8b 100644 --- a/src/util.h +++ b/src/util.h @@ -45,8 +45,16 @@ void meta_fatal (const char *format, typedef enum { - META_DEBUG_FOCUS, - META_DEBUG_GRADIENT_CACHE + META_DEBUG_FOCUS = 1 << 0, + META_DEBUG_WORKAREA = 1 << 1, + META_DEBUG_STACK = 1 << 2, + META_DEBUG_THEMES = 1 << 3, + META_DEBUG_SM = 1 << 4, + META_DEBUG_EVENTS = 1 << 5, + META_DEBUG_WINDOW_STATE = 1 << 6, + META_DEBUG_WINDOW_OPS = 1 << 7, + META_DEBUG_GEOMETRY = 1 << 8, + META_DEBUG_PLACEMENT = 1 << 9 } MetaDebugTopic; diff --git a/src/window.c b/src/window.c index 3e663f847..0b1bee574 100644 --- a/src/window.c +++ b/src/window.c @@ -317,8 +317,9 @@ meta_window_new (MetaDisplay *display, Window xwindow, /* if already mapped we don't want to do the placement thing */ window->placed = window->mapped; if (window->placed) - meta_verbose ("Not placing window 0x%lx since it's already mapped\n", - xwindow); + meta_topic (META_DEBUG_PLACEMENT, + "Not placing window 0x%lx since it's already mapped\n", + xwindow); window->unmanaging = FALSE; window->calc_showing_queued = FALSE; window->move_resize_queued = FALSE; @@ -517,7 +518,8 @@ meta_window_new (MetaDisplay *display, Window xwindow, { /* don't constrain with placement algorithm */ window->placed = TRUE; - meta_verbose ("Honoring USPosition for %s instead of using placement algorithm\n", window->desc); + meta_topic (META_DEBUG_PLACEMENT, + "Honoring USPosition for %s instead of using placement algorithm\n", window->desc); } /* Assume the app knows best how to place these. */ @@ -592,8 +594,9 @@ meta_window_apply_session_info (MetaWindow *window, if (info->on_all_workspaces_set) { window->on_all_workspaces = info->on_all_workspaces; - meta_verbose ("Restoring sticky state %d for window %s\n", - window->on_all_workspaces, window->desc); + meta_topic (META_DEBUG_SM, + "Restoring sticky state %d for window %s\n", + window->on_all_workspaces, window->desc); } if (info->workspace_indices) @@ -638,9 +641,10 @@ meta_window_apply_session_info (MetaWindow *window, meta_workspace_add_window (space, window); - meta_verbose ("Restoring saved window %s to workspace %d\n", - window->desc, - meta_workspace_screen_index (space)); + meta_topic (META_DEBUG_SM, + "Restoring saved window %s to workspace %d\n", + window->desc, + meta_workspace_screen_index (space)); tmp = tmp->next; } @@ -666,8 +670,9 @@ meta_window_apply_session_info (MetaWindow *window, /* Force old gravity, ignoring anything now set */ window->size_hints.win_gravity = info->gravity; - meta_verbose ("Restoring pos %d,%d size %d x %d for %s\n", - x, y, w, h, window->desc); + meta_topic (META_DEBUG_SM, + "Restoring pos %d,%d size %d x %d for %s\n", + x, y, w, h, window->desc); meta_window_move_resize_internal (window, META_DO_GRAVITY_ADJUST, @@ -710,7 +715,12 @@ meta_window_free (MetaWindow *window) } if (window->has_struts) - invalidate_work_areas (window); + { + meta_topic (META_DEBUG_WORKAREA, + "Unmanaging window %s which has struts, so invalidating work areas\n", + window->desc); + invalidate_work_areas (window); + } if (window->display->grab_window == window) meta_display_end_grab_op (window->display, @@ -970,7 +980,8 @@ idle_calc_showing (gpointer data) GSList *tmp; GSList *copy; - meta_verbose ("Clearing the calc_showing queue\n"); + meta_topic (META_DEBUG_WINDOW_STATE, + "Clearing the calc_showing queue\n"); /* Work with a copy, for reentrancy. The allowed reentrancy isn't * complete; destroying a window while we're in here would result in @@ -1021,8 +1032,9 @@ meta_window_unqueue_calc_showing (MetaWindow *window) if (!window->calc_showing_queued) return; - meta_verbose ("Removing %s from the calc_showing queue\n", - window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "Removing %s from the calc_showing queue\n", + window->desc); /* Note that window may not actually be in move_resize_pending * because it may have been in "copy" inside the idle handler @@ -1057,8 +1069,9 @@ meta_window_queue_calc_showing (MetaWindow *window) if (window->calc_showing_queued) return; - meta_verbose ("Putting %s in the calc_showing queue\n", - window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "Putting %s in the calc_showing queue\n", + window->desc); window->calc_showing_queued = TRUE; @@ -1073,8 +1086,9 @@ meta_window_show (MetaWindow *window) { gboolean did_placement; - meta_verbose ("Showing window %s, shaded: %d iconic: %d placed: %d\n", - window->desc, window->shaded, window->iconic, window->placed); + meta_topic (META_DEBUG_WINDOW_STATE, + "Showing window %s, shaded: %d iconic: %d placed: %d\n", + window->desc, window->shaded, window->iconic, window->placed); did_placement = FALSE; if (!window->placed) @@ -1103,7 +1117,8 @@ meta_window_show (MetaWindow *window) if (window->frame && !window->frame->mapped) { - meta_verbose ("Frame actually needs map\n"); + meta_topic (META_DEBUG_WINDOW_STATE, + "Frame actually needs map\n"); window->frame->mapped = TRUE; meta_ui_map_frame (window->screen->ui, window->frame->xwindow); } @@ -1112,9 +1127,11 @@ meta_window_show (MetaWindow *window) { if (window->mapped) { - meta_verbose ("%s actually needs unmap (shaded)\n", window->desc); - meta_verbose ("Incrementing unmaps_pending on %s for shade\n", - window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "%s actually needs unmap (shaded)\n", window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "Incrementing unmaps_pending on %s for shade\n", + window->desc); window->mapped = FALSE; window->unmaps_pending += 1; meta_error_trap_push (window->display); @@ -1132,7 +1149,8 @@ meta_window_show (MetaWindow *window) { if (!window->mapped) { - meta_verbose ("%s actually needs map\n", window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "%s actually needs map\n", window->desc); window->mapped = TRUE; meta_error_trap_push (window->display); XMapWindow (window->display->xdisplay, window->xwindow); @@ -1179,13 +1197,14 @@ meta_window_hide (MetaWindow *window) { gboolean did_hide; - meta_verbose ("Hiding window %s\n", window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "Hiding window %s\n", window->desc); did_hide = FALSE; if (window->frame && window->frame->mapped) { - meta_verbose ("Frame actually needs unmap\n"); + meta_topic (META_DEBUG_WINDOW_STATE, "Frame actually needs unmap\n"); window->frame->mapped = FALSE; meta_ui_unmap_frame (window->screen->ui, window->frame->xwindow); did_hide = TRUE; @@ -1193,9 +1212,11 @@ meta_window_hide (MetaWindow *window) if (window->mapped) { - meta_verbose ("%s actually needs unmap\n", window->desc); - meta_verbose ("Incrementing unmaps_pending on %s for hide\n", - window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "%s actually needs unmap\n", window->desc); + meta_topic (META_DEBUG_WINDOW_STATE, + "Incrementing unmaps_pending on %s for hide\n", + window->desc); window->mapped = FALSE; window->unmaps_pending += 1; meta_error_trap_push (window->display); @@ -1213,7 +1234,12 @@ meta_window_hide (MetaWindow *window) if (did_hide) { if (window->has_struts) - invalidate_work_areas (window); + { + meta_topic (META_DEBUG_WORKAREA, + "Unmapped window %s with struts, so invalidating work areas\n", + window->desc); + invalidate_work_areas (window); + } } } @@ -1258,7 +1284,8 @@ meta_window_maximize (MetaWindow *window) { if (!window->maximized) { - meta_verbose ("Maximizing %s\n", window->desc); + meta_topic (META_DEBUG_WINDOW_OPS, + "Maximizing %s\n", window->desc); window->maximized = TRUE; @@ -1285,7 +1312,8 @@ meta_window_unmaximize (MetaWindow *window) { if (window->maximized) { - meta_verbose ("Unmaximizing %s\n", window->desc); + meta_topic (META_DEBUG_WINDOW_OPS, + "Unmaximizing %s\n", window->desc); window->maximized = FALSE; @@ -1303,7 +1331,8 @@ meta_window_unmaximize (MetaWindow *window) void meta_window_shade (MetaWindow *window) { - meta_verbose ("Shading %s\n", window->desc); + meta_topic (META_DEBUG_WINDOW_OPS, + "Shading %s\n", window->desc); if (!window->shaded) { if (window->mapped) @@ -1348,7 +1377,8 @@ meta_window_shade (MetaWindow *window) void meta_window_unshade (MetaWindow *window) { - meta_verbose ("Unshading %s\n", window->desc); + meta_topic (META_DEBUG_WINDOW_OPS, + "Unshading %s\n", window->desc); if (window->shaded) { window->shaded = FALSE; @@ -1566,11 +1596,12 @@ meta_window_move_resize_internal (MetaWindow *window, { int oldx, oldy; meta_window_get_position (window, &oldx, &oldy); - meta_verbose ("Move/resize %s to %d,%d %dx%d%s%s from %d,%d %dx%d\n", - window->desc, root_x_nw, root_y_nw, w, h, - is_configure_request ? " (configure request)" : "", - is_user_action ? " (user move/resize)" : "", - oldx, oldy, window->rect.width, window->rect.height); + meta_topic (META_DEBUG_GEOMETRY, + "Move/resize %s to %d,%d %dx%d%s%s from %d,%d %dx%d\n", + window->desc, root_x_nw, root_y_nw, w, h, + is_configure_request ? " (configure request)" : "", + is_user_action ? " (user move/resize)" : "", + oldx, oldy, window->rect.width, window->rect.height); } if (window->frame) @@ -1578,7 +1609,8 @@ meta_window_move_resize_internal (MetaWindow *window, &fgeom); constrain_size (window, &fgeom, w, h, &w, &h); - meta_verbose ("Constrained resize of %s to %d x %d\n", window->desc, w, h); + meta_topic (META_DEBUG_GEOMETRY, + "Constrained resize of %s to %d x %d\n", window->desc, w, h); if (w != window->rect.width || h != window->rect.height) @@ -1609,9 +1641,10 @@ meta_window_move_resize_internal (MetaWindow *window, window->frame->rect.width = new_w; window->frame->rect.height = new_h; - meta_verbose ("Calculated frame size %dx%d\n", - window->frame->rect.width, - window->frame->rect.height); + meta_topic (META_DEBUG_GEOMETRY, + "Calculated frame size %dx%d\n", + window->frame->rect.width, + window->frame->rect.height); } else { @@ -1632,8 +1665,9 @@ meta_window_move_resize_internal (MetaWindow *window, &root_x_nw, &root_y_nw); - meta_verbose ("Compensated position for gravity, new pos %d,%d\n", - root_x_nw, root_y_nw); + meta_topic (META_DEBUG_GEOMETRY, + "Compensated position for gravity, new pos %d,%d\n", + root_x_nw, root_y_nw); } /* There can be somewhat bogus interactions between gravity @@ -1705,8 +1739,9 @@ meta_window_move_resize_internal (MetaWindow *window, root_x_nw, root_y_nw, &root_x_nw, &root_y_nw); - meta_verbose ("Constrained position to %d,%d\n", - root_x_nw, root_y_nw); + meta_topic (META_DEBUG_GEOMETRY, + "Constrained position to %d,%d\n", + root_x_nw, root_y_nw); if (window->frame) { @@ -1879,12 +1914,13 @@ meta_window_move_resize_internal (MetaWindow *window, { int newx, newy; meta_window_get_position (window, &newx, &newy); - meta_verbose ("Syncing new client geometry %d,%d %dx%d, border: %s pos: %s size: %s\n", - newx, newy, - window->rect.width, window->rect.height, - mask & CWBorderWidth ? "true" : "false", - need_move_client ? "true" : "false", - need_resize_client ? "true" : "false"); + meta_topic (META_DEBUG_GEOMETRY, + "Syncing new client geometry %d,%d %dx%d, border: %s pos: %s size: %s\n", + newx, newy, + window->rect.width, window->rect.height, + mask & CWBorderWidth ? "true" : "false", + need_move_client ? "true" : "false", + need_resize_client ? "true" : "false"); } meta_error_trap_push (window->display); @@ -1924,14 +1960,15 @@ meta_window_move_resize_internal (MetaWindow *window, { int newx, newy; meta_window_get_position (window, &newx, &newy); - meta_verbose ("New size/position %d,%d %dx%d (user %d,%d %dx%d)\n", - newx, newy, window->rect.width, window->rect.height, - window->user_rect.x, window->user_rect.y, - window->user_rect.width, window->user_rect.height); + meta_topic (META_DEBUG_GEOMETRY, + "New size/position %d,%d %dx%d (user %d,%d %dx%d)\n", + newx, newy, window->rect.width, window->rect.height, + window->user_rect.x, window->user_rect.y, + window->user_rect.width, window->user_rect.height); } else { - meta_verbose ("Size/position not modified\n"); + meta_topic (META_DEBUG_GEOMETRY, "Size/position not modified\n"); } /* Update struts for new window size */ @@ -1944,7 +1981,9 @@ meta_window_move_resize_internal (MetaWindow *window, * above. We rely on reaching an equilibrium state, which * is somewhat fragile, though. */ - + + meta_topic (META_DEBUG_WORKAREA, "Window %s resized so invalidating its work areas\n", + window->desc); invalidate_work_areas (window); } @@ -2061,7 +2100,7 @@ idle_move_resize (gpointer data) GSList *tmp; GSList *copy; - meta_verbose ("Clearing the move_resize queue\n"); + meta_topic (META_DEBUG_GEOMETRY, "Clearing the move_resize queue\n"); /* Work with a copy, for reentrancy. The allowed reentrancy isn't * complete; destroying a window while we're in here would result in @@ -2102,8 +2141,9 @@ meta_window_unqueue_move_resize (MetaWindow *window) if (!window->move_resize_queued) return; - meta_verbose ("Removing %s from the move_resize queue\n", - window->desc); + meta_topic (META_DEBUG_GEOMETRY, + "Removing %s from the move_resize queue\n", + window->desc); /* Note that window may not actually be in move_resize_pending * because it may have been in "copy" inside the idle handler @@ -2144,8 +2184,9 @@ meta_window_queue_move_resize (MetaWindow *window) if (window->move_resize_queued) return; - meta_verbose ("Putting %s in the move_resize queue\n", - window->desc); + meta_topic (META_DEBUG_GEOMETRY, + "Putting %s in the move_resize queue\n", + window->desc); window->move_resize_queued = TRUE; @@ -2309,16 +2350,18 @@ meta_window_delete (MetaWindow *window, meta_error_trap_push (window->display); if (window->delete_window) { - meta_verbose ("Deleting %s with delete_window request\n", - window->desc); + meta_topic (META_DEBUG_WINDOW_OPS, + "Deleting %s with delete_window request\n", + window->desc); meta_window_send_icccm_message (window, window->display->atom_wm_delete_window, timestamp); } else { - meta_verbose ("Deleting %s with explicit kill\n", - window->desc); + meta_topic (META_DEBUG_WINDOW_OPS, + "Deleting %s with explicit kill\n", + window->desc); XKillClient (window->display->xdisplay, window->xwindow); } @@ -2520,7 +2563,8 @@ meta_window_set_current_workspace_hint (MetaWindow *window) void meta_window_raise (MetaWindow *window) { - meta_verbose ("Raising window %s\n", window->desc); + meta_topic (META_DEBUG_WINDOW_OPS, + "Raising window %s\n", window->desc); meta_stack_raise (window->screen->stack, window); } @@ -2528,7 +2572,8 @@ meta_window_raise (MetaWindow *window) void meta_window_lower (MetaWindow *window) { - meta_verbose ("Lowering window %s\n", window->desc); + meta_topic (META_DEBUG_WINDOW_OPS, + "Lowering window %s\n", window->desc); meta_stack_lower (window->screen->stack, window); } @@ -2954,7 +2999,8 @@ meta_window_client_message (MetaWindow *window, if (event->xclient.data.l[1] & WIN_HINTS_DO_NOT_COVER) { - meta_verbose ("Setting WIN_HINTS_DO_NOT_COVER\n"); + meta_topic (META_DEBUG_WORKAREA, + "Setting WIN_HINTS_DO_NOT_COVER\n"); data[0] = WIN_HINTS_DO_NOT_COVER; @@ -2967,7 +3013,8 @@ meta_window_client_message (MetaWindow *window, } else { - meta_verbose ("Unsetting WIN_HINTS_DO_NOT_COVER\n"); + meta_topic (META_DEBUG_WORKAREA, + "Unsetting WIN_HINTS_DO_NOT_COVER\n"); data[0] = 0; @@ -3240,10 +3287,11 @@ send_configure_notify (MetaWindow *window) event.xconfigure.above = None; /* FIXME */ event.xconfigure.override_redirect = False; - meta_verbose ("Sending synthetic configure notify to %s with x: %d y: %d w: %d h: %d\n", - window->desc, - event.xconfigure.x, event.xconfigure.y, - event.xconfigure.width, event.xconfigure.height); + meta_topic (META_DEBUG_GEOMETRY, + "Sending synthetic configure notify to %s with x: %d y: %d w: %d h: %d\n", + window->desc, + event.xconfigure.x, event.xconfigure.y, + event.xconfigure.width, event.xconfigure.height); meta_error_trap_push (window->display); XSendEvent (window->display->xdisplay, @@ -3268,48 +3316,48 @@ spew_size_hints_differences (const XSizeHints *old, const XSizeHints *new) { if (FLAG_CHANGED (old, new, USPosition)) - meta_verbose ("XSizeHints: USPosition now %s\n", - FLAG_TOGGLED_ON (old, new, USPosition) ? "set" : "unset"); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USPosition now %s\n", + FLAG_TOGGLED_ON (old, new, USPosition) ? "set" : "unset"); if (FLAG_CHANGED (old, new, USSize)) - meta_verbose ("XSizeHints: USSize now %s\n", - FLAG_TOGGLED_ON (old, new, USSize) ? "set" : "unset"); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USSize now %s\n", + FLAG_TOGGLED_ON (old, new, USSize) ? "set" : "unset"); if (FLAG_CHANGED (old, new, PPosition)) - meta_verbose ("XSizeHints: PPosition now %s\n", - FLAG_TOGGLED_ON (old, new, PPosition) ? "set" : "unset"); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PPosition now %s\n", + FLAG_TOGGLED_ON (old, new, PPosition) ? "set" : "unset"); if (FLAG_CHANGED (old, new, PSize)) - meta_verbose ("XSizeHints: PSize now %s\n", - FLAG_TOGGLED_ON (old, new, PSize) ? "set" : "unset"); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PSize now %s\n", + FLAG_TOGGLED_ON (old, new, PSize) ? "set" : "unset"); if (FLAG_CHANGED (old, new, PMinSize)) - meta_verbose ("XSizeHints: PMinSize now %s (%d x %d -> %d x %d)\n", - FLAG_TOGGLED_ON (old, new, PMinSize) ? "set" : "unset", - old->min_width, old->min_height, - new->min_width, new->min_height); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PMinSize now %s (%d x %d -> %d x %d)\n", + FLAG_TOGGLED_ON (old, new, PMinSize) ? "set" : "unset", + old->min_width, old->min_height, + new->min_width, new->min_height); if (FLAG_CHANGED (old, new, PMaxSize)) - meta_verbose ("XSizeHints: PMaxSize now %s (%d x %d -> %d x %d)\n", - FLAG_TOGGLED_ON (old, new, PMaxSize) ? "set" : "unset", - old->max_width, old->max_height, - new->max_width, new->max_height); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PMaxSize now %s (%d x %d -> %d x %d)\n", + FLAG_TOGGLED_ON (old, new, PMaxSize) ? "set" : "unset", + old->max_width, old->max_height, + new->max_width, new->max_height); if (FLAG_CHANGED (old, new, PResizeInc)) - meta_verbose ("XSizeHints: PResizeInc now %s (width_inc %d -> %d height_inc %d -> %d)\n", - FLAG_TOGGLED_ON (old, new, PResizeInc) ? "set" : "unset", - old->width_inc, new->width_inc, - old->height_inc, new->height_inc); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PResizeInc now %s (width_inc %d -> %d height_inc %d -> %d)\n", + FLAG_TOGGLED_ON (old, new, PResizeInc) ? "set" : "unset", + old->width_inc, new->width_inc, + old->height_inc, new->height_inc); if (FLAG_CHANGED (old, new, PAspect)) - meta_verbose ("XSizeHints: PAspect now %s (min %d/%d -> %d/%d max %d/%d -> %d/%d)\n", - FLAG_TOGGLED_ON (old, new, PAspect) ? "set" : "unset", - old->min_aspect.x, old->min_aspect.y, - new->min_aspect.x, new->min_aspect.y, - old->max_aspect.x, old->max_aspect.y, - new->max_aspect.x, new->max_aspect.y); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PAspect now %s (min %d/%d -> %d/%d max %d/%d -> %d/%d)\n", + FLAG_TOGGLED_ON (old, new, PAspect) ? "set" : "unset", + old->min_aspect.x, old->min_aspect.y, + new->min_aspect.x, new->min_aspect.y, + old->max_aspect.x, old->max_aspect.y, + new->max_aspect.x, new->max_aspect.y); if (FLAG_CHANGED (old, new, PBaseSize)) - meta_verbose ("XSizeHints: PBaseSize now %s (%d x %d -> %d x %d)\n", - FLAG_TOGGLED_ON (old, new, PBaseSize) ? "set" : "unset", - old->base_width, old->base_height, - new->base_width, new->base_height); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PBaseSize now %s (%d x %d -> %d x %d)\n", + FLAG_TOGGLED_ON (old, new, PBaseSize) ? "set" : "unset", + old->base_width, old->base_height, + new->base_width, new->base_height); if (FLAG_CHANGED (old, new, PWinGravity)) - meta_verbose ("XSizeHints: PWinGravity now %s (%d -> %d)\n", - FLAG_TOGGLED_ON (old, new, PWinGravity) ? "set" : "unset", - old->win_gravity, new->win_gravity); + meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PWinGravity now %s (%d -> %d)\n", + FLAG_TOGGLED_ON (old, new, PWinGravity) ? "set" : "unset", + old->win_gravity, new->win_gravity); } static int @@ -3319,7 +3367,7 @@ update_size_hints (MetaWindow *window) gulong supplied; XSizeHints old_hints; - meta_verbose ("Updating WM_NORMAL_HINTS for %s\n", window->desc); + meta_topic (META_DEBUG_GEOMETRY, "Updating WM_NORMAL_HINTS for %s\n", window->desc); old_hints = window->size_hints; @@ -3355,10 +3403,10 @@ update_size_hints (MetaWindow *window) if (window->size_hints.flags & PBaseSize) { - meta_verbose ("Window %s sets base size %d x %d\n", - window->desc, - window->size_hints.base_width, - window->size_hints.base_height); + meta_topic (META_DEBUG_GEOMETRY, "Window %s sets base size %d x %d\n", + window->desc, + window->size_hints.base_width, + window->size_hints.base_height); } else if (window->size_hints.flags & PMinSize) { @@ -3374,10 +3422,10 @@ update_size_hints (MetaWindow *window) if (window->size_hints.flags & PMinSize) { - meta_verbose ("Window %s sets min size %d x %d\n", - window->desc, - window->size_hints.min_width, - window->size_hints.min_height); + meta_topic (META_DEBUG_GEOMETRY, "Window %s sets min size %d x %d\n", + window->desc, + window->size_hints.min_width, + window->size_hints.min_height); } else if (window->size_hints.flags & PBaseSize) { @@ -3393,10 +3441,10 @@ update_size_hints (MetaWindow *window) if (window->size_hints.flags & PMaxSize) { - meta_verbose ("Window %s sets max size %d x %d\n", - window->desc, - window->size_hints.max_width, - window->size_hints.max_height); + meta_topic (META_DEBUG_GEOMETRY, "Window %s sets max size %d x %d\n", + window->desc, + window->size_hints.max_width, + window->size_hints.max_height); } else { @@ -3408,38 +3456,40 @@ update_size_hints (MetaWindow *window) if (window->size_hints.max_width < window->size_hints.min_width) { /* someone is on crack */ - meta_warning (_("Window %s sets max width %d less than min width %d, disabling resize\n"), - window->desc, - window->size_hints.max_width, - window->size_hints.min_width); + meta_topic (META_DEBUG_GEOMETRY, + "Window %s sets max width %d less than min width %d, disabling resize\n", + window->desc, + window->size_hints.max_width, + window->size_hints.min_width); window->size_hints.max_width = window->size_hints.min_width; } if (window->size_hints.max_height < window->size_hints.min_height) { /* another cracksmoker */ - meta_warning (_("Window %s sets max height %d less than min height %d, disabling resize\n"), - window->desc, - window->size_hints.max_height, - window->size_hints.min_height); + meta_topic (META_DEBUG_GEOMETRY, + "Window %s sets max height %d less than min height %d, disabling resize\n", + window->desc, + window->size_hints.max_height, + window->size_hints.min_height); window->size_hints.max_height = window->size_hints.min_height; } if (window->size_hints.flags & PResizeInc) { - meta_verbose ("Window %s sets resize width inc: %d height inc: %d\n", - window->desc, - window->size_hints.width_inc, - window->size_hints.height_inc); + meta_topic (META_DEBUG_GEOMETRY, "Window %s sets resize width inc: %d height inc: %d\n", + window->desc, + window->size_hints.width_inc, + window->size_hints.height_inc); if (window->size_hints.width_inc == 0) { window->size_hints.width_inc = 1; - meta_verbose ("Corrected 0 width_inc to 1\n"); + meta_topic (META_DEBUG_GEOMETRY, "Corrected 0 width_inc to 1\n"); } if (window->size_hints.height_inc == 0) { window->size_hints.height_inc = 1; - meta_verbose ("Corrected 0 height_inc to 1\n"); + meta_topic (META_DEBUG_GEOMETRY, "Corrected 0 height_inc to 1\n"); } } else @@ -3451,12 +3501,12 @@ update_size_hints (MetaWindow *window) if (window->size_hints.flags & PAspect) { - meta_verbose ("Window %s sets min_aspect: %d/%d max_aspect: %d/%d\n", - window->desc, - window->size_hints.min_aspect.x, - window->size_hints.min_aspect.y, - window->size_hints.max_aspect.x, - window->size_hints.max_aspect.y); + meta_topic (META_DEBUG_GEOMETRY, "Window %s sets min_aspect: %d/%d max_aspect: %d/%d\n", + window->desc, + window->size_hints.min_aspect.x, + window->size_hints.min_aspect.y, + window->size_hints.max_aspect.x, + window->size_hints.max_aspect.y); /* don't divide by 0 */ if (window->size_hints.min_aspect.y < 1) @@ -3475,14 +3525,14 @@ update_size_hints (MetaWindow *window) if (window->size_hints.flags & PWinGravity) { - meta_verbose ("Window %s sets gravity %d\n", - window->desc, - window->size_hints.win_gravity); + meta_topic (META_DEBUG_GEOMETRY, "Window %s sets gravity %d\n", + window->desc, + window->size_hints.win_gravity); } else { - meta_verbose ("Window %s doesn't set gravity, using NW\n", - window->desc); + meta_topic (META_DEBUG_GEOMETRY, "Window %s doesn't set gravity, using NW\n", + window->desc); window->size_hints.win_gravity = NorthWestGravity; window->size_hints.flags |= PWinGravity; } @@ -4832,6 +4882,9 @@ update_struts (MetaWindow *window) } } + meta_topic (META_DEBUG_WORKAREA, + "Invalidating work areas of window %s due to struts update\n", + window->desc); invalidate_work_areas (window); } @@ -5737,8 +5790,9 @@ meta_window_get_work_area (MetaWindow *window, area->width = window->screen->width - left_strut - right_strut; area->height = window->screen->height - top_strut - bottom_strut; - meta_verbose ("Window %s has work area %d,%d %d x %d\n", - window->desc, area->x, area->y, area->width, area->height); + meta_topic (META_DEBUG_WORKAREA, + "Window %s has work area %d,%d %d x %d\n", + window->desc, area->x, area->y, area->width, area->height); } gboolean diff --git a/src/workspace.c b/src/workspace.c index 70bf08036..e7b19dc4d 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -104,7 +104,12 @@ meta_workspace_add_window (MetaWorkspace *workspace, meta_window_queue_calc_showing (window); if (window->has_struts) - meta_workspace_invalidate_work_area (workspace); + { + meta_topic (META_DEBUG_WORKAREA, + "Invalidating work area of workspace %d since we're adding window %s to it\n", + meta_workspace_index (workspace), window->desc); + meta_workspace_invalidate_work_area (workspace); + } /* queue a move_resize since changing workspaces may change * the relevant struts @@ -126,7 +131,12 @@ meta_workspace_remove_window (MetaWorkspace *workspace, meta_window_queue_calc_showing (window); if (window->has_struts) - meta_workspace_invalidate_work_area (workspace); + { + meta_topic (META_DEBUG_WORKAREA, + "Invalidating work area of workspace %d since we're removing window %s from it\n", + meta_workspace_index (workspace), window->desc); + meta_workspace_invalidate_work_area (workspace); + } /* queue a move_resize since changing workspaces may change * the relevant struts @@ -326,10 +336,16 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace) GList *tmp; if (workspace->work_area_invalid) - return; + { + meta_topic (META_DEBUG_WORKAREA, + "Work area for workspace %d is already invalid\n", + meta_workspace_index (workspace)); + return; + } - meta_verbose ("Invalidating work area for workspace %d\n", - meta_workspace_index (workspace)); + meta_topic (META_DEBUG_WORKAREA, + "Invalidating work area for workspace %d\n", + meta_workspace_index (workspace)); workspace->work_area_invalid = TRUE; @@ -399,12 +415,13 @@ meta_workspace_get_work_area (MetaWorkspace *workspace, workspace->work_area_invalid = FALSE; - meta_verbose ("Workspace %d has work area %d,%d %d x %d\n", - meta_workspace_index (workspace), - workspace->work_area.x, - workspace->work_area.y, - workspace->work_area.width, - workspace->work_area.height); + meta_topic (META_DEBUG_WORKAREA, + "Computed work area for workspace %d: %d,%d %d x %d\n", + meta_workspace_index (workspace), + workspace->work_area.x, + workspace->work_area.y, + workspace->work_area.width, + workspace->work_area.height); } *area = workspace->work_area;