summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-08-19 01:19:54 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-08-19 01:19:54 +0000
commit246ac5e578323795b539bd51e38673a0ba6642b6 (patch)
tree0cab26d0dd86d6f76be45ba1065527e45d0bf779
parent505282697a9b073c8fa0f0108c905df65489789c (diff)
downloadmetacity-246ac5e578323795b539bd51e38673a0ba6642b6.tar.gz
use the delay exposes feature to avoid the scren dirt
2001-08-18 Havoc Pennington <hp@pobox.com> * src/effects.c (effects_draw_box_animation_timeout): use the delay exposes feature to avoid the scren dirt * src/ui.c (meta_image_window_set_position): use gtk_window_move() to set the position (meta_ui_push_delay_exposes): (meta_ui_pop_delay_exposes): feature to let us delay redraws until after we do server-grabbed draw-on-inferiors effects
-rw-r--r--ChangeLog11
-rw-r--r--src/effects.c2
-rw-r--r--src/frames.c47
-rw-r--r--src/frames.h6
-rw-r--r--src/ui.c14
-rw-r--r--src/ui.h9
6 files changed, 88 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ee87554c..cd81923f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-08-18 Havoc Pennington <hp@pobox.com>
+
+ * src/effects.c (effects_draw_box_animation_timeout): use the
+ delay exposes feature to avoid the scren dirt
+
+ * src/ui.c (meta_image_window_set_position): use gtk_window_move()
+ to set the position
+ (meta_ui_push_delay_exposes):
+ (meta_ui_pop_delay_exposes): feature to let us delay redraws until
+ after we do server-grabbed draw-on-inferiors effects
+
2001-08-17 Havoc Pennington <hp@redhat.com>
* src/window.c (meta_window_get_gravity_position): fix for
diff --git a/src/effects.c b/src/effects.c
index 91cc59e4..f9eb254c 100644
--- a/src/effects.c
+++ b/src/effects.c
@@ -100,6 +100,7 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context)
else
{
meta_display_ungrab (context->screen->display);
+ meta_ui_pop_delay_exposes (context->screen->ui);
XFreeGC (context->screen->display->xdisplay,
context->gc);
}
@@ -235,6 +236,7 @@ meta_effects_draw_box_animation (MetaScreen *screen,
/* Grab the X server to avoid screen dirt */
meta_display_grab (context->screen->display);
+ meta_ui_push_delay_exposes (context->screen->ui);
}
/* Do this only after we get the pixbuf from the server,
diff --git a/src/frames.c b/src/frames.c
index e09d41c2..f3274adb 100644
--- a/src/frames.c
+++ b/src/frames.c
@@ -278,6 +278,8 @@ meta_frames_init (MetaFrames *frames)
frames->frames = g_hash_table_new (unsigned_long_hash, unsigned_long_equal);
frames->tooltip_timeout = 0;
+
+ frames->expose_delay_count = 0;
}
static void
@@ -698,6 +700,7 @@ meta_frames_manage_window (MetaFrames *frames,
frame->xwindow = xwindow;
frame->layout = NULL;
+ frame->expose_delayed = FALSE;
meta_core_grab_buttons (gdk_display, frame->xwindow);
@@ -1601,6 +1604,13 @@ meta_frames_expose_event (GtkWidget *widget,
if (frame == NULL)
return FALSE;
+ if (frames->expose_delay_count > 0)
+ {
+ /* Redraw this entire frame later */
+ frame->expose_delayed = TRUE;
+ return TRUE;
+ }
+
meta_frames_calc_geometry (frames, frame, &fgeom);
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
meta_core_get_frame_size (gdk_display, frame->xwindow, &width, &height);
@@ -2096,3 +2106,40 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_NONE;
}
+
+void
+meta_frames_push_delay_exposes (MetaFrames *frames)
+{
+ frames->expose_delay_count += 1;
+}
+
+static void
+queue_pending_exposes_func (gpointer key, gpointer value, gpointer data)
+{
+ MetaUIFrame *frame;
+ MetaFrames *frames;
+
+ frames = META_FRAMES (data);
+ frame = value;
+
+ if (frame->expose_delayed)
+ {
+ gdk_window_invalidate_rect (frame->window, NULL, FALSE);
+ frame->expose_delayed = FALSE;
+ }
+}
+
+void
+meta_frames_pop_delay_exposes (MetaFrames *frames)
+{
+ g_return_if_fail (frames->expose_delay_count > 0);
+
+ frames->expose_delay_count -= 1;
+
+ if (frames->expose_delay_count == 0)
+ {
+ g_hash_table_foreach (frames->frames,
+ queue_pending_exposes_func,
+ frames);
+ }
+}
diff --git a/src/frames.h b/src/frames.h
index 4531d2a4..a3a77f8e 100644
--- a/src/frames.h
+++ b/src/frames.h
@@ -66,6 +66,7 @@ struct _MetaUIFrame
Window xwindow;
GdkWindow *window;
PangoLayout *layout;
+ guint expose_delayed : 1;
};
struct _MetaFrames
@@ -81,6 +82,8 @@ struct _MetaFrames
guint tooltip_timeout;
MetaUIFrame *last_motion_frame;
+
+ int expose_delay_count;
};
struct _MetaFramesClass
@@ -121,4 +124,7 @@ void meta_frames_notify_menu_hide (MetaFrames *frames);
Window meta_frames_get_moving_frame (MetaFrames *frames);
+void meta_frames_push_delay_exposes (MetaFrames *frames);
+void meta_frames_pop_delay_exposes (MetaFrames *frames);
+
#endif
diff --git a/src/ui.c b/src/ui.c
index 2e311518..a32313db 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -285,7 +285,7 @@ meta_image_window_set_position (MetaImageWindow *iw,
int x,
int y)
{
- gtk_widget_set_uposition (iw->window, x, y);
+ gtk_window_move (iw->window, x, y);
}
GdkPixbuf*
@@ -323,3 +323,15 @@ meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
return retval;
}
+void
+meta_ui_push_delay_exposes (MetaUI *ui)
+{
+ meta_frames_push_delay_exposes (ui->frames);
+}
+
+void
+meta_ui_pop_delay_exposes (MetaUI *ui)
+{
+ meta_frames_pop_delay_exposes (ui->frames);
+}
+
diff --git a/src/ui.h b/src/ui.h
index 6c03ae62..de9e5498 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -109,4 +109,13 @@ GdkPixbuf* meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
int dest_y,
int width,
int height);
+
+/* Used when we have a server grab and draw all over everything,
+ * then we need to handle exposes after doing that, instead of
+ * during it
+ */
+void meta_ui_push_delay_exposes (MetaUI *ui);
+void meta_ui_pop_delay_exposes (MetaUI *ui);
+
#endif
+