[gimp] app: the goats are invading again, and are almost undeprecated
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: the goats are invading again, and are almost undeprecated
- Date: Sun, 20 May 2018 19:39:30 +0000 (UTC)
commit f7f329b7e20a470db252efbd6194ad71e8da4b90
Author: Michael Natterer <mitch gimp org>
Date: Tue May 8 00:39:29 2018 +0200
app: the goats are invading again, and are almost undeprecated
app/dialogs/lebl-dialog.c | 37 ++++++++++++++++---------------------
1 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/app/dialogs/lebl-dialog.c b/app/dialogs/lebl-dialog.c
index 61ce585..2f41355 100644
--- a/app/dialogs/lebl-dialog.c
+++ b/app/dialogs/lebl-dialog.c
@@ -160,7 +160,7 @@ inv_show_status (void)
}
static gboolean
-inv_draw (gpointer data)
+inv_queue_draw_idle (gpointer data)
{
gtk_widget_queue_draw (data);
@@ -171,7 +171,7 @@ static void
inv_queue_draw (GtkWidget *window)
{
if (inv_draw_idle == 0)
- inv_draw_idle = g_idle_add (inv_draw, window);
+ inv_draw_idle = g_idle_add (inv_queue_draw_idle, window);
}
static void
@@ -190,7 +190,7 @@ inv_draw_explosion (int x, int y)
for (i = 5; i < 100; i += 5) {
cairo_arc (cr, x, y, i, 0, 2 * G_PI);
cairo_fill (cr);
- gdk_flush ();
+ gdk_display_flush (gtk_widget_get_display (geginv_canvas));
g_usleep (50000);
}
@@ -199,7 +199,7 @@ inv_draw_explosion (int x, int y)
for (i = 5; i < 100; i += 5) {
cairo_arc (cr, x, y, i, 0, 2 * G_PI);
cairo_fill (cr);
- gdk_flush ();
+ gdk_display_flush (gtk_widget_get_display (geginv_canvas));
g_usleep (50000);
}
@@ -681,9 +681,8 @@ geginv_destroyed (GtkWidget *w, gpointer data)
}
static gboolean
-inv_expose (GtkWidget *widget, GdkEventExpose *event)
+inv_draw (GtkWidget *widget, cairo_t *cr)
{
- cairo_t *cr;
GdkPixbuf *goat;
GSList *li;
int i, j;
@@ -693,11 +692,6 @@ inv_expose (GtkWidget *widget, GdkEventExpose *event)
return TRUE;
}
- if ( ! gtk_widget_is_drawable (geginv_canvas))
- return TRUE;
-
- cr = gdk_cairo_create (gtk_widget_get_window (geginv_canvas));
-
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_paint (cr);
@@ -755,10 +749,6 @@ inv_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_fill (cr);
}
- cairo_destroy (cr);
-
- gdk_flush ();
-
if (inv_do_pause) {
g_usleep (G_USEC_PER_SEC);
inv_do_pause = FALSE;
@@ -773,6 +763,8 @@ gboolean gimp_lebl_dialog (void);
gboolean
gimp_lebl_dialog (void)
{
+ GdkMonitor *monitor;
+ GdkRectangle workarea;
GtkWidget *vbox;
int i, j;
@@ -784,13 +776,16 @@ gimp_lebl_dialog (void)
inv_width = 800;
inv_height = 600;
- if (inv_width > gdk_screen_get_width (gdk_screen_get_default ()) * 0.9) {
- inv_width = gdk_screen_get_width (gdk_screen_get_default ()) * 0.9;
+ monitor = gimp_get_monitor_at_pointer ();
+ gdk_monitor_get_workarea (monitor, &workarea);
+
+ if (inv_width > workarea.width * 0.9) {
+ inv_width = workarea.width * 0.9;
inv_height = inv_width * (600.0/800.0);
}
- if (inv_height > gdk_screen_get_height (gdk_screen_get_default ()) * 0.9) {
- inv_height = gdk_screen_get_height (gdk_screen_get_default ()) * 0.9;
+ if (inv_height > workarea.height * 0.9) {
+ inv_height = workarea.height * 0.9;
inv_width = inv_height * (800.0/600.0);
}
@@ -840,8 +835,8 @@ gimp_lebl_dialog (void)
G_CALLBACK (inv_key_press), NULL);
g_signal_connect (G_OBJECT (geginv), "key_release_event",
G_CALLBACK (inv_key_release), NULL);
- g_signal_connect (G_OBJECT (geginv_canvas), "expose_event",
- G_CALLBACK (inv_expose), NULL);
+ g_signal_connect (G_OBJECT (geginv_canvas), "draw",
+ G_CALLBACK (inv_draw), NULL);
g_slist_foreach (inv_shots, (GFunc)g_free, NULL);
g_slist_free (inv_shots);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]