From 780209a224f8d688a0f78907018e7a69bed8097b Mon Sep 17 00:00:00 2001 From: Sean Middleditch Date: Sat, 5 Mar 2011 16:55:43 -0800 Subject: [PATCH 5/6] Convert panel plugins to GTK 2.24 with GSEAL The only incomplete/missing feature is that the separator plugin's dots style is now short-cutted to the handle style, as I'm not sure how to render the dots with Cairo just yet. My first instinct was to just remove it (why does anyone need selectable styles for an inherently useless plugin anyway?), but I figured it was best to keep it and try to work on the Cairo port later if/when someone convinces me to care. Or to let someone else do the port. Primary problem is that Cairo does not do stippled renders, so you'd probably have to render the square pattern to a Cairo group, add padding, and then render it as a fill. --- plugins/applicationsmenu/applicationsmenu.c | 23 ++++++-- plugins/clock/clock-analog.c | 16 +++--- plugins/clock/clock-binary.c | 30 +++++----- plugins/clock/clock-lcd.c | 18 ++++--- plugins/clock/clock.c | 17 ++++-- plugins/directorymenu/directorymenu.c | 2 +- plugins/launcher/launcher-dialog.c | 47 ++++++++++------- plugins/launcher/launcher.c | 76 ++++++++++++++------------- plugins/pager/pager.c | 13 +++-- plugins/separator/separator.c | 65 +++++++++++++---------- plugins/systray/systray-box.c | 16 +++--- plugins/systray/systray-manager.c | 28 +++++----- plugins/systray/systray-socket.c | 55 ++++++++++++------- plugins/systray/systray.c | 10 ++-- plugins/tasklist/tasklist-widget.c | 74 ++++++++++++++------------ plugins/tasklist/tasklist.c | 16 +++--- plugins/windowmenu/windowmenu.c | 4 +- 17 files changed, 290 insertions(+), 220 deletions(-) diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c index df0bb5c..0ea7004 100644 --- a/plugins/applicationsmenu/applicationsmenu.c +++ b/plugins/applicationsmenu/applicationsmenu.c @@ -502,17 +502,30 @@ static void applications_menu_plugin_configure_plugin_edit (GtkWidget *button, ApplicationsMenuPlugin *plugin) { - GError *error = NULL; - const gchar *command = "alacarte"; + GError *error = NULL; + const gchar *command = "alacarte"; + GAppInfo *appinfo; + GdkAppLaunchContext *context; panel_return_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin)); panel_return_if_fail (GTK_IS_WIDGET (button)); - if (!gdk_spawn_command_line_on_screen (gtk_widget_get_screen (button), command, &error)) + /* create the application information and launch context informtaion */ + appinfo = g_app_info_create_from_commandline (command, NULL, 0, &error); + + context = gdk_app_launch_context_new (); + gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (button)); + + /* execute the command */ + if (!g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), &error)) { xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."), command); g_error_free (error); } + + /* cleanup */ + g_object_unref (appinfo); + g_object_unref (context); } @@ -610,7 +623,7 @@ applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, panel_return_val_if_fail (value == NULL || G_IS_VALUE (value), FALSE); if (strcmp (name, "popup") == 0 - && GTK_WIDGET_VISIBLE (panel_plugin) + && gtk_widget_get_visible (GTK_WIDGET (panel_plugin)) && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)) && panel_utils_grab_available ()) { @@ -822,7 +835,7 @@ applications_menu_plugin_menu_reload (ApplicationsMenuPlugin *plugin) /* if the menu is opened, do not destroy it under the users' * cursor, else destroy the menu in an idle, to give garcon * time to finalize the events that triggered the reload */ - if (GTK_WIDGET_VISIBLE (plugin->menu)) + if (gtk_widget_get_visible (GTK_WIDGET ((plugin->menu)))) g_signal_connect (G_OBJECT (plugin->menu), "selection-done", G_CALLBACK (exo_gtk_object_destroy_later), NULL); else diff --git a/plugins/clock/clock-analog.c b/plugins/clock/clock-analog.c index 63a8394..ce9721d 100644 --- a/plugins/clock/clock-analog.c +++ b/plugins/clock/clock-analog.c @@ -219,20 +219,22 @@ xfce_clock_analog_expose_event (GtkWidget *widget, gdouble angle, radius; cairo_t *cr; struct tm tm; + GtkAllocation allocation; panel_return_val_if_fail (XFCE_CLOCK_IS_ANALOG (analog), FALSE); /* get center of the widget and the radius */ - xc = (widget->allocation.width / 2.0); - yc = (widget->allocation.height / 2.0); + gtk_widget_get_allocation (widget, &allocation); + xc = (allocation.width / 2.0); + yc = (allocation.height / 2.0); radius = MIN (xc, yc); /* add the window offset */ - xc += widget->allocation.x; - yc += widget->allocation.y; + xc += allocation.x; + yc += allocation.y; /* get the cairo context */ - cr = gdk_cairo_create (widget->window); + cr = gdk_cairo_create (gtk_widget_get_window (widget)); if (G_LIKELY (cr != NULL)) { @@ -245,7 +247,7 @@ xfce_clock_analog_expose_event (GtkWidget *widget, /* set the line properties */ cairo_set_line_width (cr, 1); - gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_WIDGET_STATE (widget)]); + gdk_cairo_set_source_color (cr, >k_widget_get_style (widget)->fg[gtk_widget_get_state (widget)]); /* draw the ticks */ xfce_clock_analog_draw_ticks (cr, xc, yc, radius); @@ -354,7 +356,7 @@ xfce_clock_analog_update (gpointer user_data) panel_return_val_if_fail (XFCE_CLOCK_IS_ANALOG (user_data), FALSE); /* update if the widget if visible */ - if (G_LIKELY (GTK_WIDGET_VISIBLE (widget))) + if (G_LIKELY (gtk_widget_get_visible (widget))) gtk_widget_queue_draw (widget); return TRUE; diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c index de0e2aa..1a1f08a 100644 --- a/plugins/clock/clock-binary.c +++ b/plugins/clock/clock-binary.c @@ -272,15 +272,15 @@ xfce_clock_binary_expose_event_true_binary (XfceClockBinary *binary, gint w, h, x; gint ticks; - if (G_UNLIKELY (GTK_WIDGET_STATE (binary) == GTK_STATE_INSENSITIVE)) + if (G_UNLIKELY (gtk_widget_get_state (GTK_WIDGET (binary)) == GTK_STATE_INSENSITIVE)) { - inactive = &(GTK_WIDGET (binary)->style->mid[GTK_STATE_INSENSITIVE]); - active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_INSENSITIVE]); + inactive = &(gtk_widget_get_style (GTK_WIDGET (binary))->mid[GTK_STATE_INSENSITIVE]); + active = &(gtk_widget_get_style (GTK_WIDGET (binary))->dark[GTK_STATE_INSENSITIVE]); } else { - inactive = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_NORMAL]); - active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_SELECTED]); + inactive = &(gtk_widget_get_style (GTK_WIDGET (binary))->dark[GTK_STATE_NORMAL]); + active = &(gtk_widget_get_style (GTK_WIDGET (binary))->dark[GTK_STATE_SELECTED]); } clock_plugin_get_localtime (&tm); @@ -356,15 +356,15 @@ xfce_clock_binary_expose_event_binary (XfceClockBinary *binary, gint w, h, y; gint ticks; - if (G_UNLIKELY (GTK_WIDGET_STATE (binary) == GTK_STATE_INSENSITIVE)) + if (G_UNLIKELY (gtk_widget_get_state (GTK_WIDGET (binary)) == GTK_STATE_INSENSITIVE)) { - inactive = &(GTK_WIDGET (binary)->style->mid[GTK_STATE_INSENSITIVE]); - active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_INSENSITIVE]); + inactive = &(gtk_widget_get_style (GTK_WIDGET (binary))->mid[GTK_STATE_INSENSITIVE]); + active = &(gtk_widget_get_style (GTK_WIDGET (binary))->dark[GTK_STATE_INSENSITIVE]); } else { - inactive = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_NORMAL]); - active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_SELECTED]); + inactive = &(gtk_widget_get_style (GTK_WIDGET (binary))->dark[GTK_STATE_NORMAL]); + active = &(gtk_widget_get_style (GTK_WIDGET (binary))->dark[GTK_STATE_SELECTED]); } clock_plugin_get_localtime (&tm); @@ -442,9 +442,9 @@ xfce_clock_binary_expose_event (GtkWidget *widget, gint diff; panel_return_val_if_fail (XFCE_CLOCK_IS_BINARY (binary), FALSE); - panel_return_val_if_fail (GDK_IS_WINDOW (widget->window), FALSE); + panel_return_val_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (widget)), FALSE); - cr = gdk_cairo_create (widget->window); + cr = gdk_cairo_create (gtk_widget_get_window (widget)); if (G_LIKELY (cr != NULL)) { /* clip the drawing region */ @@ -453,7 +453,7 @@ xfce_clock_binary_expose_event (GtkWidget *widget, gtk_misc_get_padding (GTK_MISC (widget), &pad_x, &pad_y); - alloc = widget->allocation; + gtk_widget_get_allocation (widget, &alloc); alloc.width -= 1 + 2 * pad_x; alloc.height -= 1 + 2 * pad_y; alloc.x += pad_x + 1; @@ -473,7 +473,7 @@ xfce_clock_binary_expose_event (GtkWidget *widget, if (binary->show_grid) { - color = &(GTK_WIDGET (binary)->style->light[GTK_STATE_SELECTED]); + color = &(gtk_widget_get_style (GTK_WIDGET (binary))->light[GTK_STATE_SELECTED]); gdk_cairo_set_source_color (cr, color); cairo_set_line_width (cr, 1); @@ -525,7 +525,7 @@ xfce_clock_binary_update (gpointer user_data) panel_return_val_if_fail (XFCE_CLOCK_IS_BINARY (user_data), FALSE); /* update if the widget if visible */ - if (G_LIKELY (GTK_WIDGET_VISIBLE (widget))) + if (G_LIKELY (gtk_widget_get_visible (widget))) gtk_widget_queue_draw (widget); return TRUE; diff --git a/plugins/clock/clock-lcd.c b/plugins/clock/clock-lcd.c index b618cf6..84650ec 100644 --- a/plugins/clock/clock-lcd.c +++ b/plugins/clock/clock-lcd.c @@ -284,6 +284,7 @@ xfce_clock_lcd_expose_event (GtkWidget *widget, gdouble size; gdouble ratio; struct tm tm; + GtkAllocation allocation; panel_return_val_if_fail (XFCE_CLOCK_IS_LCD (lcd), FALSE); @@ -291,22 +292,23 @@ xfce_clock_lcd_expose_event (GtkWidget *widget, ratio = xfce_clock_lcd_get_ratio (XFCE_CLOCK_LCD (widget)); /* make sure we also fit on small vertical panels */ - size = MIN ((gdouble) widget->allocation.width / ratio, widget->allocation.height); + gtk_widget_get_allocation (widget, &allocation); + size = MIN ((gdouble) allocation.width / ratio, allocation.height); /* begin offsets */ - offset_x = rint ((widget->allocation.width - (size * ratio)) / 2.00); - offset_y = rint ((widget->allocation.height - size) / 2.00); + offset_x = rint ((allocation.width - (size * ratio)) / 2.00); + offset_y = rint ((allocation.height - size) / 2.00); /* only allow positive values from the base point */ - offset_x = widget->allocation.x + MAX (0.00, offset_x); - offset_y = widget->allocation.y + MAX (0.00, offset_y); + offset_x = allocation.x + MAX (0.00, offset_x); + offset_y = allocation.y + MAX (0.00, offset_y); /* get the cairo context */ - cr = gdk_cairo_create (widget->window); + cr = gdk_cairo_create (gtk_widget_get_window (widget)); if (G_LIKELY (cr != NULL)) { - gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_WIDGET_STATE (widget)]); + gdk_cairo_set_source_color (cr, >k_widget_get_style (widget)->fg[gtk_widget_get_state (widget)]); gdk_cairo_rectangle (cr, &event->area); cairo_clip (cr); cairo_push_group (cr); @@ -586,7 +588,7 @@ xfce_clock_lcd_update (gpointer user_data) panel_return_val_if_fail (XFCE_CLOCK_IS_LCD (user_data), FALSE); /* update if the widget if visible */ - if (G_LIKELY (GTK_WIDGET_VISIBLE (widget))) + if (G_LIKELY (gtk_widget_get_visible (widget))) gtk_widget_queue_draw (widget); return TRUE; diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c index a44fd56..edefc74 100644 --- a/plugins/clock/clock.c +++ b/plugins/clock/clock.c @@ -393,21 +393,28 @@ static gboolean clock_plugin_button_press_event (GtkWidget *widget, GdkEventButton *event) { - ClockPlugin *plugin = XFCE_CLOCK_PLUGIN (widget); - GError *error = NULL; + ClockPlugin *plugin = XFCE_CLOCK_PLUGIN (widget); + GError *error = NULL; + GAppInfo *appinfo; + GdkAppLaunchContext *context; if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && !exo_str_is_empty (plugin->command)) { /* launch command */ - if (!gdk_spawn_command_line_on_screen (gtk_widget_get_screen (widget), - plugin->command, &error)) + appinfo = (GAppInfo*) g_app_info_create_from_commandline (plugin->command, NULL, 0, &error); + context = gdk_app_launch_context_new (); + gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (widget)); + if (!g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), &error)) { xfce_dialog_show_error (NULL, error, _("Failed to execute clock command")); g_error_free (error); } + g_object_unref (context); + g_object_unref (appinfo); + return TRUE; } @@ -481,7 +488,7 @@ clock_plugin_size_changed (XfcePanelPlugin *panel_plugin, g_object_get (G_OBJECT (plugin->clock), "size-ratio", &ratio, NULL); if (ratio > 0) { - offset = MAX (plugin->frame->style->xthickness, plugin->frame->style->ythickness) + border; + offset = MAX (gtk_widget_get_style (plugin->frame)->xthickness, gtk_widget_get_style (plugin->frame)->ythickness) + border; offset *= 2; ratio_size = size - offset; } diff --git a/plugins/directorymenu/directorymenu.c b/plugins/directorymenu/directorymenu.c index b41043e..011a0e2 100644 --- a/plugins/directorymenu/directorymenu.c +++ b/plugins/directorymenu/directorymenu.c @@ -454,7 +454,7 @@ directory_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, panel_return_val_if_fail (value == NULL || G_IS_VALUE (value), FALSE); if (strcmp (name, "popup") == 0 - && GTK_WIDGET_VISIBLE (panel_plugin) + && gtk_widget_get_visible (GTK_WIDGET (panel_plugin)) && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)) && panel_utils_grab_available ()) { diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c index 7a1d6d7..90834cf 100644 --- a/plugins/launcher/launcher-dialog.c +++ b/plugins/launcher/launcher-dialog.c @@ -41,7 +41,7 @@ #ifdef GDK_WINDOWING_X11 #include -#define LAUNCHER_WIDGET_XID(widget) ((gint) GDK_WINDOW_XID (GDK_WINDOW ((widget)->window))) +#define LAUNCHER_WIDGET_XID(widget) ((gint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET ((widget))))) #else #define LAUNCHER_WIDGET_XID(widget) (0) #endif @@ -637,7 +637,7 @@ launcher_dialog_press_event (LauncherPluginDialog *dialog, object = gtk_builder_get_object (dialog->builder, object_name); panel_return_val_if_fail (GTK_IS_BUTTON (object), FALSE); - if (GTK_WIDGET_SENSITIVE (object)) + if (gtk_widget_get_sensitive (GTK_WIDGET (object))) { gtk_button_clicked (GTK_BUTTON (object)); return TRUE; @@ -688,21 +688,23 @@ static void launcher_dialog_item_button_clicked (GtkWidget *button, LauncherPluginDialog *dialog) { - const gchar *name; - const gchar *display_name = NULL; - GObject *object; - GObject *treeview; - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter_a, iter_b; - GtkTreePath *path; - gchar *command, *uri; - GdkScreen *screen; - GError *error = NULL; - GarconMenuItem *item; - GtkWidget *toplevel; - gchar *filename; - gboolean save_items = TRUE; + const gchar *name; + const gchar *display_name = NULL; + GObject *object; + GObject *treeview; + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreeIter iter_a, iter_b; + GtkTreePath *path; + gchar *command, *uri; + GdkScreen *screen; + GError *error = NULL; + GarconMenuItem *item; + GtkWidget *toplevel; + gchar *filename; + gboolean save_items = TRUE; + GAppInfo *appinfo; + GdkAppLaunchContext *context; panel_return_if_fail (GTK_IS_BUILDABLE (button)); panel_return_if_fail (GTK_IS_BUILDER (dialog->builder)); @@ -766,7 +768,7 @@ launcher_dialog_item_button_clicked (GtkWidget *button, /* build command */ uri = garcon_menu_item_get_uri (item); command = g_strdup_printf ("exo-desktop-item-edit --xid=%d '%s'", - LAUNCHER_WIDGET_XID (button), uri); + LAUNCHER_WIDGET_XID (gtk_widget_get_window (button)), uri); g_free (uri); } else @@ -780,7 +782,11 @@ launcher_dialog_item_button_clicked (GtkWidget *button, /* spawn item editor */ screen = gtk_widget_get_screen (button); - if (!gdk_spawn_command_line_on_screen (screen, command, &error)) + + appinfo = (GAppInfo*) g_app_info_create_from_commandline (command, NULL, G_APP_INFO_CREATE_NONE, &error); + context = gdk_app_launch_context_new (); + gdk_app_launch_context_set_screen (context, screen); + if (!g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), &error)) { toplevel = gtk_widget_get_toplevel (button); xfce_dialog_show_error (GTK_WINDOW (toplevel), error, @@ -788,6 +794,9 @@ launcher_dialog_item_button_clicked (GtkWidget *button, g_error_free (error); } + g_object_unref (context); + g_object_unref (appinfo); + g_free (command); save_items = FALSE; diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c index 9ba3b4e..a73ca70 100644 --- a/plugins/launcher/launcher.c +++ b/plugins/launcher/launcher.c @@ -1152,7 +1152,7 @@ launcher_plugin_remote_event (XfcePanelPlugin *panel_plugin, if (exo_str_is_equal (name, "popup") && LIST_HAS_TWO_OR_MORE_ENTRIES (plugin->items) - && (plugin->menu == NULL || !GTK_WIDGET_VISIBLE (plugin->menu))) + && (plugin->menu == NULL || !gtk_widget_get_visible (plugin->menu))) { launcher_plugin_menu_popup (plugin); @@ -1246,7 +1246,7 @@ launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin, a_width = a_height = -1; /* add the arrow size */ - if (GTK_WIDGET_VISIBLE (plugin->arrow)) + if (gtk_widget_get_visible (plugin->arrow)) { /* if the panel is horizontal */ horizontal = !!(xfce_panel_plugin_get_orientation (panel_plugin) == @@ -1345,7 +1345,7 @@ launcher_plugin_pack_widgets (LauncherPlugin *plugin) panel_return_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin)); /* leave when the arrow button is not visible */ - if (!GTK_WIDGET_VISIBLE (plugin->arrow) + if (!gtk_widget_get_visible (plugin->arrow) || pos == LAUNCHER_ARROW_INTERNAL) return; @@ -1499,7 +1499,7 @@ launcher_plugin_menu_item_drag_data_received (GtkWidget *widget, } /* hide the menu */ - gtk_widget_hide (GTK_MENU (plugin->menu)->toplevel); + gtk_widget_hide (gtk_widget_get_toplevel (plugin->menu)); gtk_widget_hide (plugin->menu); /* inactivate the toggle button */ @@ -1626,10 +1626,10 @@ launcher_plugin_menu_popup (gpointer user_data) /* fallback to manual positioning, this is used with * drag motion over the arrow button */ - if (!GTK_WIDGET_VISIBLE (plugin->menu)) + if (!gtk_widget_get_visible (plugin->menu)) { /* make sure the size is allocated */ - if (!GTK_WIDGET_REALIZED (plugin->menu)) + if (!gtk_widget_get_realized (plugin->menu)) gtk_widget_realize (plugin->menu); /* use the widget position function to get the coordinates */ @@ -1638,8 +1638,8 @@ launcher_plugin_menu_popup (gpointer user_data) /* bit ugly... but show the menu */ gtk_widget_show (plugin->menu); - gtk_window_move (GTK_WINDOW (GTK_MENU (plugin->menu)->toplevel), x, y); - gtk_widget_show (GTK_MENU (plugin->menu)->toplevel); + gtk_window_move (GTK_WINDOW (gtk_widget_get_toplevel (plugin->menu)), x, y); + gtk_widget_show (gtk_widget_get_toplevel (plugin->menu)); } GDK_THREADS_LEAVE (); @@ -1724,9 +1724,9 @@ launcher_plugin_button_state_changed (GtkWidget *button_a, GtkStateType state, GtkWidget *button_b) { - if (GTK_WIDGET_STATE (button_a) != GTK_WIDGET_STATE (button_b) - && GTK_WIDGET_STATE (button_a) != GTK_STATE_INSENSITIVE) - gtk_widget_set_state (button_b, GTK_WIDGET_STATE (button_a)); + if (gtk_widget_get_state (GTK_WIDGET (button_a)) != gtk_widget_get_state (GTK_WIDGET (button_b)) + && gtk_widget_get_state (GTK_WIDGET (button_a)) != GTK_STATE_INSENSITIVE) + gtk_widget_set_state (button_b, gtk_widget_get_state (GTK_WIDGET (button_a))); } @@ -1788,7 +1788,6 @@ launcher_plugin_button_release_event (GtkWidget *button, /* leave when there are no menu items or there is an internal arrow */ if (plugin->items == NULL - || !GTK_BUTTON (button)->in_button || ARROW_INSIDE_BUTTON (plugin)) return FALSE; @@ -1903,7 +1902,7 @@ launcher_plugin_supported_drop (GdkDragContext *context, return GDK_NONE; /* check if we support the target */ - for (li = context->targets; li; li = li->next) + for (li = gdk_drag_context_list_targets (context); li; li = li->next) { target = GDK_POINTER_TO_ATOM (li->data); for (i = 0; i < G_N_ELEMENTS (drop_targets); i++) @@ -1995,8 +1994,9 @@ launcher_plugin_button_expose_event (GtkWidget *widget, GdkEventExpose *event, LauncherPlugin *plugin) { - GtkArrowType arrow_type; - gint size, x, y, thickness, offset; + GtkArrowType arrow_type; + gint size, x, y, thickness, offset; + GtkAllocation allocation; panel_return_val_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin), FALSE); @@ -2008,12 +2008,13 @@ launcher_plugin_button_expose_event (GtkWidget *widget, arrow_type = xfce_arrow_button_get_arrow_type (XFCE_ARROW_BUTTON (plugin->arrow)); /* style thickness */ - thickness = MAX (widget->style->xthickness, widget->style->ythickness); + thickness = MAX (gtk_widget_get_style (widget)->xthickness, gtk_widget_get_style (widget)->ythickness); /* size of the arrow and the start coordinates */ - size = widget->allocation.width / 3; - x = widget->allocation.x + thickness; - y = widget->allocation.y + thickness; + gtk_widget_get_allocation (widget, &allocation); + size = allocation.width / 3; + x = allocation.x + thickness; + y = allocation.y + thickness; offset = size + 2 * thickness; /* calculate the position based on the arrow type */ @@ -2021,18 +2022,18 @@ launcher_plugin_button_expose_event (GtkWidget *widget, { case GTK_ARROW_UP: /* north east */ - x += widget->allocation.width - offset; + x += allocation.width - offset; break; case GTK_ARROW_DOWN: /* south west */ - y += widget->allocation.height - offset; + y += allocation.height - offset; break; case GTK_ARROW_RIGHT: /* south east */ - x += widget->allocation.width - offset; - y += widget->allocation.height - offset; + x += allocation.width - offset; + y += allocation.height - offset; break; default: @@ -2041,8 +2042,8 @@ launcher_plugin_button_expose_event (GtkWidget *widget, } /* paint the arrow */ - gtk_paint_arrow (widget->style, widget->window, - GTK_WIDGET_STATE (widget), GTK_SHADOW_IN, + gtk_paint_arrow (gtk_widget_get_style (widget), gtk_widget_get_window (widget), + gtk_widget_get_state (widget), GTK_SHADOW_IN, &(event->area), widget, "launcher_button", arrow_type, TRUE, x, y, size, size); @@ -2127,7 +2128,7 @@ launcher_plugin_arrow_drag_leave_timeout (gpointer user_data) gint menu_x, menu_y, menu_w, menu_h; panel_return_val_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin), FALSE); - panel_return_val_if_fail (menu == NULL || GDK_IS_WINDOW (menu->window), FALSE); + panel_return_val_if_fail (menu == NULL || GDK_IS_WINDOW (gtk_widget_get_window (menu)), FALSE); /* leave when the menu is destroyed */ if (G_UNLIKELY (plugin->menu == NULL)) @@ -2138,15 +2139,16 @@ launcher_plugin_arrow_drag_leave_timeout (gpointer user_data) NULL, &pointer_x, &pointer_y, NULL); /* get the menu position */ - gdk_window_get_root_origin (menu->window, &menu_x, &menu_y); - gdk_drawable_get_size (GDK_DRAWABLE (menu->window), &menu_w, &menu_h); + gdk_window_get_root_origin (gtk_widget_get_window (menu), &menu_x, &menu_y); + menu_w = gdk_window_get_width (gtk_widget_get_window (menu)); + menu_h = gdk_window_get_height (gtk_widget_get_window (menu)); /* check if we should hide the menu */ if (pointer_x < menu_x || pointer_x > menu_x + menu_w || pointer_y < menu_y || pointer_y > menu_y + menu_h) { /* hide the menu */ - gtk_widget_hide (GTK_MENU (menu)->toplevel); + gtk_widget_hide (gtk_widget_get_toplevel (menu)); gtk_widget_hide (menu); /* inactive the toggle button */ @@ -2353,9 +2355,7 @@ launcher_plugin_item_exec_from_clipboard (GarconMenuItem *item, if (!exo_str_is_empty (text)) { /* create fake selection data */ - data.data = (guchar *) text; - data.length = strlen (text); - data.target = GDK_NONE; + gtk_selection_data_set (&data, gdk_atom_intern_static_string (""), 8, (guchar *) text, strlen (text)); /* extract the uris from the selection data */ uri_list = launcher_plugin_uri_list_extract (&data); @@ -2496,16 +2496,17 @@ launcher_plugin_uri_list_extract (GtkSelectionData *data) gchar **array; guint i; gchar *uri; + gchar *text; /* leave if there is no data */ - if (data->length <= 0) + if (gtk_selection_data_get_length (data) <= 0) return NULL; /* extract the files */ - if (data->target == gdk_atom_intern_static_string ("text/uri-list")) + if (gtk_selection_data_get_data_type (data) == gdk_atom_intern_static_string ("text/uri-list")) { /* extract the list of uris */ - array = g_uri_list_extract_uris ((gchar *) data->data); + array = gtk_selection_data_get_uris (data); if (G_UNLIKELY (array == NULL)) return NULL; @@ -2523,7 +2524,10 @@ launcher_plugin_uri_list_extract (GtkSelectionData *data) else { /* split the data on new lines */ - array = g_strsplit_set ((const gchar *) data->data, "\n\r", -1); + text = (gchar*) gtk_selection_data_get_text (data); + if (G_UNLIKELY (text == NULL)) + return NULL; + array = g_strsplit_set (text, "\n\r", -1); if (G_UNLIKELY (array == NULL)) return NULL; diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c index 9bb9df9..e6fe22d 100644 --- a/plugins/pager/pager.c +++ b/plugins/pager/pager.c @@ -410,9 +410,11 @@ pager_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, static void pager_plugin_configure_workspace_settings (GtkWidget *button) { - GdkScreen *screen; - GError *error = NULL; - GtkWidget *toplevel; + GdkScreen *screen; + GError *error = NULL; + GtkWidget *toplevel; + GAppInfo *appinfo; + GdkAppLaunchContext *context; panel_return_if_fail (GTK_IS_WIDGET (button)); @@ -421,7 +423,10 @@ pager_plugin_configure_workspace_settings (GtkWidget *button) screen = gdk_screen_get_default (); /* try to start the settings dialog */ - if (!gdk_spawn_command_line_on_screen (screen, WORKSPACE_SETTINGS_COMMAND, &error)) + appinfo = g_app_info_create_from_commandline (WORKSPACE_SETTINGS_COMMAND, NULL, 0, &error); + context = gdk_app_launch_context_new (); + gdk_app_launch_context_set_screen (context, screen); + if (!g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), &error)) { /* show an error dialog */ toplevel = gtk_widget_get_toplevel (button); diff --git a/plugins/separator/separator.c b/plugins/separator/separator.c index 99f988c..5762b3c 100644 --- a/plugins/separator/separator.c +++ b/plugins/separator/separator.c @@ -225,13 +225,16 @@ separator_plugin_expose_event (GtkWidget *widget, GdkEventExpose *event) { SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (widget); - GtkAllocation *alloc = &(widget->allocation); + GtkAllocation alloc; GdkBitmap *bmap; GdkGC *gc; - GtkStateType state = GTK_WIDGET_STATE (widget); + GtkStateType state = gtk_widget_get_state (widget); gint x, y, w, h; gint rows, cols; guint i; + cairo_t *cr; + + gtk_widget_get_allocation (widget, &alloc); switch (plugin->style) { @@ -244,76 +247,81 @@ separator_plugin_expose_event (GtkWidget *widget, if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL) { - gtk_paint_vline (widget->style, - widget->window, + gtk_paint_vline (gtk_widget_get_style (widget), + gtk_widget_get_window (widget), state, &(event->area), widget, "separator", - alloc->y + alloc->height * SEPARATOR_OFFSET, - alloc->y + alloc->height * (1.00 - SEPARATOR_OFFSET), - alloc->x + alloc->width / 2 - 1); + alloc.y + alloc.height * SEPARATOR_OFFSET, + alloc.y + alloc.height * (1.00 - SEPARATOR_OFFSET), + alloc.x + alloc.width / 2 - 1); } else { - gtk_paint_hline (widget->style, - widget->window, + gtk_paint_hline (gtk_widget_get_style (widget), + gtk_widget_get_window (widget), state, &(event->area), widget, "separator", - alloc->x + alloc->width * SEPARATOR_OFFSET, - alloc->x + alloc->width * (1.00 - SEPARATOR_OFFSET), - alloc->y + alloc->height / 2 - 1); + alloc.x + alloc.width * SEPARATOR_OFFSET, + alloc.x + alloc.width * (1.00 - SEPARATOR_OFFSET), + alloc.y + alloc.height / 2 - 1); } break; + case SEPARATOR_PLUGIN_STYLE_DOTS: /* FIXME: temporary until I get dots drawing with Cairo */ case SEPARATOR_PLUGIN_STYLE_HANDLE: - gtk_paint_handle (widget->style, - widget->window, + gtk_paint_handle (gtk_widget_get_style (widget), + gtk_widget_get_window (widget), state, GTK_SHADOW_NONE, &(event->area), widget, "handlebox", - alloc->x, alloc->y, - alloc->width, - alloc->height, + alloc.x, alloc.y, + alloc.width, + alloc.height, xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL); break; +#if 0 /* FIXME: temporary until I get dots drawing with Cairo */ case SEPARATOR_PLUGIN_STYLE_DOTS: if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL) { - rows = MAX (alloc->height / DOTS_SIZE, 1); + rows = MAX (alloc.height / DOTS_SIZE, 1); w = DOTS_SIZE; h = rows * DOTS_SIZE; } else { - cols = MAX (alloc->width / DOTS_SIZE, 1); + cols = MAX (alloc.width / DOTS_SIZE, 1); h = DOTS_SIZE; w = cols * DOTS_SIZE; } - x = alloc->x + (alloc->width - w) / 2; - y = alloc->y + (alloc->height - h) / 2; + x = alloc.x + (alloc.width - w) / 2; + y = alloc.y + (alloc.height - h) / 2; + + cr = gdk_cairo_create (gtk_widget_get_window (widget)); for (i = 0; i < G_N_ELEMENTS (bits); i++) { /* pick color, but be same order as bits array */ if (i == 0) - gc = widget->style->dark_gc[state]; + gc = gtk_widget_get_style (widget)->dark_gc[state]; else if (i == 1) - gc = widget->style->light_gc[state]; + gc = gtk_widget_get_style (widget)->light_gc[state]; else - gc = widget->style->mid_gc[state]; + gc = gtk_widget_get_style (widget)->mid_gc[state]; /* clip to drawing area */ - gdk_gc_set_clip_rectangle (gc, &(event->area)); + gdk_cairo_rectangle (cr, &(event->area)); + cairo_clip (cr); /* set the stipple for the gc */ - bmap = gdk_bitmap_create_from_data (widget->window, bits[i], + bmap = gdk_bitmap_create_from_data (gtk_widget_get_window (widget), bits[i], DOTS_SIZE, DOTS_SIZE); gdk_gc_set_stipple (gc, bmap); gdk_gc_set_fill (gc, GDK_STIPPLED); @@ -321,13 +329,14 @@ separator_plugin_expose_event (GtkWidget *widget, /* draw the dots */ gdk_gc_set_ts_origin (gc, x, y); - gdk_draw_rectangle (widget->window, gc, TRUE, x, y, w, h); + gdk_draw_rectangle (gtk_widget_get_window (widget), gc, TRUE, x, y, w, h); gdk_gc_set_fill (gc, GDK_SOLID); /* unset the clip */ - gdk_gc_set_clip_rectangle (gc, NULL); + gdk_cairo_reset_clip (cr); } break; +#endif } return FALSE; diff --git a/plugins/systray/systray-box.c b/plugins/systray/systray-box.c index aca2def..c9aabe3 100644 --- a/plugins/systray/systray-box.c +++ b/plugins/systray/systray-box.c @@ -142,7 +142,7 @@ systray_box_class_init (SystrayBoxClass *klass) static void systray_box_init (SystrayBox *box) { - GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (box), FALSE); box->childeren = NULL; box->size_max = SIZE_MAX_DEFAULT; @@ -207,7 +207,7 @@ systray_box_size_get_max_child_size (SystrayBox *box, gint rows; gint row_size; - alloc_size -= 2 * GTK_CONTAINER (widget)->border_width; + alloc_size -= 2 * gtk_container_get_border_width (GTK_CONTAINER (widget)); /* count the number of rows that fit in the allocated space */ for (rows = 1;; rows++) @@ -277,7 +277,7 @@ systray_box_size_request (GtkWidget *widget, /* skip invisible requisitions (see macro) or hidden widgets */ if (REQUISITION_IS_INVISIBLE (child_req) - || !GTK_WIDGET_VISIBLE (child)) + || !gtk_widget_get_visible (child)) continue; hidden = systray_socket_get_hidden (XFCE_SYSTRAY_SOCKET (child)); @@ -368,7 +368,7 @@ systray_box_size_request (GtkWidget *widget, } /* add border size */ - border = GTK_CONTAINER (widget)->border_width * 2; + border = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2; requisition->width += border; requisition->height += border; } @@ -394,9 +394,9 @@ systray_box_size_allocate (GtkWidget *widget, gint alloc_size; gint idx; - widget->allocation = *allocation; + gtk_widget_set_allocation (widget, allocation); - border = GTK_CONTAINER (widget)->border_width; + border = gtk_container_get_border_width (GTK_CONTAINER (widget)); alloc_size = box->horizontal ? allocation->height : allocation->width; systray_box_size_get_max_child_size (box, alloc_size, &rows, &row_size, &offset); @@ -428,7 +428,7 @@ systray_box_size_allocate (GtkWidget *widget, child = GTK_WIDGET (li->data); panel_return_if_fail (XFCE_IS_SYSTRAY_SOCKET (child)); - if (!GTK_WIDGET_VISIBLE (child)) + if (!gtk_widget_get_visible (child)) continue; gtk_widget_get_child_requisition (child, &child_req); @@ -572,7 +572,7 @@ systray_box_add (GtkContainer *container, panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box)); panel_return_if_fail (GTK_IS_WIDGET (child)); - panel_return_if_fail (child->parent == NULL); + panel_return_if_fail (gtk_widget_get_parent (child) == NULL); box->childeren = g_slist_insert_sorted (box->childeren, child, systray_box_compare_function); diff --git a/plugins/systray/systray-manager.c b/plugins/systray/systray-manager.c index d77faee..929df29 100644 --- a/plugins/systray/systray-manager.c +++ b/plugins/systray/systray-manager.c @@ -343,10 +343,10 @@ systray_manager_register (SystrayManager *manager, systray_manager_set_visual (manager); /* get the current x server time stamp */ - timestamp = gdk_x11_get_server_time (invisible->window); + timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (invisible))); /* try to become the selection owner of this display */ - succeed = gdk_selection_owner_set_for_display (display, invisible->window, + succeed = gdk_selection_owner_set_for_display (display, gtk_widget_get_window (GTK_WIDGET (invisible)), manager->selection_atom, timestamp, TRUE); @@ -363,7 +363,7 @@ systray_manager_register (SystrayManager *manager, xevent.data.l[0] = timestamp; xevent.data.l[1] = gdk_x11_atom_to_xatom_for_display (display, manager->selection_atom); - xevent.data.l[2] = GDK_WINDOW_XWINDOW (invisible->window); + xevent.data.l[2] = GDK_WINDOW_XWINDOW (gtk_widget_get_window (GTK_WIDGET (invisible))); xevent.data.l[3] = 0; xevent.data.l[4] = 0; @@ -372,7 +372,7 @@ systray_manager_register (SystrayManager *manager, False, StructureNotifyMask, (XEvent *)&xevent); /* system_tray_request_dock and selectionclear */ - gdk_window_add_filter (invisible->window, systray_manager_window_filter, manager); + gdk_window_add_filter (gtk_widget_get_window (GTK_WIDGET (invisible)), systray_manager_window_filter, manager); /* get the opcode atom (for both gdk and x11) */ opcode_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_OPCODE", FALSE); @@ -441,24 +441,24 @@ systray_manager_unregister (SystrayManager *manager) return; panel_return_if_fail (GTK_IS_INVISIBLE (invisible)); - panel_return_if_fail (GTK_WIDGET_REALIZED (invisible)); - panel_return_if_fail (GDK_IS_WINDOW (invisible->window)); + panel_return_if_fail (gtk_widget_get_realized (invisible)); + panel_return_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (invisible)))); /* get the display of the invisible window */ display = gtk_widget_get_display (invisible); /* remove our handling of the selection if we're the owner */ owner = gdk_selection_owner_get_for_display (display, manager->selection_atom); - if (owner == invisible->window) + if (owner == gtk_widget_get_window (GTK_WIDGET (invisible))) { gdk_selection_owner_set_for_display (display, NULL, manager->selection_atom, - gdk_x11_get_server_time (invisible->window), + gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (invisible))), TRUE); } /* remove window filter */ - gdk_window_remove_filter (invisible->window, + gdk_window_remove_filter (gtk_widget_get_window (GTK_WIDGET (invisible)), systray_manager_window_filter, manager); /* remove all sockets from the hash table */ @@ -576,7 +576,7 @@ systray_manager_handle_client_message_message_data (GdkXEvent *xevent, if (message->remaining_length == 0) { /* try to get the socket from the known tray icons */ - socket = g_hash_table_lookup (manager->sockets, GUINT_TO_POINTER (message->window)); + socket = g_hash_table_lookup (manager->sockets, GUINT_TO_POINTER (gtk_widget_get_window (GTK_WIDGET (message)))); if (G_LIKELY (socket)) { @@ -761,7 +761,7 @@ systray_manager_set_visual (SystrayManager *manager) panel_return_if_fail (XFCE_IS_SYSTRAY_MANAGER (manager)); panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible)); - panel_return_if_fail (GDK_IS_WINDOW (manager->invisible->window)); + panel_return_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (manager->invisible)))); /* get invisible display and screen */ display = gtk_widget_get_display (manager->invisible); @@ -787,7 +787,7 @@ systray_manager_set_visual (SystrayManager *manager) data[0] = XVisualIDFromVisual (xvisual); XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XWINDOW (manager->invisible->window), + GDK_WINDOW_XWINDOW (gtk_widget_get_window (GTK_WIDGET (manager->invisible))), visual_atom, XA_VISUALID, 32, PropModeReplace, @@ -806,7 +806,7 @@ systray_manager_set_orientation (SystrayManager *manager, panel_return_if_fail (XFCE_IS_SYSTRAY_MANAGER (manager)); panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible)); - panel_return_if_fail (GDK_IS_WINDOW (manager->invisible->window)); + panel_return_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (manager->invisible)))); /* set the new orientation */ manager->orientation = orientation; @@ -825,7 +825,7 @@ systray_manager_set_orientation (SystrayManager *manager, /* change the x property */ XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - GDK_WINDOW_XWINDOW (manager->invisible->window), + GDK_WINDOW_XWINDOW (gtk_widget_get_window (GTK_WIDGET (manager->invisible))), orientation_atom, XA_CARDINAL, 32, PropModeReplace, diff --git a/plugins/systray/systray-socket.c b/plugins/systray/systray-socket.c index 43423bb..8985190 100644 --- a/plugins/systray/systray-socket.c +++ b/plugins/systray/systray-socket.c @@ -137,7 +137,7 @@ systray_socket_realize (GtkWidget *widget) socket->parent_relative_bg = FALSE; } else if (gtk_widget_get_visual (widget) == - gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (window)))) + gdk_window_get_visual (gdk_window_get_parent (window))) { gdk_window_set_back_pixmap (window, NULL, TRUE); @@ -169,27 +169,33 @@ systray_socket_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { SystraySocket *socket = XFCE_SYSTRAY_SOCKET (widget); - gboolean moved = allocation->x != widget->allocation.x - || allocation->y != widget->allocation.y; - gboolean resized = allocation->width != widget->allocation.width - ||allocation->height != widget->allocation.height; + GtkAllocation alloc; + gboolean moved, resized; + + gtk_widget_get_allocation (widget, &alloc); + + moved = allocation->x != alloc.x || allocation->y != alloc.y; + resized = allocation->width != alloc.width || allocation->height != alloc.height; + + /* FIXME: either assign allocation to widget with gtk_widget_set_allocation, + or document why this isn't being done, because it looks like a bug/oversight */ if ((moved || resized) - && GTK_WIDGET_MAPPED (widget)) + && gtk_widget_get_mapped (widget)) { if (socket->is_composited) - gdk_window_invalidate_rect (gdk_window_get_parent (widget->window), - &widget->allocation, FALSE); + gdk_window_invalidate_rect (gdk_window_get_parent (gtk_widget_get_window (widget)), + &alloc, FALSE); } GTK_WIDGET_CLASS (systray_socket_parent_class)->size_allocate (widget, allocation); if ((moved || resized) - && GTK_WIDGET_MAPPED (widget)) + && gtk_widget_get_mapped (widget)) { if (socket->is_composited) - gdk_window_invalidate_rect (gdk_window_get_parent (widget->window), - &widget->allocation, FALSE); + gdk_window_invalidate_rect (gdk_window_get_parent (gtk_widget_get_window (widget)), + &alloc, FALSE); else if (moved && socket->parent_relative_bg) systray_socket_force_redraw (socket); } @@ -207,7 +213,7 @@ systray_socket_expose_event (GtkWidget *widget, if (socket->is_composited) { /* clear to transparent */ - cr = gdk_cairo_create (widget->window); + cr = gdk_cairo_create (gtk_widget_get_window (widget)); cairo_set_source_rgba (cr, 0, 0, 0, 0); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); gdk_cairo_region (cr, event->region); @@ -217,7 +223,7 @@ systray_socket_expose_event (GtkWidget *widget, else if (socket->parent_relative_bg) { /* clear to parent-relative pixmap */ - gdk_window_clear_area (widget->window, + gdk_window_clear_area (gtk_widget_get_window (widget), event->area.x, event->area.y, event->area.width, @@ -248,6 +254,7 @@ systray_socket_new (GdkScreen *screen, GdkVisual *visual; GdkColormap *colormap; gboolean release_colormap = FALSE; + gint red_prec, blue_prec, green_prec; panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); @@ -292,7 +299,10 @@ systray_socket_new (GdkScreen *screen, g_object_unref (G_OBJECT (colormap)); /* check if there is an alpha channel in the visual */ - if (visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth + gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec); + gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec); + gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec); + if (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual) && gdk_display_supports_composite (gdk_screen_get_display (screen))) socket->is_composited = TRUE; @@ -304,22 +314,25 @@ systray_socket_new (GdkScreen *screen, void systray_socket_force_redraw (SystraySocket *socket) { - GtkWidget *widget = GTK_WIDGET (socket); - XEvent xev; - GdkDisplay *display; + GtkWidget *widget = GTK_WIDGET (socket); + XEvent xev; + GdkDisplay *display; + GtkAllocation allocation; panel_return_if_fail (XFCE_IS_SYSTRAY_SOCKET (socket)); - if (GTK_WIDGET_MAPPED (socket) && socket->parent_relative_bg) + if (gtk_widget_get_mapped (GTK_WIDGET (socket)) && socket->parent_relative_bg) { display = gtk_widget_get_display (widget); + gtk_widget_get_allocation (widget, &allocation); + xev.xexpose.type = Expose; - xev.xexpose.window = GDK_WINDOW_XWINDOW (GTK_SOCKET (socket)->plug_window); + xev.xexpose.window = GDK_WINDOW_XWINDOW (gtk_socket_get_plug_window (GTK_SOCKET (socket))); xev.xexpose.x = 0; xev.xexpose.y = 0; - xev.xexpose.width = widget->allocation.width; - xev.xexpose.height = widget->allocation.height; + xev.xexpose.width = allocation.width; + xev.xexpose.height = allocation.height; xev.xexpose.count = 0; gdk_error_trap_push (); diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c index 2124d55..4164e9b 100644 --- a/plugins/systray/systray.c +++ b/plugins/systray/systray.c @@ -520,7 +520,7 @@ systray_plugin_size_changed (XfcePanelPlugin *panel_plugin, * behind the allocated size when resizing and during startup, we * correct the maximum size set by the user with the size the panel * will most likely allocated */ - border += MAX (frame->style->xthickness, frame->style->ythickness); + border += MAX (gtk_widget_get_style (frame)->xthickness, gtk_widget_get_style (frame)->ythickness); systray_box_set_size_alloc (XFCE_SYSTRAY_BOX (plugin->box), size - 2 * border); return TRUE; @@ -578,17 +578,17 @@ systray_plugin_box_expose_event_icon (GtkWidget *child, gpointer user_data) { cairo_t *cr = user_data; - GtkAllocation *alloc; + GtkAllocation alloc; if (systray_socket_is_composited (XFCE_SYSTRAY_SOCKET (child))) { - alloc = &child->allocation; + gtk_widget_get_allocation (child, &alloc); /* skip hidden (see offscreen in box widget) icons */ - if (alloc->x > 0 && alloc->y > 0) + if (alloc.x > 0 && alloc.y > 0) { gdk_cairo_set_source_pixmap (cr, gtk_widget_get_window (child), - alloc->x, alloc->y); + alloc.x, alloc.y); cairo_paint (cr); } } diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c index 783618a..4905be1 100644 --- a/plugins/tasklist/tasklist-widget.c +++ b/plugins/tasklist/tasklist-widget.c @@ -515,7 +515,7 @@ xfce_tasklist_class_init (XfceTasklistClass *klass) static void xfce_tasklist_init (XfceTasklist *tasklist) { - GTK_WIDGET_SET_FLAGS (tasklist, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (tasklist), FALSE); tasklist->locked = 0; tasklist->screen = NULL; @@ -738,7 +738,7 @@ xfce_tasklist_size_request (GtkWidget *widget, { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button)) + if (gtk_widget_get_visible (child->button)) { gtk_widget_size_request (child->button, &child_req); @@ -871,7 +871,7 @@ xfce_tasklist_size_layout (XfceTasklist *tasklist, for (li = tasklist->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button)) + if (gtk_widget_get_visible (child->button)) windows_scored = g_slist_insert_sorted (windows_scored, child, xfce_tasklist_size_sort_window); } @@ -943,10 +943,10 @@ xfce_tasklist_size_allocate (GtkWidget *widget, gboolean arrow_visible; GtkRequisition child_req; - panel_return_if_fail (GTK_WIDGET_VISIBLE (tasklist->arrow_button)); + panel_return_if_fail (gtk_widget_get_visible (tasklist->arrow_button)); /* set widget allocation */ - widget->allocation = *allocation; + gtk_widget_set_allocation (widget, allocation); /* swap integers with vertical orientation */ if (!xfce_tasklist_horizontal (tasklist)) @@ -997,7 +997,7 @@ xfce_tasklist_size_allocate (GtkWidget *widget, child = li->data; /* skip hidden buttons */ - if (!GTK_WIDGET_VISIBLE (child->button)) + if (!gtk_widget_get_visible (child->button)) continue; if (G_LIKELY (child->type == CHILD_TYPE_WINDOW @@ -1162,7 +1162,7 @@ xfce_tasklist_scroll_event (GtkWidget *widget, { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button) + if (gtk_widget_get_visible (child->button) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (child->button))) break; } @@ -1178,7 +1178,7 @@ xfce_tasklist_scroll_event (GtkWidget *widget, { child = lnew->data; if (child->window != NULL - && GTK_WIDGET_VISIBLE (child->button)) + && gtk_widget_get_visible (child->button)) break; } break; @@ -1189,7 +1189,7 @@ xfce_tasklist_scroll_event (GtkWidget *widget, { child = lnew->data; if (child->window != NULL - && GTK_WIDGET_VISIBLE (child->button)) + && gtk_widget_get_visible (child->button)) break; } break; @@ -1228,7 +1228,7 @@ xfce_tasklist_remove (GtkContainer *container, { tasklist->windows = g_list_delete_link (tasklist->windows, li); - was_visible = GTK_WIDGET_VISIBLE (widget); + was_visible = gtk_widget_get_visible (widget); gtk_widget_unparent (child->button); @@ -1483,7 +1483,7 @@ xfce_tasklist_active_window_changed (WnckScreen *screen, /* skip hidden buttons */ /* TODO the visible check probably breaks with grouping */ - if (!GTK_WIDGET_VISIBLE (child->button) + if (!gtk_widget_get_visible (child->button) || !(child->window == previous_window || child->window == active_window || !tasklist->all_workspaces)) @@ -1785,7 +1785,7 @@ xfce_tasklist_update_icon_geometries (gpointer data) XfceTasklist *tasklist = XFCE_TASKLIST (data); GList *li; XfceTasklistChild *child, *child2; - GtkAllocation *alloc; + GtkAllocation alloc; GSList *lp; gint root_x, root_y; GtkWidget *toplevel; @@ -1801,31 +1801,31 @@ xfce_tasklist_update_icon_geometries (gpointer data) switch (child->type) { case CHILD_TYPE_WINDOW: - alloc = &child->button->allocation; + gtk_widget_get_allocation (child->button, &alloc); panel_return_val_if_fail (WNCK_IS_WINDOW (child->window), FALSE); - wnck_window_set_icon_geometry (child->window, alloc->x + root_x, - alloc->y + root_y, alloc->width, - alloc->height); + wnck_window_set_icon_geometry (child->window, alloc.x + root_x, + alloc.y + root_y, alloc.width, + alloc.height); break; case CHILD_TYPE_GROUP: - alloc = &child->button->allocation; + gtk_widget_get_allocation (child->button, &alloc); for (lp = child->windows; lp != NULL; lp = lp->next) { child2 = lp->data; panel_return_val_if_fail (WNCK_IS_WINDOW (child2->window), FALSE); - wnck_window_set_icon_geometry (child2->window, alloc->x + root_x, - alloc->y + root_y, alloc->width, - alloc->height); + wnck_window_set_icon_geometry (child2->window, alloc.x + root_x, + alloc.y + root_y, alloc.width, + alloc.height); } break; case CHILD_TYPE_OVERFLOW_MENU: - alloc = &tasklist->arrow_button->allocation; + gtk_widget_get_allocation (tasklist->arrow_button, &alloc); panel_return_val_if_fail (WNCK_IS_WINDOW (child->window), FALSE); - wnck_window_set_icon_geometry (child->window, alloc->x + root_x, - alloc->y + root_y, alloc->width, - alloc->height); + wnck_window_set_icon_geometry (child->window, alloc.x + root_x, + alloc.y + root_y, alloc.width, + alloc.height); break; case CHILD_TYPE_GROUP_MENU: @@ -2583,16 +2583,20 @@ xfce_tasklist_button_button_release_event (GtkWidget *button, GdkEventButton *event, XfceTasklistChild *child) { + GtkAllocation allocation; + panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE); panel_return_val_if_fail (child->type != CHILD_TYPE_GROUP, FALSE); + gtk_widget_get_allocation (button, &allocation); + /* only respond to in-button events */ if (event->type == GDK_BUTTON_RELEASE && !xfce_taskbar_is_locked (child->tasklist) && event->button == 1 && !(event->x == 0 && event->y == 0) /* 0,0 = outside the widget in Gtk */ - && event->x >= 0 && event->x < button->allocation.width - && event->y >= 0 && event->y < button->allocation.height) + && event->x >= 0 && event->x < allocation.width + && event->y >= 0 && event->y < allocation.height) { xfce_tasklist_button_activate (child, event->time); } @@ -2924,7 +2928,7 @@ xfce_tasklist_group_button_menu_minimize_all (XfceTasklistChild *group_child) for (li = group_child->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button) + if (gtk_widget_get_visible (child->button) && child->type == CHILD_TYPE_GROUP_MENU) { panel_return_if_fail (WNCK_IS_WINDOW (child->window)); @@ -2947,7 +2951,7 @@ xfce_tasklist_group_button_menu_unminimize_all (XfceTasklistChild *group_child) for (li = group_child->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button) + if (gtk_widget_get_visible (child->button) && child->type == CHILD_TYPE_GROUP_MENU) { panel_return_if_fail (WNCK_IS_WINDOW (child->window)); @@ -2970,7 +2974,7 @@ xfce_tasklist_group_button_menu_maximize_all (XfceTasklistChild *group_child) for (li = group_child->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button) + if (gtk_widget_get_visible (child->button) && child->type == CHILD_TYPE_GROUP_MENU) { panel_return_if_fail (WNCK_IS_WINDOW (child->window)); @@ -2993,7 +2997,7 @@ xfce_tasklist_group_button_menu_unmaximize_all (XfceTasklistChild *group_child) for (li = group_child->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button) + if (gtk_widget_get_visible (child->button) && child->type == CHILD_TYPE_GROUP_MENU) { panel_return_if_fail (WNCK_IS_WINDOW (child->window)); @@ -3015,7 +3019,7 @@ xfce_tasklist_group_button_menu_close_all (XfceTasklistChild *group_child) for (li = group_child->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button) + if (gtk_widget_get_visible (child->button) && child->type == CHILD_TYPE_GROUP_MENU) { panel_return_if_fail (WNCK_IS_WINDOW (child->window)); @@ -3044,7 +3048,7 @@ xfce_tasklist_group_button_menu (XfceTasklistChild *group_child, for (li = group_child->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button) + if (gtk_widget_get_visible (child->button) && child->type == CHILD_TYPE_GROUP_MENU) { mi = xfce_tasklist_button_proxy_menu_item (child, !action_menu_entries); @@ -3198,7 +3202,7 @@ xfce_tasklist_group_button_name_changed (WnckClassGroup *class_group, for (li = group_child->windows, n_windows = 0; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button) + if (gtk_widget_get_visible (child->button) && child->type == CHILD_TYPE_GROUP_MENU) n_windows++; } @@ -3308,7 +3312,7 @@ xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child for (li = group_child->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button)) + if (gtk_widget_get_visible (child->button)) visible_counter++; } @@ -3328,7 +3332,7 @@ xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child for (li = group_child->windows; li != NULL; li = li->next) { child = li->data; - if (GTK_WIDGET_VISIBLE (child->button)) + if (gtk_widget_get_visible (child->button)) child->type = type; } diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c index 0a235fb..9222223 100644 --- a/plugins/tasklist/tasklist.c +++ b/plugins/tasklist/tasklist.c @@ -243,11 +243,12 @@ tasklist_plugin_handle_expose_event (GtkWidget *widget, TasklistPlugin *plugin) { GtkOrientation orientation; + GtkAllocation allocation; panel_return_val_if_fail (XFCE_IS_TASKLIST_PLUGIN (plugin), FALSE); panel_return_val_if_fail (plugin->handle == widget, FALSE); - if (!GTK_WIDGET_DRAWABLE (widget)) + if (!gtk_widget_is_drawable (widget)) return FALSE; /* get the orientation */ @@ -258,13 +259,14 @@ tasklist_plugin_handle_expose_event (GtkWidget *widget, orientation = GTK_ORIENTATION_HORIZONTAL; /* paint the handle */ - gtk_paint_handle (widget->style, widget->window, - GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE, + gtk_widget_get_allocation (widget, &allocation); + gtk_paint_handle (gtk_widget_get_style (widget), gtk_widget_get_window (widget), + gtk_widget_get_state (widget), GTK_SHADOW_NONE, &(event->area), widget, "handlebox", - widget->allocation.x, - widget->allocation.y, - widget->allocation.width, - widget->allocation.height, + allocation.x, + allocation.y, + allocation.width, + allocation.height, orientation); return TRUE; diff --git a/plugins/windowmenu/windowmenu.c b/plugins/windowmenu/windowmenu.c index 9625aad..d5310e9 100644 --- a/plugins/windowmenu/windowmenu.c +++ b/plugins/windowmenu/windowmenu.c @@ -581,7 +581,7 @@ window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, panel_return_val_if_fail (value == NULL || G_IS_VALUE (value), FALSE); if (strcmp (name, "popup") == 0 - && GTK_WIDGET_VISIBLE (panel_plugin) + && gtk_widget_get_visible (GTK_WIDGET (panel_plugin)) && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)) && panel_utils_grab_available ()) { @@ -901,7 +901,7 @@ window_menu_plugin_menu_window_item_activate (GtkWidget *mi, panel_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE); panel_return_val_if_fail (GTK_IS_MENU_ITEM (mi), FALSE); - panel_return_val_if_fail (GTK_IS_MENU_SHELL (mi->parent), FALSE); + panel_return_val_if_fail (GTK_IS_MENU_SHELL (gtk_widget_get_parent (mi)), FALSE); /* only respond to a button releases */ if (event->type != GDK_BUTTON_RELEASE) -- 1.7.4.1