[Xfce4-commits] [apps/xfce4-notifyd] 21/29: The goal of this commit is to ensure that we always get draw event on time. This way we manage to draw the notification with its corner borders always correctly, even when there is no display compositing is disabled.
noreply at xfce.org
noreply at xfce.org
Wed Jun 29 23:20:11 CEST 2016
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 83c5da98bfbac7c284569526080b5c96c93373fa
Author: Ali Abdallah <aliovx at gmail.com>
Date: Sat Oct 31 09:27:46 2015 +0100
The goal of this commit is to ensure that we always
get draw event on time. This way we manage to draw
the notification with its corner borders always correctly,
even when there is no display compositing is disabled.
---
xfce4-notifyd/xfce-notify-daemon.c | 58 +++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index 07d0998..d46c061 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -653,13 +653,12 @@ xfce_notify_daemon_get_workarea(GdkScreen *screen,
g_list_free(windows_list);
}
+
static void
-xfce_notify_daemon_window_size_allocate(GtkWidget *widget,
- GtkAllocation *allocation,
- gpointer user_data)
+xfce_notify_daemon_window_set_pos (XfceNotifyDaemon *xndaemon,
+ XfceNotifyWindow *window)
{
- XfceNotifyDaemon *xndaemon = user_data;
- XfceNotifyWindow *window = XFCE_NOTIFY_WINDOW(widget);
+ GtkWidget *widget = GTK_WIDGET(window);
GdkScreen *p_screen = NULL;
GdkScreen *widget_screen;
GdkDisplay *display;
@@ -667,12 +666,16 @@ xfce_notify_daemon_window_size_allocate(GtkWidget *widget,
GdkDevice *pointer;
gint x, y, monitor, screen_n, max_width;
GdkRectangle *geom_tmp, geom, initial, widget_geom;
-
+ GtkAllocation allocation;
+ GtkRequisition req;
GList *list;
gboolean found = FALSE;
DBG("Size allocate called for %d", xndaemon->last_notification_id);
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_widget_get_preferred_size (widget, NULL, &req);
+
if(xndaemon->last_notification_id == 2)
/* First time we place a notification, initialize the arrays needed for
* that (workarea, notification lists...). */
@@ -713,8 +716,8 @@ xfce_notify_daemon_window_size_allocate(GtkWidget *widget,
gtk_window_set_screen(GTK_WINDOW(widget), p_screen);
/* Set initial geometry */
- initial.width = allocation->width;
- initial.height = allocation->height;
+ initial.width = req.width;
+ initial.height = req.height;
switch(xndaemon->notify_location) {
case GTK_CORNER_TOP_LEFT:
@@ -723,15 +726,15 @@ xfce_notify_daemon_window_size_allocate(GtkWidget *widget,
break;
case GTK_CORNER_BOTTOM_LEFT:
initial.x = geom.x + SPACE;
- initial.y = geom.y + geom.height - allocation->height - SPACE;
+ initial.y = geom.y + geom.height - req.height - SPACE;
break;
case GTK_CORNER_TOP_RIGHT:
- initial.x = geom.x + geom.width - allocation->width - SPACE;
+ initial.x = geom.x + geom.width - req.width - SPACE;
initial.y = geom.y + SPACE;
break;
case GTK_CORNER_BOTTOM_RIGHT:
- initial.x = geom.x + geom.width - allocation->width - SPACE;
- initial.y = geom.y + geom.height - allocation->height - SPACE;
+ initial.x = geom.x + geom.width - req.width - SPACE;
+ initial.y = geom.y + geom.height - req.height - SPACE;
break;
default:
g_warning("Invalid notify location: %d", xndaemon->notify_location);
@@ -890,6 +893,14 @@ xfce_notify_daemon_window_size_allocate(GtkWidget *widget,
static void
+xfce_notify_daemon_window_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ gpointer user_data)
+{
+ xfce_notify_daemon_window_set_pos (XFCE_NOTIFY_DAEMON(user_data), XFCE_NOTIFY_WINDOW(widget));
+}
+
+static void
xfce_notify_daemon_update_reserved_rectangles(gpointer key,
gpointer value,
gpointer data)
@@ -910,7 +921,7 @@ xfce_notify_daemon_update_reserved_rectangles(gpointer key,
allocation.width = width;
allocation.height = height;
- xfce_notify_daemon_window_size_allocate(GTK_WIDGET(window), &allocation, xndaemon);
+ xfce_notify_daemon_window_set_pos (xndaemon, window);
}
@@ -941,14 +952,6 @@ static gboolean notify_get_capabilities (XfceNotifyGBus *skeleton,
return TRUE;
}
-
-static gboolean
-notify_show_window (gpointer window)
-{
- gtk_widget_show(GTK_WIDGET(window));
- return FALSE;
-}
-
static void
add_and_propagate_css_provider (GtkWidget *widget, GtkStyleProvider *provider, guint priority)
{
@@ -1101,7 +1104,6 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton,
OUT_id = replaces_id;
} else {
- GtkStyleContext *context;
window = XFCE_NOTIFY_WINDOW(xfce_notify_window_new_with_actions(summary, body,
app_icon,
expire_timeout,
@@ -1121,15 +1123,15 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton,
g_signal_connect(G_OBJECT(window), "closed",
G_CALLBACK(xfce_notify_daemon_window_closed),
xndaemon);
+
+ gtk_widget_show (GTK_WIDGET(window));
+ xfce_notify_daemon_window_set_pos (xndaemon, window);
+
g_signal_connect(G_OBJECT(window), "size-allocate",
G_CALLBACK(xfce_notify_daemon_window_size_allocate),
xndaemon);
-
- gtk_widget_realize(GTK_WIDGET(window));
-
+
notify_update_theme_for_window (xndaemon, GTK_WIDGET(window), FALSE);
-
- g_idle_add(notify_show_window, window);
}
if(!app_icon || !*app_icon) {
@@ -1178,8 +1180,6 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton,
else
xfce_notify_window_unset_gauge_value(window);
- gtk_widget_realize(GTK_WIDGET(window));
-
/* Remove close timeout as we display a new notification */
if(xndaemon->close_timeout)
g_source_remove(xndaemon->close_timeout);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list