Commit df1cc884 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor
Browse files

Update to changed cairo interface.

2005-05-17  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkdrawable-x11.c (gdk_x11_ref_cairo_surface):
        Update to changed cairo interface.

        * gdk/x11/gdkdrawable-x11.[ch]:
        Add _gdk_x11_drawable_update_size()

        * gdk/x11/gdkwindow-x11.c (gdk_window_resize)
        (gdk_window_move_resize)
        * gdk/x11/gdkevents-x11.c (gdk_event_translate):
        Call _gdk_x11_drawable_update_size().
parent 50ba0e23
2005-05-17 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_ref_cairo_surface):
Update to changed cairo interface.
* gdk/x11/gdkdrawable-x11.[ch]:
Add _gdk_x11_drawable_update_size()
* gdk/x11/gdkwindow-x11.c (gdk_window_resize)
(gdk_window_move_resize)
* gdk/x11/gdkevents-x11.c (gdk_event_translate):
Call _gdk_x11_drawable_update_size().
2005-05-17 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextview.c (cursor_blinks): Don't blink the cursor
......
2005-05-17 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_ref_cairo_surface):
Update to changed cairo interface.
* gdk/x11/gdkdrawable-x11.[ch]:
Add _gdk_x11_drawable_update_size()
* gdk/x11/gdkwindow-x11.c (gdk_window_resize)
(gdk_window_move_resize)
* gdk/x11/gdkevents-x11.c (gdk_event_translate):
Call _gdk_x11_drawable_update_size().
2005-05-17 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextview.c (cursor_blinks): Don't blink the cursor
......
2005-05-17 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_ref_cairo_surface):
Update to changed cairo interface.
* gdk/x11/gdkdrawable-x11.[ch]:
Add _gdk_x11_drawable_update_size()
* gdk/x11/gdkwindow-x11.c (gdk_window_resize)
(gdk_window_move_resize)
* gdk/x11/gdkevents-x11.c (gdk_event_translate):
Call _gdk_x11_drawable_update_size().
2005-05-17 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextview.c (cursor_blinks): Don't blink the cursor
......
......@@ -246,6 +246,27 @@ _gdk_x11_drawable_finish (GdkDrawable *drawable)
}
}
/**
* _gdk_x11_drawable_update_size:
* @drawable: a #GdkDrawableImplX11.
*
* Updates the state of the drawable (in particular the drawable's
* cairo surface) when its size has changed.
**/
void
_gdk_x11_drawable_update_size (GdkDrawable *drawable)
{
GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
if (impl->cairo_surface)
{
int width, height;
gdk_drawable_get_size (drawable, &width, &height);
cairo_xlib_surface_set_size (impl->cairo_surface, width, height);
}
}
static void
try_pixmap (Display *xdisplay,
int screen,
......@@ -1450,17 +1471,21 @@ gdk_x11_ref_cairo_surface (GdkDrawable *drawable)
if (!impl->cairo_surface)
{
GdkVisual *visual = NULL;
int width, height;
visual = gdk_drawable_get_visual (drawable);
gdk_drawable_get_size (drawable, &width, &height);
if (visual)
impl->cairo_surface = cairo_xlib_surface_create_with_visual (GDK_SCREEN_XDISPLAY (impl->screen),
impl->xid,
GDK_VISUAL_XVISUAL (visual));
else if (gdk_drawable_get_depth (drawable) == 1)
impl->cairo_surface = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (impl->screen),
impl->xid,
CAIRO_FORMAT_A1);
GDK_VISUAL_XVISUAL (visual),
width, height);
else if (gdk_drawable_get_depth (drawable) == 1)
impl->cairo_surface = cairo_xlib_surface_create_for_bitmap (GDK_SCREEN_XDISPLAY (impl->screen),
impl->xid,
width, height);
else
{
g_warning ("Using Cairo rendering requires the drawable argument to\n"
......@@ -1471,12 +1496,6 @@ gdk_x11_ref_cairo_surface (GdkDrawable *drawable)
return NULL;
}
if (GDK_IS_PIXMAP_IMPL_X11 (drawable))
{
GdkPixmapImplX11 *pix_impl = GDK_PIXMAP_IMPL_X11 (drawable);
cairo_xlib_surface_set_size (impl->cairo_surface, pix_impl->width, pix_impl->height);
}
cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key,
drawable, gdk_x11_cairo_surface_destroy);
}
......
......@@ -93,6 +93,7 @@ void _gdk_x11_convert_to_format (guchar *src_buf,
/* Note that the following take GdkDrawableImplX11, not the wrapper drawable */
void _gdk_x11_drawable_finish (GdkDrawable *drawable);
void _gdk_x11_drawable_update_size (GdkDrawable *drawable);
#ifdef __cplusplus
}
......
......@@ -1828,6 +1828,9 @@ gdk_event_translate (GdkDisplay *display,
window_private->y = event->configure.y;
window_impl->width = xevent->xconfigure.width;
window_impl->height = xevent->xconfigure.height;
_gdk_x11_drawable_update_size (window_private->impl);
if (window_private->resize_count >= 1)
{
window_private->resize_count -= 1;
......
......@@ -1735,6 +1735,7 @@ gdk_window_resize (GdkWindow *window,
{
_gdk_window_move_resize_child (window, private->x, private->y,
width, height);
_gdk_x11_drawable_update_size (private->impl);
}
else
{
......@@ -1748,6 +1749,7 @@ gdk_window_resize (GdkWindow *window,
{
impl->width = width;
impl->height = height;
_gdk_x11_drawable_update_size (private->impl);
}
else
{
......@@ -1755,6 +1757,8 @@ gdk_window_resize (GdkWindow *window,
private->resize_count += 1;
}
}
_gdk_x11_drawable_update_size (private->impl);
}
}
......@@ -1795,6 +1799,7 @@ gdk_window_move_resize (GdkWindow *window,
if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
{
_gdk_window_move_resize_child (window, x, y, width, height);
_gdk_x11_drawable_update_size (private->impl);
}
else
{
......@@ -1809,6 +1814,8 @@ gdk_window_move_resize (GdkWindow *window,
private->y = y;
impl->width = width;
impl->height = height;
_gdk_x11_drawable_update_size (private->impl);
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment