This is an automated email from the git hooks/post-receive script. ochosi pushed a commit to branch master in repository apps/xfce4-notifyd.
commit 146810af6c4c494ffcbd4086dd481f3b00abca94 Author: Ali Abdallah <ali...@gmail.com> Date: Wed Oct 14 13:33:21 2015 +0200 Added some code to check for the default theme, in future we will use this information to set the css theme to the current one. Fixed identation. --- xfce4-notifyd/xfce-notify-daemon.c | 336 ++++++++++++++++++++----------------- xfce4-notifyd/xfce-notify-window.c | 118 ++++++------- 2 files changed, 240 insertions(+), 214 deletions(-) diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c index 9d7f662..1e4f83f 100644 --- a/xfce4-notifyd/xfce-notify-daemon.c +++ b/xfce4-notifyd/xfce-notify-daemon.c @@ -59,6 +59,7 @@ struct _XfceNotifyDaemon GtkCornerType notify_location; GtkCssProvider *css_provider; + gboolean is_default_theme; XfconfChannel *settings; @@ -75,7 +76,7 @@ struct _XfceNotifyDaemon typedef struct { - XfceNotifyGBusSkeletonClass parent; + XfceNotifyGBusSkeletonClass parent; } XfceNotifyDaemonClass; @@ -133,13 +134,13 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton, static gboolean notify_close_notification (XfceNotifyGBus *skeleton, - GDBusMethodInvocation *invocation, + GDBusMethodInvocation *invocation, guint id, XfceNotifyDaemon *xndaemon); static gboolean notify_get_server_information (XfceNotifyGBus *skeleton, - GDBusMethodInvocation *invocation, + GDBusMethodInvocation *invocation, XfceNotifyDaemon *xndaemon); @@ -295,72 +296,72 @@ xfce_notify_bus_name_acquired_cb (GDBusConnection *connection, const gchar *name, gpointer user_data) { - XfceNotifyDaemon *xndaemon; - GError *error = NULL; - gboolean exported; - - - xndaemon = XFCE_NOTIFY_DAEMON(user_data); - - exported = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (xndaemon), - connection, - "/org/freedesktop/Notifications", - &error); - if (exported) - { - /* Connect dbus signals callbacks */ - g_signal_connect (xndaemon, "handle-notify", - G_CALLBACK(notify_notify), xndaemon); - - g_signal_connect (xndaemon, "handle-get-capabilities", - G_CALLBACK(notify_get_capabilities), xndaemon); - - g_signal_connect (xndaemon, "handle-get-server-information", - G_CALLBACK(notify_get_server_information), xndaemon); - - g_signal_connect (xndaemon, "handle-close-notification", - G_CALLBACK(notify_close_notification), xndaemon); - } - else - { - g_warning ("Failed to export interface: %s", error->message); - g_error_free (error); - gtk_main_quit (); - } - - xndaemon->xfce_iface_skeleton = xfce_notify_org_xfce_notifyd_skeleton_new(); - exported = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON(xndaemon->xfce_iface_skeleton), - connection, - "/org/freedesktop/Notifications", - &error); - if (exported) - g_signal_connect (xndaemon->xfce_iface_skeleton, "handle-quit", - G_CALLBACK(notify_quit), xndaemon); - else - { - g_warning ("Failed to export interface: %s", error->message); - g_error_free (error); - gtk_main_quit (); - } + XfceNotifyDaemon *xndaemon; + GError *error = NULL; + gboolean exported; + + + xndaemon = XFCE_NOTIFY_DAEMON(user_data); + + exported = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (xndaemon), + connection, + "/org/freedesktop/Notifications", + &error); + if (exported) + { + /* Connect dbus signals callbacks */ + g_signal_connect (xndaemon, "handle-notify", + G_CALLBACK(notify_notify), xndaemon); + + g_signal_connect (xndaemon, "handle-get-capabilities", + G_CALLBACK(notify_get_capabilities), xndaemon); + + g_signal_connect (xndaemon, "handle-get-server-information", + G_CALLBACK(notify_get_server_information), xndaemon); + + g_signal_connect (xndaemon, "handle-close-notification", + G_CALLBACK(notify_close_notification), xndaemon); + } + else + { + g_warning ("Failed to export interface: %s", error->message); + g_error_free (error); + gtk_main_quit (); + } + + xndaemon->xfce_iface_skeleton = xfce_notify_org_xfce_notifyd_skeleton_new(); + exported = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON(xndaemon->xfce_iface_skeleton), + connection, + "/org/freedesktop/Notifications", + &error); + if (exported) + g_signal_connect (xndaemon->xfce_iface_skeleton, "handle-quit", + G_CALLBACK(notify_quit), xndaemon); + else + { + g_warning ("Failed to export interface: %s", error->message); + g_error_free (error); + gtk_main_quit (); + } } static void xfce_notify_bus_name_lost_cb (GDBusConnection *connection, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { - g_print (_("Another notification daemon is running, exiting\n")); - daemon_quit(XFCE_NOTIFY_DAEMON(user_data)); + g_print (_("Another notification daemon is running, exiting\n")); + daemon_quit(XFCE_NOTIFY_DAEMON(user_data)); } static void xfce_notify_daemon_constructed (GObject *obj) { - XfceNotifyDaemon *self; + XfceNotifyDaemon *self; - self = XFCE_NOTIFY_DAEMON (obj); + self = XFCE_NOTIFY_DAEMON (obj); - self->bus_name_id = g_bus_own_name (G_BUS_TYPE_SESSION, - "org.freedesktop.Notifications", + self->bus_name_id = g_bus_own_name (G_BUS_TYPE_SESSION, + "org.freedesktop.Notifications", G_BUS_NAME_OWNER_FLAGS_REPLACE, xfce_notify_bus_name_acquired_cb, NULL, @@ -371,13 +372,13 @@ static void xfce_notify_daemon_constructed (GObject *obj) static void xfce_notify_daemon_init(XfceNotifyDaemon *xndaemon) -{ +{ GtkWidgetPath *widget_path; xndaemon->active_notifications = g_tree_new_full(xfce_direct_compare, - NULL, NULL, - (GDestroyNotify)gtk_widget_destroy); - + NULL, NULL, + (GDestroyNotify)gtk_widget_destroy); + xndaemon->last_notification_id = 1; xndaemon->reserved_rectangles = NULL; xndaemon->monitors_workarea = NULL; @@ -394,24 +395,24 @@ static void xfce_notify_daemon_finalize(GObject *obj) { XfceNotifyDaemon *xndaemon = XFCE_NOTIFY_DAEMON(obj); - GDBusConnection *connection; - - connection = g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(xndaemon)); - - - if ( g_dbus_interface_skeleton_has_connection(G_DBUS_INTERFACE_SKELETON(xndaemon), - connection)) - { - g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON(xndaemon)); - } - - if (xndaemon->xfce_iface_skeleton && - g_dbus_interface_skeleton_has_connection(G_DBUS_INTERFACE_SKELETON(xndaemon->xfce_iface_skeleton), - connection)) - { - g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON(xndaemon->xfce_iface_skeleton)); - } - + GDBusConnection *connection; + + connection = g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(xndaemon)); + + + if ( g_dbus_interface_skeleton_has_connection(G_DBUS_INTERFACE_SKELETON(xndaemon), + connection)) + { + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON(xndaemon)); + } + + if (xndaemon->xfce_iface_skeleton && + g_dbus_interface_skeleton_has_connection(G_DBUS_INTERFACE_SKELETON(xndaemon->xfce_iface_skeleton), + connection)) + { + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON(xndaemon->xfce_iface_skeleton)); + } + if(xndaemon->reserved_rectangles && xndaemon->monitors_workarea) { gint nscreen, i, j; @@ -468,9 +469,9 @@ xfce_notify_daemon_window_action_invoked(XfceNotifyWindow *window, guint id = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(window), "--notify-id")); - xfce_notify_gbus_emit_action_invoked (XFCE_NOTIFY_GBUS(xndaemon), - id, - action); + xfce_notify_gbus_emit_action_invoked (XFCE_NOTIFY_GBUS(xndaemon), + id, + action); } static void @@ -504,9 +505,9 @@ xfce_notify_daemon_window_closed(XfceNotifyWindow *window, xndaemon); } - xfce_notify_gbus_emit_notification_closed (XFCE_NOTIFY_GBUS(xndaemon), - GPOINTER_TO_UINT(id_p), - (guint)reason); + xfce_notify_gbus_emit_notification_closed (XFCE_NOTIFY_GBUS(xndaemon), + GPOINTER_TO_UINT(id_p), + (guint)reason); } /* Gets the largest rectangle in src1 which does not contain src2. @@ -665,7 +666,7 @@ xfce_notify_daemon_window_size_allocate(GtkWidget *widget, GdkScreen *widget_screen; GdkDisplay *display; GdkDeviceManager *device_manager; - GdkDevice *pointer; + GdkDevice *pointer; gint x, y, monitor, screen_n, max_width; GdkRectangle *geom_tmp, geom, initial, widget_geom; @@ -697,8 +698,8 @@ xfce_notify_daemon_window_size_allocate(GtkWidget *widget, * gdk_display_get_pointer function! Go GTK...*/ widget_screen = gtk_widget_get_screen (widget); display = gdk_screen_get_display (widget_screen); - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); + device_manager = gdk_display_get_device_manager (display); + pointer = gdk_device_manager_get_client_pointer (device_manager); gdk_device_get_position (pointer, &p_screen, &x, &y); monitor = gdk_screen_get_monitor_at_point(p_screen, x, y); @@ -917,18 +918,18 @@ xfce_notify_daemon_update_reserved_rectangles(gpointer key, static gboolean notify_get_capabilities (XfceNotifyGBus *skeleton, - GDBusMethodInvocation *invocation, + GDBusMethodInvocation *invocation, XfceNotifyDaemon *xndaemon) { - const gchar *const capabilities[] = - { - "actions", "body", "body-hyperlinks", "body-markup", "icon-static", - "x-canonical-private-icon-only", NULL - }; - - xfce_notify_gbus_complete_get_capabilities(skeleton, invocation, capabilities); + const gchar *const capabilities[] = + { + "actions", "body", "body-hyperlinks", "body-markup", "icon-static", + "x-canonical-private-icon-only", NULL + }; + + xfce_notify_gbus_complete_get_capabilities(skeleton, invocation, capabilities); - if (g_tree_nnodes(xndaemon->active_notifications) == 0) { + if (g_tree_nnodes(xndaemon->active_notifications) == 0) { /* No active notifications, reset the close timeout */ if(xndaemon->close_timeout) g_source_remove(xndaemon->close_timeout); @@ -946,17 +947,27 @@ static gboolean notify_get_capabilities (XfceNotifyGBus *skeleton, static gboolean notify_show_window (gpointer window) { - gtk_widget_show(GTK_WIDGET(window)); - return FALSE; + gtk_widget_show(GTK_WIDGET(window)); + return FALSE; } static void -add_and_propagate_css_provider (GtkWidget *widget, GtkStyleProvider *provider) +add_and_propagate_css_provider (GtkWidget *widget, GtkStyleProvider *provider, guint priority) { - gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT); + GList *children, *l; + + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, priority); + if (GTK_IS_CONTAINER (widget)) - gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) add_and_propagate_css_provider, provider); + { + children = gtk_container_get_children(GTK_CONTAINER(widget)); + for(l = children; l; l = l->next) + { + add_and_propagate_css_provider (GTK_WIDGET(l->data), provider, priority); + } + g_list_free (children); + } } @@ -972,7 +983,7 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton, gint expire_timeout, XfceNotifyDaemon *xndaemon) { - XfceNotifyWindow *window; + XfceNotifyWindow *window; GdkPixbuf *pix; GVariant *image_data = NULL; const gchar *desktop_id = NULL; @@ -983,50 +994,50 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton, GVariantIter iter; guint OUT_id; - g_variant_iter_init (&iter, hints); - + g_variant_iter_init (&iter, hints); + while ((item = g_variant_iter_next_value (&iter))) { const char *key; GVariant *value; - + g_variant_get (item, "{sv}", &key, &value); if (g_strcmp0 (key, "urgency") == 0) - { - if (g_variant_is_of_type (value, G_VARIANT_TYPE_BYTE) && - (g_variant_get_byte(value) == URGENCY_CRITICAL)) - { - /* don't expire urgent notifications */ - expire_timeout = 0; - } - } + { + if (g_variant_is_of_type (value, G_VARIANT_TYPE_BYTE) && + (g_variant_get_byte(value) == URGENCY_CRITICAL)) + { + /* don't expire urgent notifications */ + expire_timeout = 0; + } + } else if ((g_strcmp0 (key, "image_data") == 0) || (g_strcmp0 (key, "icon_data") == 0) || (g_strcmp0 (key, "image-data") == 0) || (g_strcmp0 (key, "icon-data") == 0)) - { - image_data = value; - } + { + image_data = value; + } else if ((g_strcmp0 (key, "desktop_entry") == 0) || - (g_strcmp0 (key, "desktop-entry") == 0)) - { - if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) - desktop_id = g_variant_get_string (value, NULL); - } - else if (g_strcmp0 (key, "value") == 0) - { - if (g_variant_is_of_type (value, G_VARIANT_TYPE_INT32)) - { - value_hint = g_variant_get_int32 (value); - value_hint_set = TRUE; - } - } - else if (g_strcmp0 (key, "x-canonical-private-icon-only") == 0) - x_canonical = TRUE; + (g_strcmp0 (key, "desktop-entry") == 0)) + { + if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) + desktop_id = g_variant_get_string (value, NULL); + } + else if (g_strcmp0 (key, "value") == 0) + { + if (g_variant_is_of_type (value, G_VARIANT_TYPE_INT32)) + { + value_hint = g_variant_get_int32 (value); + value_hint_set = TRUE; + } + } + else if (g_strcmp0 (key, "x-canonical-private-icon-only") == 0) + x_canonical = TRUE; } if(expire_timeout == -1) @@ -1070,7 +1081,20 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton, gtk_widget_realize(GTK_WIDGET(window)); - add_and_propagate_css_provider (GTK_WIDGET(window), GTK_STYLE_PROVIDER(xndaemon->css_provider)); + if (!xndaemon->is_default_theme) + { + add_and_propagate_css_provider (GTK_WIDGET(window), + GTK_STYLE_PROVIDER(xndaemon->css_provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } + else + { + /* FIXME: This sets the fallback theme, not the current theme */ + add_and_propagate_css_provider (GTK_WIDGET(window), + GTK_STYLE_PROVIDER(gtk_css_provider_get_default()), + GTK_STYLE_PROVIDER_PRIORITY_FALLBACK); + } + g_idle_add(notify_show_window, window); } @@ -1129,37 +1153,37 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton, xndaemon->close_timeout = 0; xfce_notify_gbus_complete_notify(skeleton, invocation, OUT_id); - return TRUE; + return TRUE; } static gboolean notify_close_notification (XfceNotifyGBus *skeleton, - GDBusMethodInvocation *invocation, + GDBusMethodInvocation *invocation, guint id, XfceNotifyDaemon *xndaemon) { - XfceNotifyWindow *window = g_tree_lookup(xndaemon->active_notifications, + XfceNotifyWindow *window = g_tree_lookup(xndaemon->active_notifications, GUINT_TO_POINTER(id)); if(window) xfce_notify_window_closed(window, XFCE_NOTIFY_CLOSE_REASON_CLIENT); - - xfce_notify_gbus_complete_close_notification(skeleton, invocation); + + xfce_notify_gbus_complete_close_notification(skeleton, invocation); return TRUE; } static gboolean notify_get_server_information (XfceNotifyGBus *skeleton, - GDBusMethodInvocation *invocation, + GDBusMethodInvocation *invocation, XfceNotifyDaemon *xndaemon) { xfce_notify_gbus_complete_get_server_information(skeleton, - invocation, - "Xfce Notify Daemon", - "Xfce", - VERSION, - NOTIFICATIONS_SPEC_VERSION); - + invocation, + "Xfce Notify Daemon", + "Xfce", + VERSION, + NOTIFICATIONS_SPEC_VERSION); + if (g_tree_nnodes(xndaemon->active_notifications) == 0) { /* No active notifications, reset the close timeout */ if(xndaemon->close_timeout) @@ -1177,7 +1201,7 @@ static gboolean notify_get_server_information (XfceNotifyGBus *skeleton, static void daemon_quit (XfceNotifyDaemon *xndaemon) { - gint i, main_level = gtk_main_level(); + gint i, main_level = gtk_main_level(); for(i = 0; i < main_level; ++i) gtk_main_quit(); } @@ -1187,8 +1211,8 @@ static gboolean notify_quit (XfceNotifyOrgXfceNotifyd *skeleton, GDBusMethodInvocation *invocation, XfceNotifyDaemon *xndaemon) { - xfce_notify_org_xfce_notifyd_complete_quit (skeleton, invocation); - daemon_quit(xndaemon); + xfce_notify_org_xfce_notifyd_complete_quit (skeleton, invocation); + daemon_quit(xndaemon); return TRUE; } @@ -1210,15 +1234,15 @@ notify_pixbuf_from_image_data(GVariant *image_data) gboolean has_alpha; GVariant *pixel_data; gsize correct_len; - guchar *data; - - if (!g_variant_is_of_type (image_data, G_VARIANT_TYPE ("(iiibiiay)"))) + guchar *data; + + if (!g_variant_is_of_type (image_data, G_VARIANT_TYPE ("(iiibiiay)"))) { - g_warning ("Image data is not the correct type"); + g_warning ("Image data is not the correct type"); return NULL; - } + } - g_variant_get (image_data, + g_variant_get (image_data, "(iiibii@ay)", &width, &height, @@ -1258,6 +1282,8 @@ xfce_notify_daemon_set_theme(XfceNotifyDaemon *xndaemon, file = g_strconcat("themes/", theme, "/xfce-notify-4.0/gtk.css", NULL); + xndaemon->is_default_theme = (g_strcmp0("Default", theme) == 0); + files = xfce_resource_lookup_all(XFCE_RESOURCE_DATA, file); if (files && files[0]) diff --git a/xfce4-notifyd/xfce-notify-window.c b/xfce4-notifyd/xfce-notify-window.c index 404ca33..bb3b5d7 100644 --- a/xfce4-notifyd/xfce-notify-window.c +++ b/xfce4-notifyd/xfce-notify-window.c @@ -69,7 +69,7 @@ struct _XfceNotifyWindow GtkWidget *summary; GtkWidget *body; GtkWidget *button_box; - + guint64 expire_start_timestamp; guint expire_id; guint fade_id; @@ -129,8 +129,8 @@ xfce_notify_window_class_init(XfceNotifyWindowClass *klass) widget_class->realize = xfce_notify_window_realize; widget_class->unrealize = xfce_notify_window_unrealize; - - widget_class->draw = xfce_notify_window_draw; + + widget_class->draw = xfce_notify_window_draw; widget_class->enter_notify_event = xfce_notify_window_enter_leave; widget_class->leave_notify_event = xfce_notify_window_enter_leave; widget_class->button_release_event = xfce_notify_window_button_release; @@ -175,7 +175,7 @@ xfce_notify_window_init(XfceNotifyWindow *window) window->expire_timeout = DEFAULT_EXPIRE_TIMEOUT; window->normal_opacity = DEFAULT_NORMAL_OPACITY; - + gtk_widget_set_name (GTK_WIDGET(window), "XfceNotifyWindow"); gtk_window_set_keep_above(GTK_WINDOW(window), TRUE); gtk_window_stick(GTK_WINDOW(window)); @@ -188,18 +188,18 @@ xfce_notify_window_init(XfceNotifyWindow *window) GDK_WINDOW_TYPE_HINT_NOTIFICATION); gtk_container_set_border_width(GTK_CONTAINER(window), 0); gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE); - + gtk_widget_add_events(GTK_WIDGET(window), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); screen = gtk_widget_get_screen(GTK_WIDGET(window)); if(gdk_screen_is_composited(screen)) { - GdkVisual *visual = gdk_screen_get_rgba_visual (screen); - if (visual == NULL) - visual = gdk_screen_get_system_visual (screen); - - gtk_widget_set_visual (GTK_WIDGET(window), visual); + GdkVisual *visual = gdk_screen_get_rgba_visual (screen); + if (visual == NULL) + visual = gdk_screen_get_system_visual (screen); + + gtk_widget_set_visual (GTK_WIDGET(window), visual); } gtk_widget_style_get(GTK_WIDGET(window), @@ -315,17 +315,17 @@ static inline int get_max_border_width (GtkStyleContext *context, GtkStateFlags state) { - GtkBorder border_width; - gint border_width_max; - - gtk_style_context_get_border (context, - state, - &border_width); + GtkBorder border_width; + gint border_width_max; + + gtk_style_context_get_border (context, + state, + &border_width); - border_width_max = MAX(border_width.left, - MAX(border_width.top, - MAX(border_width.bottom, border_width.right))); - return border_width_max; + border_width_max = MAX(border_width.left, + MAX(border_width.top, + MAX(border_width.bottom, border_width.right))); + return border_width_max; } @@ -337,20 +337,20 @@ xfce_notify_window_draw_rectangle (XfceNotifyWindow *window, gint radius = DEFAULT_RADIUS; GtkStateFlags state = GTK_STATE_FLAG_NORMAL; gint border_width; - GtkAllocation widget_allocation ; - GtkStyleContext *context; - + GtkAllocation widget_allocation ; + GtkStyleContext *context; + /* this secifies the border_padding from the edges in order to make * sure the border completely fits into the drawing area */ gdouble border_padding = 0.0; - gtk_widget_get_allocation (widget, &widget_allocation); - - /* Load the css style information for hover aka prelight */ - if (window->mouse_hover) - state = GTK_STATE_FLAG_PRELIGHT; + gtk_widget_get_allocation (widget, &widget_allocation); + + /* Load the css style information for hover aka prelight */ + if (window->mouse_hover) + state = GTK_STATE_FLAG_PRELIGHT; - context = gtk_widget_get_style_context (widget); + context = gtk_widget_get_style_context (widget); gtk_style_context_get (context, state, "border-radius", &radius, @@ -358,7 +358,7 @@ xfce_notify_window_draw_rectangle (XfceNotifyWindow *window, border_width = get_max_border_width (context, state); border_padding = border_width / 2.0; - + if(radius < 0.1) { cairo_rectangle(cr, 0, 0, widget_allocation.width, widget_allocation.height); @@ -392,56 +392,56 @@ static gboolean xfce_notify_window_draw (GtkWidget *widget, cairo_t *cr) { GtkStyleContext *context; - GdkRGBA *border_color, *bg_color; - gint border_width; - GtkStateFlags state; - double radius; + GdkRGBA *border_color, *bg_color; + gint border_width; + GtkStateFlags state; + double radius; cairo_t *cr2; cairo_surface_t *surface; cairo_region_t *region; GtkAllocation allocation; - - XfceNotifyWindow *window = XFCE_NOTIFY_WINDOW(widget); + + XfceNotifyWindow *window = XFCE_NOTIFY_WINDOW(widget); gtk_widget_get_allocation (widget, &allocation); - /* Create a similar surface as of cr */ + /* Create a similar surface as of cr */ surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height); cr2 = cairo_create (surface); - + /* Fill first with a transparent background */ cairo_rectangle (cr2, 0, 0, allocation.width, allocation.height); cairo_set_source_rgba (cr2, 0.5, 0.5, 0.5, 0.0); cairo_fill (cr2); - - /* Draw a rounded rectangle */ + + /* Draw a rounded rectangle */ xfce_notify_window_draw_rectangle (window, cr2); - state = GTK_STATE_FLAG_NORMAL; - /* Load the css style information for hover aka prelight */ - if (window->mouse_hover) - state = GTK_STATE_FLAG_PRELIGHT; - - /* Get the style context to get style properties */ + state = GTK_STATE_FLAG_NORMAL; + /* Load the css style information for hover aka prelight */ + if (window->mouse_hover) + state = GTK_STATE_FLAG_PRELIGHT; + + /* Get the style context to get style properties */ context = gtk_widget_get_style_context (widget); - gtk_style_context_get (context, - state, - "border-color", &border_color, + gtk_style_context_get (context, + state, + "border-color", &border_color, "background-color", &bg_color, "border-radius", &radius, - NULL); + NULL); - /* Draw the background, getting its color from the style context*/ + /* Draw the background, getting its color from the style context*/ cairo_set_source_rgba (cr2, bg_color->red, bg_color->green, bg_color->blue, 1.0); cairo_fill_preserve (cr2); gdk_rgba_free (bg_color); - /* Now draw the border */ + /* Now draw the border */ border_width = get_max_border_width (context, state); cairo_set_source_rgba (cr2, border_color->red, border_color->green, border_color->blue, @@ -450,10 +450,10 @@ static gboolean xfce_notify_window_draw (GtkWidget *widget, cairo_stroke (cr2); gdk_rgba_free (border_color); - /* Enough, everything we need has been written on the surface */ + /* Enough, everything we need has been written on the surface */ cairo_destroy (cr2); - - /* Set the surface drawn by cr2, to cr */ + + /* Set the surface drawn by cr2, to cr */ cairo_save (cr); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_set_source_surface (cr, surface, 0, 0); @@ -462,7 +462,7 @@ static gboolean xfce_notify_window_draw (GtkWidget *widget, region = gdk_cairo_region_create_from_surface (surface); if(!gtk_widget_is_composited(widget)) - gtk_widget_shape_combine_region(widget, region); + gtk_widget_shape_combine_region(widget, region); /* however, of course always set the input shape; it doesn't matter * if this is a pixel or two off here and there */ @@ -703,7 +703,7 @@ xfce_notify_window_set_body(XfceNotifyWindow *window, window->has_body_text = FALSE; } - if(gtk_widget_get_realized(GTK_WIDGET(window))) + if(gtk_widget_get_realized(GTK_WIDGET(window))) gtk_widget_queue_draw(GTK_WIDGET(window)); } @@ -914,7 +914,7 @@ xfce_notify_window_set_actions(XfceNotifyWindow *window, g_free(cur_button_text_escaped); } - if(gtk_widget_get_realized(GTK_WIDGET(window))) + if(gtk_widget_get_realized(GTK_WIDGET(window))) gtk_widget_queue_draw(GTK_WIDGET(window)); } @@ -974,7 +974,7 @@ xfce_notify_window_set_icon_only(XfceNotifyWindow *window, "halign", GTK_ALIGN_CENTER, NULL); } else { - g_object_set (window->icon_box, + g_object_set (window->icon_box, "halign", GTK_ALIGN_START, NULL); gtk_widget_set_size_request(window->icon_box, -1, -1); -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits