[Xfce4-commits] [apps/xfce4-taskmanager] 15/15: [wip] gets taskmanager to build with Gtk3
noreply at xfce.org
noreply at xfce.org
Mon Dec 8 23:02:14 CET 2014
This is an automated email from the git hooks/post-receive script.
landry pushed a commit to branch landry/gtk3
in repository apps/xfce4-taskmanager.
commit 3b11350b6a771529283b2f65220232c81bcaf6bc
Author: Landry Breuil <landry at xfce.org>
Date: Mon Dec 8 22:57:15 2014 +0100
[wip] gets taskmanager to build with Gtk3
- use gtk_widget_get_allocated_width/gtk_widget_get_allocated_height instead of poking at GtkAllocation internals
- use gtk_widget_get_window() instead of poking at window struct member
- correct args for gtk_paint_box/gtk_paint_shadow, probably wrong too but builds for now
---
src/process-monitor.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/process-monitor.c b/src/process-monitor.c
index 0b7cc6d..82cc3e6 100644
--- a/src/process-monitor.c
+++ b/src/process-monitor.c
@@ -167,7 +167,11 @@ xtm_process_monitor_expose (GtkWidget *widget, GdkEventExpose *event)
XtmProcessMonitor *monitor = XTM_PROCESS_MONITOR (widget);
guint minimum_history_length;
+#ifdef HAVE_GTK3
+ minimum_history_length = gtk_widget_get_allocated_width(widget) / monitor->step_size;
+#else
minimum_history_length = widget->allocation.width / monitor->step_size;
+#endif
if (monitor->history->len < minimum_history_length)
g_array_set_size (monitor->history, minimum_history_length + 1);
@@ -192,8 +196,13 @@ xtm_process_monitor_graph_surface_create (XtmProcessMonitor *monitor)
return NULL;
}
+#ifdef HAVE_GTK3
+ width = gtk_widget_get_allocated_width(GTK_WIDGET(monitor));
+ height = gtk_widget_get_allocated_height(GTK_WIDGET(monitor));
+#else
width = GTK_WIDGET (monitor)->allocation.width;
height = GTK_WIDGET (monitor)->allocation.height;
+#endif
step_size = monitor->step_size;
graph_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
@@ -250,16 +259,24 @@ xtm_process_monitor_paint (XtmProcessMonitor *monitor)
cairo_surface_t *graph_surface;
gint width, height;
gint i;
-
- cr = gdk_cairo_create (GTK_WIDGET (monitor)->window);
+ cr = gdk_cairo_create (gtk_widget_get_window(GTK_WIDGET(monitor)));
+#ifdef HAVE_GTK3
+ width = gtk_widget_get_allocated_width(GTK_WIDGET(monitor));
+ height = gtk_widget_get_allocated_height(GTK_WIDGET(monitor));
+#else
width = GTK_WIDGET (monitor)->allocation.width;
height = GTK_WIDGET (monitor)->allocation.height;
+#endif
/* Paint a box */
if (monitor->paint_box)
- gtk_paint_box (GTK_WIDGET (monitor)->style, GTK_WIDGET (monitor)->window, GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
+#ifdef HAVE_GTK3
+ gtk_paint_box (gtk_widget_get_style(GTK_WIDGET(monitor)), cr, GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
+ GTK_WIDGET (monitor), "trough", 0, 0, width, height);
+#else
+ gtk_paint_box (gtk_widget_get_style(GTK_WIDGET(monitor)), gtk_widget_get_window(GTK_WIDGET(monitor)), GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
NULL, GTK_WIDGET (monitor), "trough", 0, 0, width, height);
-
+#endif
/* Paint the graph */
graph_surface = xtm_process_monitor_graph_surface_create (monitor);
if (graph_surface != NULL)
@@ -301,8 +318,13 @@ xtm_process_monitor_paint (XtmProcessMonitor *monitor)
/* Repaint a shadow on top of everything to clear corners */
if (monitor->paint_box)
- gtk_paint_shadow (GTK_WIDGET (monitor)->style, GTK_WIDGET (monitor)->window, GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
+#ifdef HAVE_GTK3
+ gtk_paint_shadow (gtk_widget_get_style(GTK_WIDGET(monitor)), cr, GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
+ GTK_WIDGET (monitor), "trough", 0, 0, width, height);
+#else
+ gtk_paint_shadow (gtk_widget_get_style(GTK_WIDGET(monitor)), gtk_widget_get_window(GTK_WIDGET(monitor)), GTK_STATE_PRELIGHT, GTK_SHADOW_IN,
NULL, GTK_WIDGET (monitor), "trough", 0, 0, width, height);
+#endif
cairo_destroy (cr);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list