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
This commit is contained in:
Havoc Pennington 2001-08-19 01:19:54 +00:00 committed by Havoc Pennington
parent 505282697a
commit 246ac5e578
6 changed files with 88 additions and 1 deletions

View File

@ -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> 2001-08-17 Havoc Pennington <hp@redhat.com>
* src/window.c (meta_window_get_gravity_position): fix for * src/window.c (meta_window_get_gravity_position): fix for

View File

@ -100,6 +100,7 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context)
else else
{ {
meta_display_ungrab (context->screen->display); meta_display_ungrab (context->screen->display);
meta_ui_pop_delay_exposes (context->screen->ui);
XFreeGC (context->screen->display->xdisplay, XFreeGC (context->screen->display->xdisplay,
context->gc); context->gc);
} }
@ -235,6 +236,7 @@ meta_effects_draw_box_animation (MetaScreen *screen,
/* Grab the X server to avoid screen dirt */ /* Grab the X server to avoid screen dirt */
meta_display_grab (context->screen->display); 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, /* Do this only after we get the pixbuf from the server,

View File

@ -278,6 +278,8 @@ meta_frames_init (MetaFrames *frames)
frames->frames = g_hash_table_new (unsigned_long_hash, unsigned_long_equal); frames->frames = g_hash_table_new (unsigned_long_hash, unsigned_long_equal);
frames->tooltip_timeout = 0; frames->tooltip_timeout = 0;
frames->expose_delay_count = 0;
} }
static void static void
@ -698,6 +700,7 @@ meta_frames_manage_window (MetaFrames *frames,
frame->xwindow = xwindow; frame->xwindow = xwindow;
frame->layout = NULL; frame->layout = NULL;
frame->expose_delayed = FALSE;
meta_core_grab_buttons (gdk_display, frame->xwindow); meta_core_grab_buttons (gdk_display, frame->xwindow);
@ -1601,6 +1604,13 @@ meta_frames_expose_event (GtkWidget *widget,
if (frame == NULL) if (frame == NULL)
return FALSE; 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); meta_frames_calc_geometry (frames, frame, &fgeom);
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow); flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
meta_core_get_frame_size (gdk_display, frame->xwindow, &width, &height); meta_core_get_frame_size (gdk_display, frame->xwindow, &width, &height);
@ -2096,3 +2106,40 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_NONE; 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);
}
}

View File

@ -66,6 +66,7 @@ struct _MetaUIFrame
Window xwindow; Window xwindow;
GdkWindow *window; GdkWindow *window;
PangoLayout *layout; PangoLayout *layout;
guint expose_delayed : 1;
}; };
struct _MetaFrames struct _MetaFrames
@ -81,6 +82,8 @@ struct _MetaFrames
guint tooltip_timeout; guint tooltip_timeout;
MetaUIFrame *last_motion_frame; MetaUIFrame *last_motion_frame;
int expose_delay_count;
}; };
struct _MetaFramesClass struct _MetaFramesClass
@ -121,4 +124,7 @@ void meta_frames_notify_menu_hide (MetaFrames *frames);
Window meta_frames_get_moving_frame (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 #endif

View File

@ -285,7 +285,7 @@ meta_image_window_set_position (MetaImageWindow *iw,
int x, int x,
int y) int y)
{ {
gtk_widget_set_uposition (iw->window, x, y); gtk_window_move (iw->window, x, y);
} }
GdkPixbuf* GdkPixbuf*
@ -323,3 +323,15 @@ meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
return retval; 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);
}

View File

@ -109,4 +109,13 @@ GdkPixbuf* meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
int dest_y, int dest_y,
int width, int width,
int height); 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 #endif