Initial client-side-windows work

The history before this was kind of twisted as several different
approaches were tested, so that was all squashed into this initial
commit to hide the uninteresting changes and files that were later
removed.
This commit is contained in:
Alexander Larsson 2008-07-18 15:03:42 +02:00 committed by Alexander Larsson
parent e2a2ba9d98
commit eabac453e6
33 changed files with 5638 additions and 1997 deletions

View File

@ -120,6 +120,7 @@ gdk_c_sources = \
gdkintl.h \
gdkkeys.c \
gdkkeyuni.c \
gdkoffscreenwindow.c \
gdkpango.c \
gdkpixbuf-drawable.c \
gdkpixbuf-render.c \

View File

@ -71,7 +71,6 @@ gdk_set_use_xshm
gdk_keyboard_grab
gdk_keyboard_grab_info_libgtk_only
gdk_pointer_grab
gdk_pointer_grab_info_libgtk_only
#endif
#endif
@ -85,6 +84,8 @@ gdk_pointer_is_grabbed
gdk_pointer_ungrab
gdk_event_send_client_message
gdk_event_send_clientmessage_toall
gdk_pointer_grab_info_libgtk_only
gdk_display_pointer_is_grabbed
#endif
#endif
@ -254,12 +255,6 @@ gdk_visual_type_get_type G_GNUC_CONST
#endif
#endif
#if IN_HEADER(__GDK_PIXMAP_H__)
#if IN_FILE(__GDK_PIXMAP_X11_C__)
gdk_bitmap_create_from_data
#endif
#endif
#if IN_HEADER(__GDK_FONT_H__)
#if IN_FILE(__GDK_FONT_C__)
#ifndef GDK_DISABLE_DEPRECATED
@ -466,7 +461,6 @@ gdk_display_get_default_screen
gdk_display_get_name
gdk_display_get_n_screens
gdk_display_get_screen
gdk_display_pointer_is_grabbed
gdk_display_pointer_ungrab
gdk_display_keyboard_ungrab
gdk_display_open
@ -719,6 +713,13 @@ gdk_window_set_composited
#endif
#endif
#if IN_HEADER(__GDK_WINDOW_H__)
#if IN_FILE(__GDK_OFFSCREEN_WINDOW_C__)
gdk_window_set_offscreen_hooks
gdk_window_get_offscreen_pixmap
#endif
#endif
#if IN_HEADER(__GDK_WINDOW_H__)
#if IN_FILE(__GDK_DND_X11_C__)
gdk_window_register_dnd
@ -925,23 +926,24 @@ gdk_pixbuf_render_to_drawable_alpha
#if IN_HEADER(__GDK_PIXMAP_H__)
#if IN_FILE(__GDK_PIXMAP_C__)
gdk_bitmap_create_from_data
gdk_pixmap_colormap_create_from_xpm
gdk_pixmap_create_from_data
gdk_pixmap_create_from_xpm
gdk_pixmap_colormap_create_from_xpm_d
gdk_pixmap_create_from_xpm_d
gdk_pixmap_get_type G_GNUC_CONST
gdk_pixmap_new
#endif
#endif
#if IN_HEADER(__GDK_PIXMAP_H__)
#if IN_FILE(__GDK_PIXMAP_X11_C__)
gdk_pixmap_create_from_data
gdk_pixmap_foreign_new
gdk_pixmap_foreign_new_for_display
gdk_pixmap_foreign_new_for_screen
gdk_pixmap_lookup
gdk_pixmap_lookup_for_display
gdk_pixmap_new
#endif
#endif

View File

@ -50,6 +50,10 @@ gdk_cairo_create (GdkDrawable *drawable)
surface = _gdk_drawable_ref_cairo_surface (drawable);
cr = cairo_create (surface);
if (GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip)
GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip (drawable, cr);
cairo_surface_destroy (surface);
return cr;

View File

@ -22,9 +22,11 @@
*/
#include "config.h"
#include <math.h>
#include <glib.h>
#include "gdk.h" /* gdk_event_send_client_message() */
#include "gdkdisplay.h"
#include "gdkwindowimpl.h"
#include "gdkinternals.h"
#include "gdkmarshalers.h"
#include "gdkscreen.h"
@ -60,6 +62,14 @@ static GdkWindow* singlehead_default_window_get_pointer (GdkWindow *window
static GdkWindow* singlehead_default_window_at_pointer (GdkScreen *screen,
gint *win_x,
gint *win_y);
static GdkWindow *gdk_window_real_window_get_pointer (GdkDisplay *display,
GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
static GdkWindow *gdk_display_real_get_window_at_pointer (GdkDisplay *display,
gint *win_x,
gint *win_y);
static guint signals[LAST_SIGNAL] = { 0 };
@ -67,8 +77,8 @@ static char *gdk_sm_client_id;
static const GdkDisplayPointerHooks default_pointer_hooks = {
_gdk_windowing_get_pointer,
_gdk_windowing_window_get_pointer,
_gdk_windowing_window_at_pointer
gdk_window_real_window_get_pointer,
gdk_display_real_get_window_at_pointer
};
static const GdkDisplayPointerHooks singlehead_pointer_hooks = {
@ -473,6 +483,79 @@ gdk_display_get_pointer (GdkDisplay *display,
*mask = tmp_mask;
}
static GdkWindow *
gdk_display_real_get_window_at_pointer (GdkDisplay *display,
gint *win_x,
gint *win_y)
{
GdkWindow *window;
gint x, y;
window = _gdk_windowing_window_at_pointer (display, &x, &y);
/* This might need corrections, as the native window returned
may contain client side children */
if (window)
{
double xx, yy;
window = _gdk_window_find_descendant_at (window,
x, y,
&xx, &yy);
x = floor (xx + 0.5);
y = floor (yy + 0.5);
}
*win_x = x;
*win_y = y;
return window;
}
static GdkWindow *
gdk_window_real_window_get_pointer (GdkDisplay *display,
GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
GdkWindowObject *private;
GdkWindow *pointer_window;
gint tmpx, tmpy;
private = (GdkWindowObject *) window;
pointer_window = _gdk_windowing_window_get_pointer (display,
window,
&tmpx, &tmpy,
mask);
/* We got the coords on the impl, conver to the window */
tmpx += private->abs_x;
tmpy += private->abs_y;
if (x)
*x = tmpx;
if (y)
*y = tmpy;
/* We need to recalculate the true child window with the pointer in it
due to possible client side child windows */
if (pointer_window != NULL)
{
/* First get the pointer coords relative to pointer_window */
_gdk_windowing_window_get_pointer (display,
pointer_window,
&tmpx, &tmpy,
NULL);
/* Then convert that to a client side window */
pointer_window = _gdk_window_find_descendant_at (pointer_window,
tmpx, tmpy,
NULL, NULL);
}
return pointer_window;
}
/**
* gdk_display_get_window_at_pointer:
* @display: a #GdkDisplay
@ -586,8 +669,8 @@ singlehead_default_window_get_pointer (GdkWindow *window,
gint *y,
GdkModifierType *mask)
{
return _gdk_windowing_window_get_pointer (gdk_drawable_get_display (window),
window, x, y, mask);
return gdk_window_real_window_get_pointer (gdk_drawable_get_display (window),
window, x, y, mask);
}
static GdkWindow*
@ -595,8 +678,8 @@ singlehead_default_window_at_pointer (GdkScreen *screen,
gint *win_x,
gint *win_y)
{
return _gdk_windowing_window_at_pointer (gdk_screen_get_display (screen),
win_x, win_y);
return gdk_display_real_get_window_at_pointer (gdk_screen_get_display (screen),
win_x, win_y);
}
/**
@ -632,5 +715,200 @@ gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks)
return (GdkPointerHooks *)result;
}
static void
generate_grab_broken_event (GdkWindow *window,
gboolean keyboard,
gboolean implicit,
GdkWindow *grab_window)
{
g_return_if_fail (window != NULL);
if (!GDK_WINDOW_DESTROYED (window))
{
GdkEvent event;
event.type = GDK_GRAB_BROKEN;
event.grab_broken.window = window;
event.grab_broken.send_event = 0;
event.grab_broken.keyboard = keyboard;
event.grab_broken.implicit = implicit;
event.grab_broken.grab_window = grab_window;
gdk_event_put (&event);
}
}
void
_gdk_display_set_has_pointer_grab (GdkDisplay *display,
GdkWindow *window,
GdkWindow *native_window,
gboolean owner_events,
GdkEventMask event_mask,
unsigned long serial,
guint32 time,
gboolean implicit)
{
int wx, wy;
/* Normal GRAB events are sent by listening for enter and leave
* events on the native event window, which is then proxied
* into the virtual windows when the events are seen.
* However, there are two cases where X will not send these events:
* * When there is already a grab on the native parent of the
* virtual grab window
* * When there is no grab, but the pointer is already in the
* native parent of the virtual grab window
* In the first case we send the right GRAB events from the grab, but
* in the second case we need to generate our own UNGRAB crossing events.
*/
if (display->pointer_grab.window != NULL &&
display->pointer_grab.window != window)
{
generate_grab_broken_event (GDK_WINDOW (display->pointer_grab.window),
FALSE, display->pointer_grab.implicit,
window);
/* Re-grabbing. Pretend we have no grab for now so that
the GRAB events get delivered */
display->pointer_grab.window = NULL;
_gdk_syntesize_crossing_events (display,
display->pointer_grab.window,
window,
GDK_CROSSING_GRAB,
/* These may be stale... */
display->pointer_info.toplevel_x,
display->pointer_info.toplevel_y,
display->pointer_info.state,
time, TRUE, TRUE);
}
else if (_gdk_windowing_window_at_pointer (display, &wx, &wy) == native_window)
{
_gdk_syntesize_crossing_events (display,
display->pointer_info.window_under_pointer,
window,
GDK_CROSSING_GRAB,
/* These may be stale... */
display->pointer_info.toplevel_x,
display->pointer_info.toplevel_y,
display->pointer_info.state,
time, TRUE, TRUE);
}
display->pointer_grab.window = window;
display->pointer_grab.native_window = native_window;
display->pointer_grab.serial = serial;
display->pointer_grab.owner_events = owner_events;
display->pointer_grab.event_mask = event_mask;
display->pointer_grab.time = time;
display->pointer_grab.implicit = implicit;
display->pointer_grab.converted_implicit = FALSE;
}
void
_gdk_display_unset_has_pointer_grab (GdkDisplay *display,
gboolean implicit,
gboolean do_grab_one_pointer_release_event,
guint32 time)
{
int wx, wy;
GdkWindow *old_grab_window;
GdkWindow *old_native_grab_window;
old_grab_window = display->pointer_grab.window;
old_native_grab_window = display->pointer_grab.native_window;
if (do_grab_one_pointer_release_event)
display->pointer_grab.grab_one_pointer_release_event = display->pointer_grab.window;
/* We need to set this to null befor syntesizing events to make sure they get
delivered to anything but the grab window */
display->pointer_grab.window = NULL;
/* Normal UNGRAB events are sent by listening for enter and leave
* events on the native event window, which is then proxied
* into the virtual windows when the events are seen.
* However, there are two cases where X will not send these events:
* * When this ungrab is due to a new grab on the native window that
* is a parent of the currently grabbed virtual window
* * When there is no new grab, and the pointer is already in the
* grabbed virtual windows parent native window
* In the first case we send the right GRAB events from the grab, but
* in the second case we need to generate our own UNGRAB crossing events.
*/
if (_gdk_windowing_window_at_pointer (display, &wx, &wy) == old_native_grab_window)
{
_gdk_syntesize_crossing_events (display,
old_grab_window,
display->pointer_info.window_under_pointer,
GDK_CROSSING_UNGRAB,
/* These may be stale... */
display->pointer_info.toplevel_x,
display->pointer_info.toplevel_y,
display->pointer_info.state,
time, TRUE, TRUE);
}
if (implicit)
generate_grab_broken_event (old_grab_window,
FALSE, implicit,
NULL);
}
/**
* gdk_pointer_grab_info_libgtk_only:
* @display: the #GdkDisplay for which to get the grab information
* @grab_window: location to store current grab window
* @owner_events: location to store boolean indicating whether
* the @owner_events flag to gdk_pointer_grab() was %TRUE.
*
* Determines information about the current pointer grab.
* This is not public API and must not be used by applications.
*
* Return value: %TRUE if this application currently has the
* pointer grabbed.
**/
gboolean
gdk_pointer_grab_info_libgtk_only (GdkDisplay *display,
GdkWindow **grab_window,
gboolean *owner_events)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
if (display->pointer_grab.window)
{
if (grab_window)
*grab_window = (GdkWindow *)display->pointer_grab.window;
if (owner_events)
*owner_events = display->pointer_grab.owner_events;
return TRUE;
}
else
return FALSE;
}
/**
* gdk_display_pointer_is_grabbed:
* @display: a #GdkDisplay
*
* Test if the pointer is grabbed.
*
* Returns: %TRUE if an active X pointer grab is in effect
*
* Since: 2.2
*/
gboolean
gdk_display_pointer_is_grabbed (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
return (display->pointer_grab.window != NULL &&
!display->pointer_grab.implicit);
}
#define __GDK_DISPLAY_C__
#include "gdkaliasdef.c"

View File

@ -43,6 +43,32 @@ typedef struct _GdkDisplayPointerHooks GdkDisplayPointerHooks;
#define GDK_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY))
#define GDK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass))
/* Tracks information about the pointer grab on this display */
typedef struct
{
GdkWindow *window;
GdkWindow *native_window;
gulong serial;
gboolean owner_events;
guint event_mask;
gboolean implicit;
gboolean converted_implicit;
guint32 time;
GdkWindow *grab_one_pointer_release_event;
} GdkPointerGrabInfo;
/* Tracks information about which window the pointer is in and
* at what position the mouse is. This is useful when we need
* to synthesize events later.
*/
typedef struct
{
GdkWindow *window_under_pointer;
gdouble toplevel_x, toplevel_y;
guint32 state;
} GdkPointerWindowInfo;
struct _GdkDisplay
{
GObject parent_instance;
@ -68,6 +94,9 @@ struct _GdkDisplay
guint double_click_distance; /* Maximum distance between clicks in pixels */
gint button_x[2]; /* The last 2 button click positions. */
gint button_y[2];
GdkPointerGrabInfo pointer_grab;
GdkPointerWindowInfo pointer_info;
};
struct _GdkDisplayClass

View File

@ -652,6 +652,8 @@ gdk_draw_drawable (GdkDrawable *drawable,
&composite_x_offset,
&composite_y_offset);
/* TODO: For non-native windows this may copy stuff from other overlapping
windows. We should clip that and clear that area in the destination instead. */
GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, composite,
xsrc - composite_x_offset,
@ -871,7 +873,7 @@ real_draw_glyphs (GdkDrawable *drawable,
cairo_t *cr;
cr = gdk_cairo_create (drawable);
_gdk_gc_update_context (gc, cr, NULL, NULL, TRUE);
_gdk_gc_update_context (gc, cr, NULL, NULL, TRUE, drawable);
if (matrix)
{
@ -995,7 +997,7 @@ gdk_draw_trapezoids (GdkDrawable *drawable,
g_return_if_fail (n_trapezoids == 0 || trapezoids != NULL);
cr = gdk_cairo_create (drawable);
_gdk_gc_update_context (gc, cr, NULL, NULL, TRUE);
_gdk_gc_update_context (gc, cr, NULL, NULL, TRUE, drawable);
for (i = 0; i < n_trapezoids; i++)
{
@ -1185,7 +1187,7 @@ gdk_drawable_real_get_image (GdkDrawable *drawable,
return gdk_drawable_copy_to_image (drawable, NULL, x, y, 0, 0, width, height);
}
static GdkDrawable*
static GdkDrawable *
gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
gint x,
gint y,
@ -1771,5 +1773,25 @@ _gdk_drawable_get_scratch_gc (GdkDrawable *drawable,
}
}
/**
* _gdk_drawable_get_source_drawable:
* @drawable: a #GdkDrawable
*
* Returns a drawable for the passed @drawable that is guaranteed to be
* usable to create a pixmap (e.g.: not an offscreen window).
*
* Since: 2.16
*/
GdkDrawable *
_gdk_drawable_get_source_drawable (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
if (GDK_DRAWABLE_GET_CLASS (drawable)->get_source_drawable)
return GDK_DRAWABLE_GET_CLASS (drawable)->get_source_drawable (drawable);
return drawable;
}
#define __GDK_DRAW_C__
#include "gdkaliasdef.c"

View File

@ -200,9 +200,11 @@ struct _GdkDrawableClass
cairo_surface_t *(*ref_cairo_surface) (GdkDrawable *drawable);
GdkDrawable *(*get_source_drawable) (GdkDrawable *drawable);
void (*set_cairo_clip) (GdkDrawable *drawable,
cairo_t *cr);
/* Padding for future expansion */
void (*_gdk_reserved4) (void);
void (*_gdk_reserved5) (void);
void (*_gdk_reserved6) (void);
void (*_gdk_reserved7) (void);
void (*_gdk_reserved9) (void);

View File

@ -120,6 +120,63 @@ _gdk_event_queue_append (GdkDisplay *display,
return display->queued_tail;
}
/**
* _gdk_event_queue_insert_after:
* @display: a #GdkDisplay
* @sibling: Append after this event.
* @event: Event to append.
*
* Appends an event after the specified event, or if it isn't in
* the queue, onto the tail of the event queue.
*
* Returns: the newly appended list node.
*
* Since: 2.16
*/
GList*
_gdk_event_queue_insert_after (GdkDisplay *display,
GdkEvent *sibling,
GdkEvent *event)
{
GList *prev = g_list_find (display->queued_events, sibling);
if (prev && prev->next)
{
display->queued_events = g_list_insert_before (display->queued_events, prev->next, event);
return prev->next;
}
else
return _gdk_event_queue_append (display, event);
}
/**
* _gdk_event_queue_insert_after:
* @display: a #GdkDisplay
* @sibling: Append after this event.
* @event: Event to append.
*
* Appends an event before the specified event, or if it isn't in
* the queue, onto the tail of the event queue.
*
* Returns: the newly appended list node.
*
* Since: 2.16
*/
GList*
_gdk_event_queue_insert_before (GdkDisplay *display,
GdkEvent *sibling,
GdkEvent *event)
{
GList *next = g_list_find (display->queued_events, sibling);
if (next)
{
display->queued_events = g_list_insert_before (display->queued_events, next, event);
return next->prev;
}
else
return _gdk_event_queue_append (display, event);
}
/**
* _gdk_event_queue_remove_link:
* @display: a #GdkDisplay
@ -1101,13 +1158,16 @@ gdk_synthesize_click (GdkDisplay *display,
gint nclicks)
{
GdkEvent temp_event;
GdkEvent *event_copy;
GList *link;
g_return_if_fail (event != NULL);
temp_event = *event;
temp_event.type = (nclicks == 2) ? GDK_2BUTTON_PRESS : GDK_3BUTTON_PRESS;
gdk_display_put_event (display, &temp_event);
event_copy = gdk_event_copy (&temp_event);
link = _gdk_event_queue_append (display, event_copy);
}
void

View File

@ -151,7 +151,8 @@ typedef enum
GDK_SETTING = 33,
GDK_OWNER_CHANGE = 34,
GDK_GRAB_BROKEN = 35,
GDK_DAMAGE = 36
GDK_DAMAGE = 36,
GDK_EVENT_LAST /* helper variable for decls */
} GdkEventType;
/* Event masks. (Used to select what types of events a window

View File

@ -43,6 +43,8 @@ struct _GdkGCPrivate
{
GdkRegion *clip_region;
GdkSubwindowMode subwindow_mode;
GdkFill fill;
GdkBitmap *stipple;
GdkPixmap *tile;
@ -172,6 +174,8 @@ _gdk_gc_init (GdkGC *gc,
priv->fg_pixel = values->foreground.pixel;
if (values_mask & GDK_GC_BACKGROUND)
priv->bg_pixel = values->background.pixel;
if (values_mask & GDK_GC_SUBWINDOW)
priv->subwindow_mode = values->subwindow_mode;
gc->colormap = gdk_drawable_get_colormap (drawable);
if (gc->colormap)
@ -183,7 +187,7 @@ gdk_gc_finalize (GObject *object)
{
GdkGC *gc = GDK_GC (object);
GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
if (priv->clip_region)
gdk_region_destroy (priv->clip_region);
if (gc->colormap)
@ -313,6 +317,8 @@ gdk_gc_set_values (GdkGC *gc,
priv->fg_pixel = values->foreground.pixel;
if (values_mask & GDK_GC_BACKGROUND)
priv->bg_pixel = values->background.pixel;
if (values_mask & GDK_GC_SUBWINDOW)
priv->subwindow_mode = values->subwindow_mode;
GDK_GC_GET_CLASS (gc)->set_values (gc, values, values_mask);
}
@ -542,9 +548,11 @@ gdk_gc_set_clip_mask (GdkGC *gc,
gdk_gc_set_values (gc, &values, GDK_GC_CLIP_MASK);
}
static void
/* Takes ownership of passed in region */
void
_gdk_gc_set_clip_region_internal (GdkGC *gc,
GdkRegion *region)
GdkRegion *region,
gboolean reset_origin)
{
GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
@ -553,7 +561,32 @@ _gdk_gc_set_clip_region_internal (GdkGC *gc,
priv->clip_region = region;
_gdk_windowing_gc_set_clip_region (gc, region);
_gdk_windowing_gc_set_clip_region (gc, region, reset_origin);
}
/* Takes ownership of passed in region, returns old clip region */
void
_gdk_gc_intersect_clip_region (GdkGC *gc,
GdkRegion *region,
GdkRegion **old_clip_region)
{
GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
GdkRegion *old_clip;
old_clip = priv->clip_region;
priv->clip_region = region;
if (old_clip)
gdk_region_intersect (region, old_clip);
if (old_clip_region)
*old_clip_region = old_clip;
else
gdk_region_destroy (old_clip);
_gdk_windowing_gc_set_clip_region (gc, priv->clip_region, FALSE);
return old_clip;
}
/**
@ -578,7 +611,7 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
else
region = NULL;
_gdk_gc_set_clip_region_internal (gc, region);
_gdk_gc_set_clip_region_internal (gc, region, TRUE);
}
/**
@ -603,7 +636,7 @@ gdk_gc_set_clip_region (GdkGC *gc,
else
copy = NULL;
_gdk_gc_set_clip_region_internal (gc, copy);
_gdk_gc_set_clip_region_internal (gc, copy, TRUE);
}
/**
@ -723,13 +756,27 @@ gdk_gc_set_subwindow (GdkGC *gc,
GdkSubwindowMode mode)
{
GdkGCValues values;
GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
g_return_if_fail (GDK_IS_GC (gc));
/* This could get called a lot to reset the subwindow mode in
the client side clipping, so bail out early */
if (priv->subwindow_mode == mode)
return;
values.subwindow_mode = mode;
gdk_gc_set_values (gc, &values, GDK_GC_SUBWINDOW);
}
GdkSubwindowMode
_gdk_gc_get_subwindow (GdkGC *gc)
{
GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
return priv->subwindow_mode;
}
/**
* gdk_gc_set_exposures:
* @gc: a #GdkGC.
@ -907,6 +954,7 @@ gdk_gc_copy (GdkGC *dst_gc,
dst_priv->fg_pixel = src_priv->fg_pixel;
dst_priv->bg_pixel = src_priv->bg_pixel;
dst_priv->subwindow_mode = src_priv->subwindow_mode;
}
/**
@ -1117,6 +1165,8 @@ gc_get_background (GdkGC *gc,
* the fill mode will be forced to %GDK_STIPPLED
* @gc_changed: pass %FALSE if the @gc has not changed since the
* last call to this function
* @target_drawable: The drawable you're drawing in. If passed in
* this is used for client side window clip emulation.
*
* Set the attributes of a cairo context to match those of a #GdkGC
* as far as possible. Some aspects of a #GdkGC, such as clip masks
@ -1127,7 +1177,8 @@ _gdk_gc_update_context (GdkGC *gc,
cairo_t *cr,
const GdkColor *override_foreground,
GdkBitmap *override_stipple,
gboolean gc_changed)
gboolean gc_changed,
GdkDrawable *target_drawable)
{
GdkGCPrivate *priv;
GdkFill fill;
@ -1246,6 +1297,10 @@ _gdk_gc_update_context (GdkGC *gc,
cairo_clip (cr);
}
/* The reset above resets the window clip rect, so we want to re-set that */
if (target_drawable && GDK_DRAWABLE_GET_CLASS (target_drawable)->set_cairo_clip)
GDK_DRAWABLE_GET_CLASS (target_drawable)->set_cairo_clip (target_drawable, cr);
}

View File

@ -182,15 +182,21 @@ extern gchar *_gdk_display_arg_name;
void _gdk_events_queue (GdkDisplay *display);
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
GList* _gdk_event_queue_find_first (GdkDisplay *display);
void _gdk_event_queue_remove_link (GdkDisplay *display,
GList *node);
GList* _gdk_event_queue_prepend (GdkDisplay *display,
GdkEvent *event);
GList* _gdk_event_queue_append (GdkDisplay *display,
GdkEvent *event);
void _gdk_event_button_generate (GdkDisplay *display,
GdkEvent *event);
GList* _gdk_event_queue_find_first (GdkDisplay *display);
void _gdk_event_queue_remove_link (GdkDisplay *display,
GList *node);
GList* _gdk_event_queue_prepend (GdkDisplay *display,
GdkEvent *event);
GList* _gdk_event_queue_append (GdkDisplay *display,
GdkEvent *event);
GList* _gdk_event_queue_insert_after (GdkDisplay *display,
GdkEvent *after_event,
GdkEvent *event);
GList* _gdk_event_queue_insert_before(GdkDisplay *display,
GdkEvent *after_event,
GdkEvent *event);
void _gdk_event_button_generate (GdkDisplay *display,
GdkEvent *event);
void _gdk_windowing_event_data_copy (const GdkEvent *src,
GdkEvent *dst);
@ -227,6 +233,8 @@ GdkImage *_gdk_drawable_copy_to_image (GdkDrawable *drawable,
cairo_surface_t *_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable);
GdkDrawable *_gdk_drawable_get_source_drawable (GdkDrawable *drawable);
/* GC caching */
GdkGC *_gdk_drawable_get_scratch_gc (GdkDrawable *drawable,
gboolean graphics_exposures);
@ -235,20 +243,41 @@ void _gdk_gc_update_context (GdkGC *gc,
cairo_t *cr,
const GdkColor *override_foreground,
GdkBitmap *override_stipple,
gboolean gc_changed);
gboolean gc_changed,
GdkDrawable *target_drawable);
/*************************************
* Interfaces used by windowing code *
*************************************/
GdkWindow *_gdk_window_new (GdkWindow *window,
GdkWindowAttr *attributes,
gint attributes_mask);
void _gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy);
void _gdk_window_clear_update_area (GdkWindow *window);
GdkPixmap *_gdk_pixmap_new (GdkDrawable *drawable,
gint width,
gint height,
gint depth);
GdkPixmap *_gdk_pixmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height,
gint depth,
const GdkColor *fg,
const GdkColor *bg);
GdkPixmap *_gdk_bitmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height);
void _gdk_screen_close (GdkScreen *screen);
void _gdk_window_impl_new (GdkWindow *window,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask);
void _gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy);
void _gdk_window_clear_update_area (GdkWindow *window);
void _gdk_window_update_size (GdkWindow *window);
void _gdk_screen_close (GdkScreen *screen);
const char *_gdk_get_sm_client_id (void);
@ -263,6 +292,13 @@ GdkPixmap *_gdk_gc_get_tile (GdkGC *gc);
GdkBitmap *_gdk_gc_get_stipple (GdkGC *gc);
guint32 _gdk_gc_get_fg_pixel (GdkGC *gc);
guint32 _gdk_gc_get_bg_pixel (GdkGC *gc);
void _gdk_gc_intersect_clip_region (GdkGC *gc,
GdkRegion *region,
GdkRegion **old_region);
void _gdk_gc_set_clip_region_internal (GdkGC *gc,
GdkRegion *region,
gboolean reset_origin);
GdkSubwindowMode _gdk_gc_get_subwindow (GdkGC *gc);
/*****************************************
* Interfaces provided by windowing code *
@ -306,21 +342,14 @@ GdkWindow* _gdk_windowing_window_at_pointer (GdkDisplay *display,
gint _gdk_windowing_get_bits_for_depth (GdkDisplay *display,
gint depth);
void _gdk_window_reparent (GdkWindow *window,
GdkWindow *new_parent,
gint x,
gint y);
#define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
/* Called before processing updates for a window. This gives the windowing
* layer a chance to save the region for later use in avoiding duplicate
* exposes. The return value indicates whether the function has a saved
* the region; if the result is TRUE, then the windowing layer is responsible
* for destroying the region later.
*/
gboolean _gdk_windowing_window_queue_antiexpose (GdkWindow *window,
GdkRegion *area);
void _gdk_windowing_window_queue_translation (GdkWindow *window,
GdkRegion *area,
gint dx,
gint dy);
/* Called to do the windowing system specific part of gdk_window_destroy(),
*
@ -387,6 +416,7 @@ GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
* _gdk_windowing_gc_set_clip_region:
* @gc: a #GdkGC
* @region: the new clip region
* @reset_origin: if TRUE, reset the clip_x/y_origin values to 0
*
* Do any window-system specific processing necessary
* for a change in clip region. Since the clip origin
@ -398,7 +428,8 @@ GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
* will already return the new region.
**/
void _gdk_windowing_gc_set_clip_region (GdkGC *gc,
const GdkRegion *region);
const GdkRegion *region,
gboolean reset_origin);
/**
* _gdk_windowing_gc_copy:
@ -435,6 +466,78 @@ char *_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
void _gdk_windowing_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id);
void _gdk_windowing_grab_broken (GdkDisplay *display);
void _gdk_display_set_has_pointer_grab (GdkDisplay *display,
GdkWindow *window,
GdkWindow *native_window,
gboolean owner_events,
GdkEventMask event_mask,
unsigned long serial,
guint32 time,
gboolean implicit);
void _gdk_display_unset_has_pointer_grab (GdkDisplay *display,
gboolean implicit,
gboolean do_grab_one_pointer_release_event,
guint32 time);
void _gdk_window_invalidate_for_expose (GdkWindow *window,
const GdkRegion *region);
void _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
int width,
int height);
cairo_surface_t * _gdk_windowing_create_cairo_surface (GdkDrawable *drawable,
int width,
int height);
GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
double x, double y,
double *found_x,
double *found_y);
void _gdk_window_add_damage (GdkWindow *toplevel,
GdkRegion *damaged_region);
GdkEvent * _gdk_make_event (GdkWindow *window,
GdkEventType type,
GdkEvent *event_in_queue,
gboolean before_event);
void _gdk_syntesize_crossing_events (GdkDisplay *display,
GdkWindow *src,
GdkWindow *dest,
GdkCrossingMode mode,
gint toplevel_x,
gint toplevel_y,
GdkModifierType mask,
guint32 time_,
gboolean do_first,
gboolean do_last);
void _gdk_syntesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
GdkRegion *_gdk_window_calculate_full_clip_region (GdkWindow *window,
GdkWindow *base_window,
gboolean do_children,
gint *base_x_offset,
gint *base_y_offset);
gboolean _gdk_window_has_impl (GdkWindow *window);
GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
/*****************************
* offscreen window routines *
*****************************/
GType gdk_offscreen_window_get_type (void);
void _gdk_offscreen_window_new (GdkWindow *window,
GdkScreen *screen,
GdkVisual *visual,
GdkWindowAttr *attributes,
gint attributes_mask);
void _gdk_offscreen_window_destroy (GdkWindow *window,
gboolean recursing);
/************************************
* Initialization and exit routines *

1217
gdk/gdkoffscreenwindow.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -214,7 +214,8 @@ get_cairo_context (GdkPangoRenderer *gdk_renderer,
priv->cr,
color,
priv->stipple[part],
priv->gc_changed);
priv->gc_changed,
priv->drawable);
}
priv->last_part = part;

View File

@ -229,6 +229,48 @@ gdk_pixmap_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GdkPixmap *
gdk_pixmap_new (GdkDrawable *drawable,
gint width,
gint height,
gint depth)
{
GdkDrawable *source_drawable;
source_drawable = _gdk_drawable_get_source_drawable (drawable);
return _gdk_pixmap_new (source_drawable, width, height, depth);
}
GdkPixmap *
gdk_bitmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height)
{
GdkDrawable *source_drawable;
source_drawable = _gdk_drawable_get_source_drawable (drawable);
return _gdk_bitmap_create_from_data (source_drawable, data, width, height);
}
GdkPixmap*
gdk_pixmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height,
gint depth,
const GdkColor *fg,
const GdkColor *bg)
{
GdkDrawable *source_drawable;
source_drawable = _gdk_drawable_get_source_drawable (drawable);
return _gdk_pixmap_create_from_data (source_drawable,
data, width, height,
depth, fg,bg);
}
static GdkGC *
gdk_pixmap_create_gc (GdkDrawable *drawable,
GdkGCValues *values,

File diff suppressed because it is too large Load Diff

View File

@ -37,10 +37,12 @@
G_BEGIN_DECLS
typedef struct _GdkGeometry GdkGeometry;
typedef struct _GdkWindowAttr GdkWindowAttr;
typedef struct _GdkPointerHooks GdkPointerHooks;
typedef struct _GdkWindowRedirect GdkWindowRedirect;
typedef struct _GdkGeometry GdkGeometry;
typedef struct _GdkWindowAttr GdkWindowAttr;
typedef struct _GdkPointerHooks GdkPointerHooks;
typedef struct _GdkOffscreenChildHooks GdkOffscreenChildHooks;
typedef struct _GdkWindowRedirect GdkWindowRedirect;
typedef struct _GdkWindowPaint GdkWindowPaint;
/* Classes of windows.
* InputOutput: Almost every window should be of this type. Such windows
@ -77,7 +79,8 @@ typedef enum
GDK_WINDOW_CHILD,
GDK_WINDOW_DIALOG,
GDK_WINDOW_TEMP,
GDK_WINDOW_FOREIGN
GDK_WINDOW_FOREIGN,
GDK_WINDOW_OFFSCREEN
} GdkWindowType;
/* Window attribute mask values.
@ -248,6 +251,20 @@ struct _GdkPointerHooks
gint *win_y);
};
struct _GdkOffscreenChildHooks
{
void (*from_parent) (GdkWindow *offscreen_child,
gdouble parent_x,
gdouble parent_y,
gdouble *child_x,
gdouble *child_y);
void (*to_parent) (GdkWindow *offscreen_child,
gdouble child_x,
gdouble child_y,
gdouble *parent_x,
gdouble *parent_y);
};
typedef struct _GdkWindowObject GdkWindowObject;
typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
@ -307,6 +324,19 @@ struct _GdkWindowObject
guint update_and_descendants_freeze_count;
GdkWindowRedirect *redirect;
const GdkOffscreenChildHooks *offscreen_hooks;
int abs_x, abs_y; /* Absolute offset in impl */
gint width, height;
GdkRegion *clip_region; /* Clip region (wrt toplevel) in window coords */
GdkRegion *clip_region_with_children; /* Clip region in window coords */
GdkColormap *colormap;
GdkCursor *cursor;
gint8 toplevel_window_type;
GdkWindowPaint *implicit_paint;
cairo_surface_t *cairo_surface;
};
struct _GdkWindowObjectClass
@ -645,12 +675,21 @@ GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
GdkWindow *gdk_get_default_root_window (void);
void gdk_window_redirect_to_drawable (GdkWindow *window,
GdkDrawable *drawable,
gint src_x, gint src_y,
gint dest_x, gint dest_y,
gint width, gint height);
void gdk_window_remove_redirection (GdkWindow *window);
/* Offscreen redirection */
GdkPixmap *gdk_window_get_offscreen_pixmap (GdkWindow *window);
void gdk_window_redirect_to_drawable (GdkWindow *window,
GdkDrawable *drawable,
gint src_x,
gint src_y,
gint dest_x,
gint dest_y,
gint width,
gint height);
void gdk_window_remove_redirection (GdkWindow *window);
void gdk_window_set_offscreen_hooks (GdkWindow *offscreen_window,
const GdkOffscreenChildHooks *hooks);
#ifndef GDK_DISABLE_DEPRECATED
#define GDK_ROOT_PARENT() (gdk_get_default_root_window ())

View File

@ -56,14 +56,6 @@ struct _GdkWindowImplIface
gint y,
gint width,
gint height);
void (* move_region) (GdkWindow *window,
const GdkRegion *region,
gint dx,
gint dy);
void (* scroll) (GdkWindow *window,
gint dx,
gint dy);
void (* clear_area) (GdkWindow *window,
gint x,
gint y,
@ -73,8 +65,7 @@ struct _GdkWindowImplIface
void (* set_background) (GdkWindow *window,
const GdkColor *color);
void (* set_back_pixmap) (GdkWindow *window,
GdkPixmap *pixmap,
gboolean parent_relative);
GdkPixmap *pixmap);
GdkEventMask (* get_events) (GdkWindow *window);
void (* set_events) (GdkWindow *window,
@ -97,9 +88,6 @@ struct _GdkWindowImplIface
gint (* get_origin) (GdkWindow *window,
gint *x,
gint *y);
void (* get_offsets) (GdkWindow *window,
gint *x_offset,
gint *y_offset);
void (* shape_combine_mask) (GdkWindow *window,
GdkBitmap *mask,
@ -114,11 +102,38 @@ struct _GdkWindowImplIface
gboolean (* set_static_gravities) (GdkWindow *window,
gboolean use_static);
/* Called before processing updates for a window. This gives the windowing
* layer a chance to save the region for later use in avoiding duplicate
* exposes. The return value indicates whether the function has a saved
* the region; if the result is TRUE, then the windowing layer is responsible
* for destroying the region later.
*/
gboolean (* queue_antiexpose) (GdkWindow *window,
GdkRegion *update_area);
};
/* Interface Functions */
GType gdk_window_impl_get_type (void) G_GNUC_CONST;
/* private definitions from gdkwindow.h */
struct _GdkWindowRedirect
{
GdkWindowObject *redirected;
GdkDrawable *pixmap;
gint src_x;
gint src_y;
gint dest_x;
gint dest_y;
gint width;
gint height;
GdkRegion *damage;
guint damage_idle;
};
G_END_DECLS
#endif /* __GDK_WINDOW_IMPL_H__ */

View File

@ -137,10 +137,10 @@ data_provider_release (void *info, const void *data, size_t size)
}
GdkPixmap*
gdk_pixmap_new (GdkDrawable *drawable,
gint width,
gint height,
gint depth)
_gdk_pixmap_new (GdkDrawable *drawable,
gint width,
gint height,
gint depth)
{
GdkPixmap *pixmap;
GdkDrawableImplQuartz *draw_impl;
@ -224,10 +224,10 @@ gdk_pixmap_new (GdkDrawable *drawable,
}
GdkPixmap *
gdk_bitmap_create_from_data (GdkDrawable *window,
const gchar *data,
gint width,
gint height)
_gdk_bitmap_create_from_data (GdkDrawable *window,
const gchar *data,
gint width,
gint height)
{
GdkPixmap *pixmap;
GdkPixmapImplQuartz *impl;
@ -264,13 +264,13 @@ gdk_bitmap_create_from_data (GdkDrawable *window,
}
GdkPixmap*
gdk_pixmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height,
gint depth,
const GdkColor *fg,
const GdkColor *bg)
_gdk_pixmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height,
gint depth,
const GdkColor *fg,
const GdkColor *bg)
{
/* FIXME: Implement */
return NULL;

View File

@ -600,7 +600,7 @@ _gdk_x11_display_is_root_window (GdkDisplay *display,
*/
void
gdk_display_pointer_ungrab (GdkDisplay *display,
guint32 time)
guint32 time_)
{
Display *xdisplay;
GdkDisplayX11 *display_x11;
@ -610,33 +610,19 @@ gdk_display_pointer_ungrab (GdkDisplay *display,
display_x11 = GDK_DISPLAY_X11 (display);
xdisplay = GDK_DISPLAY_XDISPLAY (display);
_gdk_input_ungrab_pointer (display, time);
XUngrabPointer (xdisplay, time);
_gdk_input_ungrab_pointer (display, time_);
XUngrabPointer (xdisplay, time_);
XFlush (xdisplay);
if (time == GDK_CURRENT_TIME ||
display_x11->pointer_xgrab_time == GDK_CURRENT_TIME ||
!XSERVER_TIME_IS_LATER (display_x11->pointer_xgrab_time, time))
display_x11->pointer_xgrab_window = NULL;
}
/**
* gdk_display_pointer_is_grabbed:
* @display: a #GdkDisplay
*
* Test if the pointer is grabbed.
*
* Returns: %TRUE if an active X pointer grab is in effect
*
* Since: 2.2
*/
gboolean
gdk_display_pointer_is_grabbed (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
return (GDK_DISPLAY_X11 (display)->pointer_xgrab_window != NULL &&
!GDK_DISPLAY_X11 (display)->pointer_xgrab_implicit);
if (time_ == GDK_CURRENT_TIME ||
display->pointer_grab.time == GDK_CURRENT_TIME ||
!XSERVER_TIME_IS_LATER (display->pointer_grab.time, time_))
{
_gdk_display_unset_has_pointer_grab (display,
FALSE,
FALSE,
time_);
}
}
/**
@ -1335,7 +1321,9 @@ gdk_display_store_clipboard (GdkDisplay *display,
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
Atom clipboard_manager, save_targets;
g_return_if_fail (GDK_WINDOW_IS_X11 (clipboard_window));
clipboard_manager = gdk_x11_get_xatom_by_name_for_display (display, "CLIPBOARD_MANAGER");
save_targets = gdk_x11_get_xatom_by_name_for_display (display, "SAVE_TARGETS");

View File

@ -30,6 +30,7 @@
#include <gdk/gdkdisplay.h>
#include <gdk/gdkkeys.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdkinternals.h>
#include <gdk/gdk.h> /* For gdk_get_program_class() */
G_BEGIN_DECLS
@ -93,17 +94,14 @@ struct _GdkDisplayX11
* (grabs, properties etc.) Otherwise always TRUE. */
gboolean trusted_client;
/* Information about current pointer and keyboard grabs held by this
* client. If gdk_pointer_xgrab_window or gdk_keyboard_xgrab_window
/* Information about current keyboard grabs held by this
* client. If gdk_keyboard_xgrab_window
* window is NULL, then the other associated fields are ignored
* Pointer grab info is stored in GdkDisplay.
*/
GdkWindowObject *pointer_xgrab_window;
gulong pointer_xgrab_serial;
gboolean pointer_xgrab_owner_events;
gboolean pointer_xgrab_implicit;
guint32 pointer_xgrab_time;
GdkWindowObject *keyboard_xgrab_window;
GdkWindowObject *keyboard_xgrab_native_window;
gulong keyboard_xgrab_serial;
gboolean keyboard_xgrab_owner_events;
guint32 keyboard_xgrab_time;
@ -169,6 +167,9 @@ struct _GdkDisplayX11
/* Alpha mask picture format */
XRenderPictFormat *mask_format;
/* The offscreen window that has the pointer in it (if any) */
GdkWindow *active_offscreen_window;
};
struct _GdkDisplayX11Class

View File

@ -2987,6 +2987,7 @@ gdk_drag_begin (GdkWindow *window,
GdkDragContext *new_context;
g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_WINDOW_IS_X11 (window), NULL);
new_context = gdk_drag_context_new ();
new_context->is_source = TRUE;
@ -3192,7 +3193,7 @@ gdk_drag_find_window_for_screen (GdkDragContext *context,
window_cache = drag_context_find_window_cache (context, screen);
dest = get_client_window_at_coords (window_cache,
drag_window ?
drag_window && GDK_WINDOW_IS_X11 (drag_window) ?
GDK_DRAWABLE_XID (drag_window) : None,
x_root, y_root);
@ -3262,6 +3263,7 @@ gdk_drag_motion (GdkDragContext *context,
GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
g_return_val_if_fail (context != NULL, FALSE);
g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_X11 (dest_window), FALSE);
private->old_actions = context->actions;
context->actions = possible_actions;

View File

@ -870,7 +870,17 @@ gdk_x11_drawable_get_xid (GdkDrawable *drawable)
GdkDrawable *impl;
if (GDK_IS_WINDOW (drawable))
impl = ((GdkPixmapObject *)drawable)->impl;
{
if (!GDK_WINDOW_IS_X11 (drawable))
{
/* TODO: At this point we could convert a virtual window
to a native one (unless its in an offscreen window) */
g_warning (G_STRLOC " drawable is not a native X11 window");
return None;
}
impl = ((GdkPixmapObject *)drawable)->impl;
}
else if (GDK_IS_PIXMAP (drawable))
impl = ((GdkPixmapObject *)drawable)->impl;
else
@ -1447,6 +1457,45 @@ gdk_x11_cairo_surface_destroy (void *data)
impl->cairo_surface = NULL;
}
void
_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
int width,
int height)
{
cairo_xlib_surface_set_size (surface, width, height);
}
cairo_surface_t *
_gdk_windowing_create_cairo_surface (GdkDrawable *drawable,
int width,
int height)
{
GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
GdkVisual *visual;
visual = gdk_drawable_get_visual (drawable);
if (visual)
return cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (impl->screen),
impl->xid,
GDK_VISUAL_XVISUAL (visual),
width, height);
else if (gdk_drawable_get_depth (drawable) == 1)
return cairo_xlib_surface_create_for_bitmap (GDK_SCREEN_XDISPLAY (impl->screen),
impl->xid,
GDK_SCREEN_XSCREEN (impl->screen),
width, height);
else
{
g_warning ("Using Cairo rendering requires the drawable argument to\n"
"have a specified colormap. All windows have a colormap,\n"
"however, pixmaps only have colormap by default if they\n"
"were created with a non-NULL window argument. Otherwise\n"
"a colormap must be set on them with gdk_drawable_set_colormap");
return NULL;
}
}
static cairo_surface_t *
gdk_x11_ref_cairo_surface (GdkDrawable *drawable)
{
@ -1458,35 +1507,15 @@ 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 (GDK_SCREEN_XDISPLAY (impl->screen),
impl->xid,
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,
GDK_SCREEN_XSCREEN (impl->screen),
width, height);
else
{
g_warning ("Using Cairo rendering requires the drawable argument to\n"
"have a specified colormap. All windows have a colormap,\n"
"however, pixmaps only have colormap by default if they\n"
"were created with a non-NULL window argument. Otherwise\n"
"a colormap must be set on them with gdk_drawable_set_colormap");
return NULL;
}
cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key,
drawable, gdk_x11_cairo_surface_destroy);
impl->cairo_surface = _gdk_windowing_create_cairo_surface (drawable, width, height);
if (impl->cairo_surface)
cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key,
drawable, gdk_x11_cairo_surface_destroy);
}
else
cairo_surface_reference (impl->cairo_surface);

View File

@ -313,7 +313,7 @@ gdk_event_get_graphics_expose (GdkWindow *window)
GdkEvent *event;
g_return_val_if_fail (window != NULL, NULL);
XIfEvent (GDK_WINDOW_XDISPLAY (window), &xevent,
graphics_expose_predicate, (XPointer) window);
@ -879,7 +879,6 @@ gdk_event_translate (GdkDisplay *display,
GdkWindow *filter_window;
GdkWindowImplX11 *window_impl = NULL;
gboolean return_val;
gint xoffset, yoffset;
GdkScreen *screen = NULL;
GdkScreenX11 *screen_x11 = NULL;
GdkToplevelX11 *toplevel = NULL;
@ -942,6 +941,14 @@ gdk_event_translate (GdkDisplay *display,
if (window != NULL)
{
/* Rewrite keyboard grabs to offscreen windows */
if ((xevent->type == KeyPress || xevent->type == KeyRelease) &&
window_private == display_x11->keyboard_xgrab_native_window)
{
window_private = display_x11->keyboard_xgrab_window;
window = (GdkWindow *) window_private;
}
window_impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
/* Move key events on focus window to the real toplevel, and
@ -1041,16 +1048,6 @@ gdk_event_translate (GdkDisplay *display,
return_val = TRUE;
if (window)
{
_gdk_x11_window_get_offsets (window, &xoffset, &yoffset);
}
else
{
xoffset = 0;
yoffset = 0;
}
switch (xevent->type)
{
case KeyPress:
@ -1129,8 +1126,8 @@ gdk_event_translate (GdkDisplay *display,
event->scroll.window = window;
event->scroll.time = xevent->xbutton.time;
event->scroll.x = xevent->xbutton.x + xoffset;
event->scroll.y = xevent->xbutton.y + yoffset;
event->scroll.x = xevent->xbutton.x;
event->scroll.y = xevent->xbutton.y;
event->scroll.x_root = (gfloat)xevent->xbutton.x_root;
event->scroll.y_root = (gfloat)xevent->xbutton.y_root;
event->scroll.state = (GdkModifierType) xevent->xbutton.state;
@ -1148,8 +1145,8 @@ gdk_event_translate (GdkDisplay *display,
event->button.type = GDK_BUTTON_PRESS;
event->button.window = window;
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x + xoffset;
event->button.y = xevent->xbutton.y + yoffset;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.axes = NULL;
@ -1162,8 +1159,6 @@ gdk_event_translate (GdkDisplay *display,
return_val = FALSE;
break;
}
_gdk_event_button_generate (display, event);
break;
}
@ -1192,14 +1187,14 @@ gdk_event_translate (GdkDisplay *display,
xevent->xbutton.button == 6 || xevent->xbutton.button ==7)
{
return_val = FALSE;
break;
goto release_out;
}
event->button.type = GDK_BUTTON_RELEASE;
event->button.window = window;
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x + xoffset;
event->button.y = xevent->xbutton.y + yoffset;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.axes = NULL;
@ -1210,9 +1205,10 @@ gdk_event_translate (GdkDisplay *display,
if (!set_screen_from_root (display, event, xevent->xbutton.root))
{
return_val = FALSE;
break;
goto release_out;
}
release_out:
_gdk_xgrab_check_button_event (window, xevent);
break;
@ -1234,8 +1230,8 @@ gdk_event_translate (GdkDisplay *display,
event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x + xoffset;
event->motion.y = xevent->xmotion.y + yoffset;
event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y;
event->motion.x_root = (gfloat)xevent->xmotion.x_root;
event->motion.y_root = (gfloat)xevent->xmotion.y_root;
event->motion.axes = NULL;
@ -1304,8 +1300,8 @@ gdk_event_translate (GdkDisplay *display,
event->crossing.subwindow = NULL;
event->crossing.time = xevent->xcrossing.time;
event->crossing.x = xevent->xcrossing.x + xoffset;
event->crossing.y = xevent->xcrossing.y + yoffset;
event->crossing.x = xevent->xcrossing.x;
event->crossing.y = xevent->xcrossing.y;
event->crossing.x_root = xevent->xcrossing.x_root;
event->crossing.y_root = xevent->xcrossing.y_root;
@ -1399,8 +1395,8 @@ gdk_event_translate (GdkDisplay *display,
event->crossing.subwindow = NULL;
event->crossing.time = xevent->xcrossing.time;
event->crossing.x = xevent->xcrossing.x + xoffset;
event->crossing.y = xevent->xcrossing.y + yoffset;
event->crossing.x = xevent->xcrossing.x;
event->crossing.y = xevent->xcrossing.y;
event->crossing.x_root = xevent->xcrossing.x_root;
event->crossing.y_root = xevent->xcrossing.y_root;
@ -1596,8 +1592,8 @@ gdk_event_translate (GdkDisplay *display,
{
GdkRectangle expose_rect;
expose_rect.x = xevent->xexpose.x + xoffset;
expose_rect.y = xevent->xexpose.y + yoffset;
expose_rect.x = xevent->xexpose.x;
expose_rect.y = xevent->xexpose.y;
expose_rect.width = xevent->xexpose.width;
expose_rect.height = xevent->xexpose.height;
@ -1636,8 +1632,8 @@ gdk_event_translate (GdkDisplay *display,
break;
}
expose_rect.x = xevent->xgraphicsexpose.x + xoffset;
expose_rect.y = xevent->xgraphicsexpose.y + yoffset;
expose_rect.x = xevent->xgraphicsexpose.x;
expose_rect.y = xevent->xgraphicsexpose.y;
expose_rect.width = xevent->xgraphicsexpose.width;
expose_rect.height = xevent->xgraphicsexpose.height;
@ -1826,9 +1822,9 @@ gdk_event_translate (GdkDisplay *display,
: ""));
if (window && GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT)
{
window_impl->width = xevent->xconfigure.width;
window_impl->height = xevent->xconfigure.height;
window_private->width = xevent->xconfigure.width;
window_private->height = xevent->xconfigure.height;
_gdk_x11_drawable_update_size (window_private->impl);
_gdk_x11_screen_size_changed (screen, xevent);
}
@ -1887,9 +1883,10 @@ gdk_event_translate (GdkDisplay *display,
}
window_private->x = event->configure.x;
window_private->y = event->configure.y;
window_impl->width = xevent->xconfigure.width;
window_impl->height = xevent->xconfigure.height;
window_private->width = xevent->xconfigure.width;
window_private->height = xevent->xconfigure.height;
_gdk_window_update_size (window);
_gdk_x11_drawable_update_size (window_private->impl);
if (window_private->resize_count >= 1)
@ -2298,6 +2295,7 @@ _gdk_events_queue (GdkDisplay *display)
if (gdk_event_translate (display, event, &xevent, FALSE))
{
((GdkEventPrivate *)event)->flags &= ~GDK_EVENT_PENDING;
_gdk_windowing_got_event (display, node, event);
}
else
{

View File

@ -608,7 +608,8 @@ gdk_x11_gc_values_to_xvalues (GdkGCValues *values,
void
_gdk_windowing_gc_set_clip_region (GdkGC *gc,
const GdkRegion *region)
const GdkRegion *region,
gboolean reset_origin)
{
GdkGCX11 *x11_gc = GDK_GC_X11 (gc);
@ -623,8 +624,11 @@ _gdk_windowing_gc_set_clip_region (GdkGC *gc,
x11_gc->have_clip_region = region != NULL;
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
if (reset_origin)
{
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
}
x11_gc->dirty_mask |= GDK_GC_DIRTY_CLIP;
}

View File

@ -165,170 +165,13 @@ struct _GdkWindowQueueItem
} u;
};
struct _GdkWindowParentPos
{
gint x;
gint y;
gint x11_x;
gint x11_y;
GdkRectangle clip_rect;
};
static void gdk_window_compute_position (GdkWindowImplX11 *window,
GdkWindowParentPos *parent_pos,
GdkXPositionInfo *info);
static void gdk_window_compute_parent_pos (GdkWindowImplX11 *window,
GdkWindowParentPos *parent_pos);
static void gdk_window_premove (GdkWindow *window,
GdkWindowParentPos *parent_pos);
static void gdk_window_postmove (GdkWindow *window,
GdkWindowParentPos *parent_pos);
static void gdk_window_queue_translation (GdkWindow *window,
GdkRegion *area,
gint dx,
gint dy);
static void gdk_window_clip_changed (GdkWindow *window,
GdkRectangle *old_clip,
GdkRectangle *new_clip);
void
_gdk_x11_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset)
{
GdkWindowImplX11 *impl =
GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
*x_offset = impl->position_info.x_offset;
*y_offset = impl->position_info.y_offset;
}
void
_gdk_window_init_position (GdkWindow *window)
{
GdkWindowParentPos parent_pos;
GdkWindowImplX11 *impl;
g_return_if_fail (GDK_IS_WINDOW (window));
impl =
GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
gdk_window_compute_parent_pos (impl, &parent_pos);
gdk_window_compute_position (impl, &parent_pos, &impl->position_info);
}
static void
gdk_window_copy_area_scroll (GdkWindow *window,
GdkRectangle *dest_rect,
gint dx,
gint dy)
{
GdkWindowObject *obj = GDK_WINDOW_OBJECT (window);
GList *l;
if (dest_rect->width > 0 && dest_rect->height > 0)
{
GdkGC *gc;
gc = _gdk_drawable_get_scratch_gc (window, TRUE);
gdk_window_queue_translation (window, NULL, dx, dy);
XCopyArea (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XID (window),
gdk_x11_gc_get_xgc (gc),
dest_rect->x - dx, dest_rect->y - dy,
dest_rect->width, dest_rect->height,
dest_rect->x, dest_rect->y);
}
for (l = obj->children; l; l = l->next)
{
GdkWindow *child = (GdkWindow*) l->data;
GdkWindowObject *child_obj = GDK_WINDOW_OBJECT (child);
gdk_window_move (child, child_obj->x + dx, child_obj->y + dy);
}
}
static void
compute_intermediate_position (GdkXPositionInfo *position_info,
GdkXPositionInfo *new_info,
gint d_xoffset,
gint d_yoffset,
GdkRectangle *new_position)
{
gint new_x0, new_x1, new_y0, new_y1;
/* Wrap d_xoffset, d_yoffset into [-32768,32767] range. For the
* purposes of subwindow movement, it doesn't matter if we are
* off by a factor of 65536, and if we don't do this range
* reduction, we'll end up with invalid widths.
*/
d_xoffset = (gint16)d_xoffset;
d_yoffset = (gint16)d_yoffset;
if (d_xoffset < 0)
{
new_x0 = position_info->x + d_xoffset;
new_x1 = position_info->x + position_info->width;
}
else
{
new_x0 = position_info->x;
new_x1 = position_info->x + new_info->width + d_xoffset;
}
new_position->x = new_x0;
new_position->width = new_x1 - new_x0;
if (d_yoffset < 0)
{
new_y0 = position_info->y + d_yoffset;
new_y1 = position_info->y + position_info->height;
}
else
{
new_y0 = position_info->y;
new_y1 = position_info->y + new_info->height + d_yoffset;
}
new_position->y = new_y0;
new_position->height = new_y1 - new_y0;
}
static void
translate_pos (GdkWindowParentPos *dest, GdkWindowParentPos *src,
GdkWindowObject *obj, GdkXPositionInfo *pos_info,
gboolean set_clip)
{
dest->x = src->x + obj->x;
dest->y = src->y + obj->y;
dest->x11_x = src->x11_x + pos_info->x;
dest->x11_y = src->x11_y + pos_info->y;
if (set_clip)
dest->clip_rect = pos_info->clip_rect;
}
static void
move (GdkWindow *window, GdkXPositionInfo *pos)
move (GdkWindow *window, GdkRectangle *pos)
{
XMoveWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window), pos->x, pos->y);
}
static void
move_relative (GdkWindow *window, GdkRectangle *rect,
gint dx, gint dy)
{
XMoveWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
rect->x + dx, rect->y + dy);
}
static void
move_resize (GdkWindow *window, GdkRectangle *pos)
{
@ -337,245 +180,6 @@ move_resize (GdkWindow *window, GdkRectangle *pos)
pos->x, pos->y, pos->width, pos->height);
}
static void
gdk_window_guffaw_scroll (GdkWindow *window,
gint dx,
gint dy)
{
GdkWindowObject *obj = GDK_WINDOW_OBJECT (window);
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (obj->impl);
gint d_xoffset = -dx;
gint d_yoffset = -dy;
GdkRectangle new_position;
GdkXPositionInfo new_info;
GdkWindowParentPos parent_pos;
GList *l;
gdk_window_compute_parent_pos (impl, &parent_pos);
gdk_window_compute_position (impl, &parent_pos, &new_info);
translate_pos (&parent_pos, &parent_pos, obj, &new_info, TRUE);
_gdk_x11_window_tmp_unset_bg (window, FALSE);;
if (dx > 0 || dy > 0)
gdk_window_queue_translation (window, NULL, MAX (dx, 0), MAX (dy, 0));
gdk_window_set_static_gravities (window, TRUE);
compute_intermediate_position (&impl->position_info, &new_info, d_xoffset, d_yoffset,
&new_position);
move_resize (window, &new_position);
for (l = obj->children; l; l = l->next)
{
GdkWindow *child = (GdkWindow*) l->data;
GdkWindowObject *child_obj = GDK_WINDOW_OBJECT (child);
child_obj->x -= d_xoffset;
child_obj->y -= d_yoffset;
gdk_window_premove (child, &parent_pos);
}
move_relative (window, &new_position, -d_xoffset, -d_yoffset);
if (dx < 0 || dy < 0)
gdk_window_queue_translation (window, NULL, MIN (dx, 0), MIN (dy, 0));
move_resize (window, (GdkRectangle *) &impl->position_info);
if (impl->position_info.no_bg)
_gdk_x11_window_tmp_reset_bg (window, FALSE);
impl->position_info = new_info;
g_list_foreach (obj->children, (GFunc) gdk_window_postmove, &parent_pos);
}
void
_gdk_x11_window_scroll (GdkWindow *window,
gint dx,
gint dy)
{
gboolean can_guffaw_scroll = FALSE;
GdkRegion *invalidate_region;
GdkWindowImplX11 *impl;
GdkWindowObject *obj;
GdkRectangle src_rect, dest_rect;
obj = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
/* Move the current invalid region */
if (obj->update_area)
gdk_region_offset (obj->update_area, dx, dy);
/* impl->position_info.clip_rect isn't meaningful for toplevels */
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
src_rect = impl->position_info.clip_rect;
else
{
src_rect.x = 0;
src_rect.y = 0;
src_rect.width = impl->width;
src_rect.height = impl->height;
}
invalidate_region = gdk_region_rectangle (&src_rect);
dest_rect = src_rect;
dest_rect.x += dx;
dest_rect.y += dy;
gdk_rectangle_intersect (&dest_rect, &src_rect, &dest_rect);
if (dest_rect.width > 0 && dest_rect.height > 0)
{
GdkRegion *tmp_region;
tmp_region = gdk_region_rectangle (&dest_rect);
gdk_region_subtract (invalidate_region, tmp_region);
gdk_region_destroy (tmp_region);
}
gdk_window_invalidate_region (window, invalidate_region, TRUE);
gdk_region_destroy (invalidate_region);
/* We can guffaw scroll if we are a child window, and the parent
* does not extend beyond our edges. Otherwise, we use XCopyArea, then
* move any children later
*/
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
{
GdkWindowImplX11 *parent_impl = GDK_WINDOW_IMPL_X11 (obj->parent->impl);
can_guffaw_scroll = ((dx == 0 || (obj->x <= 0 && obj->x + impl->width >= parent_impl->width)) &&
(dy == 0 || (obj->y <= 0 && obj->y + impl->height >= parent_impl->height)));
}
if (!obj->children || !can_guffaw_scroll)
gdk_window_copy_area_scroll (window, &dest_rect, dx, dy);
else
gdk_window_guffaw_scroll (window, dx, dy);
}
void
_gdk_x11_window_move_region (GdkWindow *window,
const GdkRegion *region,
gint dx,
gint dy)
{
GdkWindowImplX11 *impl;
GdkWindowObject *private;
GdkRegion *window_clip;
GdkRegion *src_region;
GdkRegion *brought_in;
GdkRegion *dest_region;
GdkRegion *moving_invalid_region;
GdkRectangle dest_extents;
GdkGC *gc;
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_X11 (private->impl);
window_clip = gdk_region_rectangle (&impl->position_info.clip_rect);
/* compute source regions */
src_region = gdk_region_copy (region);
brought_in = gdk_region_copy (region);
gdk_region_intersect (src_region, window_clip);
gdk_region_subtract (brought_in, src_region);
gdk_region_offset (brought_in, dx, dy);
/* compute destination regions */
dest_region = gdk_region_copy (src_region);
gdk_region_offset (dest_region, dx, dy);
gdk_region_intersect (dest_region, window_clip);
gdk_region_get_clipbox (dest_region, &dest_extents);
gdk_region_destroy (window_clip);
/* calculating moving part of current invalid area */
moving_invalid_region = NULL;
if (private->update_area)
{
moving_invalid_region = gdk_region_copy (private->update_area);
gdk_region_intersect (moving_invalid_region, src_region);
gdk_region_offset (moving_invalid_region, dx, dy);
}
/* invalidate all of the src region */
gdk_window_invalidate_region (window, src_region, FALSE);
/* un-invalidate destination region */
if (private->update_area)
gdk_region_subtract (private->update_area, dest_region);
/* invalidate moving parts of existing update area */
if (moving_invalid_region)
{
gdk_window_invalidate_region (window, moving_invalid_region, FALSE);
gdk_region_destroy (moving_invalid_region);
}
/* invalidate area brought in from off-screen */
gdk_window_invalidate_region (window, brought_in, FALSE);
gdk_region_destroy (brought_in);
/* Actually do the moving */
gdk_window_queue_translation (window, src_region, dx, dy);
gc = _gdk_drawable_get_scratch_gc (window, TRUE);
gdk_gc_set_clip_region (gc, dest_region);
XCopyArea (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XID (window),
GDK_GC_XGC (gc),
dest_extents.x - dx, dest_extents.y - dy,
dest_extents.width, dest_extents.height,
dest_extents.x, dest_extents.y);
/* Unset clip region of cached GC */
gdk_gc_set_clip_region (gc, NULL);
gdk_region_destroy (src_region);
gdk_region_destroy (dest_region);
}
static void
reset_backgrounds (GdkWindow *window)
{
GdkWindowObject *obj = (GdkWindowObject *)window;
_gdk_x11_window_tmp_reset_bg (window, FALSE);
if (obj->parent)
_gdk_x11_window_tmp_reset_bg ((GdkWindow *)obj->parent, FALSE);
}
static void
map_if_needed (GdkWindow *window, GdkXPositionInfo *pos_info)
{
GdkWindowObject *obj = (GdkWindowObject *) window;
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (obj->impl);
if (!impl->position_info.mapped && pos_info->mapped && GDK_WINDOW_IS_MAPPED (obj))
XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
}
static void
unmap_if_needed (GdkWindow *window, GdkXPositionInfo *pos_info)
{
GdkWindowObject *obj = (GdkWindowObject *) window;
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (obj->impl);
if (impl->position_info.mapped && !pos_info->mapped)
XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
}
void
_gdk_window_move_resize_child (GdkWindow *window,
gint x,
@ -585,16 +189,12 @@ _gdk_window_move_resize_child (GdkWindow *window,
{
GdkWindowImplX11 *impl;
GdkWindowObject *obj;
GdkXPositionInfo new_info;
GdkWindowParentPos parent_pos;
GdkRectangle new_info;
gint d_xoffset, d_yoffset;
gint dx, dy;
gboolean is_move;
gboolean is_resize;
GdkRectangle old_pos;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@ -605,321 +205,27 @@ _gdk_window_move_resize_child (GdkWindow *window,
dy = y - obj->y;
is_move = dx != 0 || dy != 0;
is_resize = impl->width != width || impl->height != height;
is_resize = obj->width != width || obj->height != height;
#if 0 /* Not right, doesn't take abs_x/y into consideration */
if (!is_move && !is_resize)
return;
#endif
old_pos.x = obj->x;
old_pos.y = obj->y;
old_pos.width = impl->width;
old_pos.height = impl->height;
obj->x = x;
obj->y = y;
impl->width = width;
impl->height = height;
obj->width = width;
obj->height = height;
gdk_window_compute_parent_pos (impl, &parent_pos);
gdk_window_compute_position (impl, &parent_pos, &new_info);
gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
translate_pos (&parent_pos, &parent_pos, obj, &new_info, TRUE);
d_xoffset = new_info.x_offset - impl->position_info.x_offset;
d_yoffset = new_info.y_offset - impl->position_info.y_offset;
new_info.x = obj->x + obj->parent->abs_x;
new_info.y = obj->y + obj->parent->abs_y;
new_info.width = obj->width;
new_info.height = obj->height;
if (d_xoffset != 0 || d_yoffset != 0)
{
GdkRectangle new_position;
gdk_window_set_static_gravities (window, TRUE);
if (d_xoffset < 0 || d_yoffset < 0)
gdk_window_queue_translation (window, NULL, MIN (d_xoffset, 0), MIN (d_yoffset, 0));
compute_intermediate_position (&impl->position_info, &new_info, d_xoffset, d_yoffset,
&new_position);
move_resize (window, &new_position);
g_list_foreach (obj->children, (GFunc) gdk_window_premove, &parent_pos);
move_relative (window, &new_position, dx, dy);
if (d_xoffset > 0 || d_yoffset > 0)
gdk_window_queue_translation (window, NULL, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
move_resize (window, (GdkRectangle *) &new_info);
reset_backgrounds (window);
map_if_needed (window, &new_info);
impl->position_info = new_info;
g_list_foreach (obj->children, (GFunc) gdk_window_postmove, &parent_pos);
}
if (is_resize)
move_resize (window, &new_info);
else
{
if (is_move && is_resize)
gdk_window_set_static_gravities (window, FALSE);
unmap_if_needed (window, &new_info);
g_list_foreach (obj->children, (GFunc) gdk_window_premove, &parent_pos);
if (is_resize)
move_resize (window, (GdkRectangle *) &new_info);
else
move (window, &new_info);
g_list_foreach (obj->children, (GFunc) gdk_window_postmove, &parent_pos);
reset_backgrounds (window);
map_if_needed (window, &new_info);
impl->position_info = new_info;
}
if (GDK_WINDOW_IS_MAPPED (obj) && obj->parent && !obj->input_only)
gdk_window_invalidate_rect ((GdkWindow *)obj->parent, &old_pos, FALSE);
}
static void
gdk_window_compute_position (GdkWindowImplX11 *window,
GdkWindowParentPos *parent_pos,
GdkXPositionInfo *info)
{
GdkWindowObject *wrapper;
int parent_x_offset;
int parent_y_offset;
g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (window));
wrapper = GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_X11 (window)->wrapper);
info->big = FALSE;
if (window->width <= 32767)
{
info->width = window->width;
info->x = parent_pos->x + wrapper->x - parent_pos->x11_x;
}
else
{
info->big = TRUE;
info->width = 32767;
if (parent_pos->x + wrapper->x < -16384)
{
if (parent_pos->x + wrapper->x + window->width < 16384)
info->x = parent_pos->x + wrapper->x + window->width - info->width - parent_pos->x11_x;
else
info->x = -16384 - parent_pos->x11_x;
}
else
info->x = parent_pos->x + wrapper->x - parent_pos->x11_x;
}
if (window->height <= 32767)
{
info->height = window->height;
info->y = parent_pos->y + wrapper->y - parent_pos->x11_y;
}
else
{
info->big = TRUE;
info->height = 32767;
if (parent_pos->y + wrapper->y < -16384)
{
if (parent_pos->y + wrapper->y + window->height < 16384)
info->y = parent_pos->y + wrapper->y + window->height - info->height - parent_pos->x11_y;
else
info->y = -16384 - parent_pos->x11_y;
}
else
info->y = parent_pos->y + wrapper->y - parent_pos->x11_y;
}
parent_x_offset = parent_pos->x11_x - parent_pos->x;
parent_y_offset = parent_pos->x11_y - parent_pos->y;
info->x_offset = parent_x_offset + info->x - wrapper->x;
info->y_offset = parent_y_offset + info->y - wrapper->y;
/* We don't considering the clipping of toplevel windows and their immediate children
* by their parents, and simply always map those windows.
*/
if (parent_pos->clip_rect.width == G_MAXINT)
info->mapped = TRUE;
/* Check if the window would wrap around into the visible space in either direction */
else if (info->x + parent_x_offset < parent_pos->clip_rect.x + parent_pos->clip_rect.width - 65536 ||
info->x + info->width + parent_x_offset > parent_pos->clip_rect.x + 65536 ||
info->y + parent_y_offset < parent_pos->clip_rect.y + parent_pos->clip_rect.height - 65536 ||
info->y + info->height + parent_y_offset > parent_pos->clip_rect.y + 65536)
info->mapped = FALSE;
else
info->mapped = TRUE;
info->no_bg = FALSE;
if (GDK_WINDOW_TYPE (wrapper) == GDK_WINDOW_CHILD)
{
info->clip_rect.x = wrapper->x;
info->clip_rect.y = wrapper->y;
info->clip_rect.width = window->width;
info->clip_rect.height = window->height;
gdk_rectangle_intersect (&info->clip_rect, &parent_pos->clip_rect, &info->clip_rect);
info->clip_rect.x -= wrapper->x;
info->clip_rect.y -= wrapper->y;
}
else
{
info->clip_rect.x = 0;
info->clip_rect.y = 0;
info->clip_rect.width = G_MAXINT;
info->clip_rect.height = G_MAXINT;
}
}
static void
gdk_window_compute_parent_pos (GdkWindowImplX11 *window,
GdkWindowParentPos *parent_pos)
{
GdkWindowObject *wrapper;
GdkWindowObject *parent;
GdkRectangle tmp_clip;
int clip_xoffset = 0;
int clip_yoffset = 0;
g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (window));
wrapper =
GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_X11 (window)->wrapper);
parent_pos->x = 0;
parent_pos->y = 0;
parent_pos->x11_x = 0;
parent_pos->x11_y = 0;
/* We take a simple approach here and simply consider toplevel
* windows not to clip their children on the right/bottom, since the
* size of toplevel windows is not directly under our
* control. Clipping only really matters when scrolling and
* generally we aren't going to be moving the immediate child of a
* toplevel beyond the bounds of that toplevel.
*
* We could go ahead and recompute the clips of toplevel windows and
* their descendents when we receive size notification, but it would
* probably not be an improvement in most cases.
*/
parent_pos->clip_rect.x = 0;
parent_pos->clip_rect.y = 0;
parent_pos->clip_rect.width = G_MAXINT;
parent_pos->clip_rect.height = G_MAXINT;
parent = (GdkWindowObject *)wrapper->parent;
while (parent && parent->window_type == GDK_WINDOW_CHILD)
{
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (parent->impl);
tmp_clip.x = - clip_xoffset;
tmp_clip.y = - clip_yoffset;
tmp_clip.width = impl->width;
tmp_clip.height = impl->height;
gdk_rectangle_intersect (&parent_pos->clip_rect, &tmp_clip, &parent_pos->clip_rect);
translate_pos (parent_pos, parent_pos, parent,
&impl->position_info, FALSE);
clip_xoffset += parent->x;
clip_yoffset += parent->y;
parent = (GdkWindowObject *)parent->parent;
}
}
static void
gdk_window_premove (GdkWindow *window,
GdkWindowParentPos *parent_pos)
{
GdkWindowImplX11 *impl;
GdkWindowObject *obj;
GdkXPositionInfo new_info;
gint d_xoffset, d_yoffset;
GdkWindowParentPos this_pos;
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
gdk_window_compute_position (impl, parent_pos, &new_info);
gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
translate_pos (&this_pos, parent_pos, obj, &new_info, TRUE);
unmap_if_needed (window, &new_info);
d_xoffset = new_info.x_offset - impl->position_info.x_offset;
d_yoffset = new_info.y_offset - impl->position_info.y_offset;
if (d_xoffset != 0 || d_yoffset != 0)
{
GdkRectangle new_position;
if (d_xoffset < 0 || d_yoffset < 0)
gdk_window_queue_translation (window, NULL, MIN (d_xoffset, 0), MIN (d_yoffset, 0));
compute_intermediate_position (&impl->position_info, &new_info, d_xoffset, d_yoffset,
&new_position);
move_resize (window, &new_position);
}
g_list_foreach (obj->children, (GFunc) gdk_window_premove, &this_pos);
}
static void
gdk_window_postmove (GdkWindow *window,
GdkWindowParentPos *parent_pos)
{
GdkWindowImplX11 *impl;
GdkWindowObject *obj;
GdkXPositionInfo new_info;
gint d_xoffset, d_yoffset;
GdkWindowParentPos this_pos;
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
gdk_window_compute_position (impl, parent_pos, &new_info);
translate_pos (&this_pos, parent_pos, obj, &new_info, TRUE);
d_xoffset = new_info.x_offset - impl->position_info.x_offset;
d_yoffset = new_info.y_offset - impl->position_info.y_offset;
if (d_xoffset != 0 || d_yoffset != 0)
{
if (d_xoffset > 0 || d_yoffset > 0)
gdk_window_queue_translation (window, NULL, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
move_resize (window, (GdkRectangle *) &new_info);
}
map_if_needed (window, &new_info);
reset_backgrounds (window);
impl->position_info = new_info;
g_list_foreach (obj->children, (GFunc) gdk_window_postmove, &this_pos);
move (window, &new_info);
}
static Bool
@ -1050,11 +356,11 @@ gdk_window_queue (GdkWindow *window,
g_queue_push_tail (display_x11->translate_queue, item);
}
static void
gdk_window_queue_translation (GdkWindow *window,
GdkRegion *area,
gint dx,
gint dy)
void
_gdk_windowing_window_queue_translation (GdkWindow *window,
GdkRegion *area,
gint dx,
gint dy)
{
GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
item->type = GDK_WINDOW_QUEUE_TRANSLATE;
@ -1066,8 +372,8 @@ gdk_window_queue_translation (GdkWindow *window,
}
gboolean
_gdk_windowing_window_queue_antiexpose (GdkWindow *window,
GdkRegion *area)
_gdk_x11_window_queue_antiexpose (GdkWindow *window,
GdkRegion *area)
{
GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
item->type = GDK_WINDOW_QUEUE_ANTIEXPOSE;
@ -1085,7 +391,6 @@ _gdk_window_process_expose (GdkWindow *window,
{
GdkWindowImplX11 *impl;
GdkRegion *invalidate_region = gdk_region_rectangle (area);
GdkRegion *clip_region;
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
impl = GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
@ -1134,57 +439,10 @@ _gdk_window_process_expose (GdkWindow *window,
}
}
clip_region = gdk_region_rectangle (&impl->position_info.clip_rect);
gdk_region_intersect (invalidate_region, clip_region);
if (!gdk_region_empty (invalidate_region))
gdk_window_invalidate_region (window, invalidate_region, FALSE);
_gdk_window_invalidate_for_expose (window, invalidate_region);
gdk_region_destroy (invalidate_region);
gdk_region_destroy (clip_region);
}
static void
gdk_window_clip_changed (GdkWindow *window, GdkRectangle *old_clip, GdkRectangle *new_clip)
{
GdkWindowImplX11 *impl;
GdkWindowObject *obj;
GdkRegion *old_clip_region;
GdkRegion *new_clip_region;
if (((GdkWindowObject *)window)->input_only)
return;
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
old_clip_region = gdk_region_rectangle (old_clip);
new_clip_region = gdk_region_rectangle (new_clip);
/* We need to update this here because gdk_window_invalidate_region makes
* use if it (through gdk_drawable_get_visible_region
*/
impl->position_info.clip_rect = *new_clip;
/* Trim invalid region of window to new clip rectangle
*/
if (obj->update_area)
gdk_region_intersect (obj->update_area, new_clip_region);
/* Invalidate newly exposed portion of window
*/
gdk_region_subtract (new_clip_region, old_clip_region);
if (!gdk_region_empty (new_clip_region))
{
_gdk_x11_window_tmp_unset_bg (window, FALSE);;
gdk_window_invalidate_region (window, new_clip_region, FALSE);
}
if (obj->parent)
_gdk_x11_window_tmp_unset_bg ((GdkWindow *)obj->parent, FALSE);
gdk_region_destroy (new_clip_region);
gdk_region_destroy (old_clip_region);
}
#define __GDK_GEOMETRY_X11_C__

View File

@ -251,7 +251,7 @@ gdk_device_get_history (GdkDevice *device,
int tmp_n_events = 0;
int i;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
g_return_val_if_fail (GDK_WINDOW_IS_X11 (window), FALSE);
if (GDK_WINDOW_DESTROYED (window))
/* Nothing */ ;
@ -347,7 +347,7 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
GdkDisplayX11 *display_x11;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (GDK_WINDOW_IS_X11 (window));
window_private = (GdkWindowObject*) window;
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));

View File

@ -143,17 +143,17 @@ generate_grab_broken_event (GdkWindow *window,
gboolean implicit,
GdkWindow *grab_window)
{
g_return_if_fail (window != NULL);
if (!GDK_WINDOW_DESTROYED (window))
{
GdkEvent event;
event.type = GDK_GRAB_BROKEN;
event.grab_broken.window = window;
event.grab_broken.send_event = 0;
event.grab_broken.keyboard = keyboard;
event.grab_broken.implicit = implicit;
event.grab_broken.grab_window = grab_window;
gdk_event_put (&event);
}
}
@ -191,6 +191,7 @@ gdk_pointer_grab (GdkWindow * window,
{
gint return_val;
GdkCursorPrivate *cursor_private;
GdkWindow *native;
GdkDisplayX11 *display_x11;
guint xevent_mask;
Window xwindow;
@ -202,13 +203,18 @@ gdk_pointer_grab (GdkWindow * window,
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), 0);
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
native = _gdk_window_get_impl_window (window);
if (confine_to)
confine_to = _gdk_window_get_impl_window (confine_to);
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (native));
cursor_private = (GdkCursorPrivate*) cursor;
xwindow = GDK_WINDOW_XID (window);
serial = NextRequest (GDK_WINDOW_XDISPLAY (window));
xwindow = GDK_WINDOW_XID (native);
serial = NextRequest (GDK_WINDOW_XDISPLAY (native));
if (!confine_to || GDK_WINDOW_DESTROYED (confine_to))
xconfine_to = None;
@ -230,7 +236,7 @@ gdk_pointer_grab (GdkWindow * window,
xevent_mask |= _gdk_event_mask_table[i];
}
return_val = _gdk_input_grab_pointer (window,
return_val = _gdk_input_grab_pointer (native,
owner_events,
event_mask,
confine_to,
@ -239,14 +245,14 @@ gdk_pointer_grab (GdkWindow * window,
if (return_val == GrabSuccess ||
G_UNLIKELY (!display_x11->trusted_client && return_val == AlreadyGrabbed))
{
if (!GDK_WINDOW_DESTROYED (window))
if (!GDK_WINDOW_DESTROYED (native))
{
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
return_val = GrabSuccess;
else
#endif
return_val = XGrabPointer (GDK_WINDOW_XDISPLAY (window),
return_val = XGrabPointer (GDK_WINDOW_XDISPLAY (native),
xwindow,
owner_events,
xevent_mask,
@ -261,59 +267,19 @@ gdk_pointer_grab (GdkWindow * window,
if (return_val == GrabSuccess)
{
if (display_x11->pointer_xgrab_window != NULL &&
display_x11->pointer_xgrab_window != (GdkWindowObject *)window)
generate_grab_broken_event (GDK_WINDOW (display_x11->pointer_xgrab_window),
FALSE, display_x11->pointer_xgrab_implicit,
window);
display_x11->pointer_xgrab_window = (GdkWindowObject *)window;
display_x11->pointer_xgrab_serial = serial;
display_x11->pointer_xgrab_owner_events = owner_events;
display_x11->pointer_xgrab_time = time;
display_x11->pointer_xgrab_implicit = FALSE;
_gdk_display_set_has_pointer_grab (GDK_DISPLAY_OBJECT (display_x11),
window,
native,
owner_events,
event_mask,
serial,
time,
FALSE);
}
return gdk_x11_convert_grab_status (return_val);
}
/**
* gdk_pointer_grab_info_libgtk_only:
* @display: the #GdkDisplay for which to get the grab information
* @grab_window: location to store current grab window
* @owner_events: location to store boolean indicating whether
* the @owner_events flag to gdk_pointer_grab() was %TRUE.
*
* Determines information about the current pointer grab.
* This is not public API and must not be used by applications.
*
* Return value: %TRUE if this application currently has the
* pointer grabbed.
**/
gboolean
gdk_pointer_grab_info_libgtk_only (GdkDisplay *display,
GdkWindow **grab_window,
gboolean *owner_events)
{
GdkDisplayX11 *display_x11;
g_return_val_if_fail (GDK_IS_DISPLAY (display), False);
display_x11 = GDK_DISPLAY_X11 (display);
if (display_x11->pointer_xgrab_window)
{
if (grab_window)
*grab_window = (GdkWindow *)display_x11->pointer_xgrab_window;
if (owner_events)
*owner_events = display_x11->pointer_xgrab_owner_events;
return TRUE;
}
else
return FALSE;
}
/*
*--------------------------------------------------------------
* gdk_keyboard_grab
@ -342,23 +308,28 @@ gdk_keyboard_grab (GdkWindow * window,
gint return_val;
unsigned long serial;
GdkDisplayX11 *display_x11;
GdkWindow *native;
if (1) return 0; /* TODO: fix */
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
serial = NextRequest (GDK_WINDOW_XDISPLAY (window));
native = _gdk_window_get_impl_window (window);
if (!GDK_WINDOW_DESTROYED (window))
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (native));
serial = NextRequest (GDK_WINDOW_XDISPLAY (native));
if (!GDK_WINDOW_DESTROYED (native))
{
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
return_val = GrabSuccess;
else
#endif
return_val = XGrabKeyboard (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
return_val = XGrabKeyboard (GDK_WINDOW_XDISPLAY (native),
GDK_WINDOW_XID (native),
owner_events,
GrabModeAsync, GrabModeAsync,
time);
@ -378,6 +349,7 @@ gdk_keyboard_grab (GdkWindow * window,
TRUE, FALSE, window);
display_x11->keyboard_xgrab_window = (GdkWindowObject *)window;
display_x11->keyboard_xgrab_native_window = (GdkWindowObject *)native;
display_x11->keyboard_xgrab_serial = serial;
display_x11->keyboard_xgrab_owner_events = owner_events;
display_x11->keyboard_xgrab_time = time;
@ -386,6 +358,24 @@ gdk_keyboard_grab (GdkWindow * window,
return gdk_x11_convert_grab_status (return_val);
}
void
_gdk_windowing_grab_broken (GdkDisplay *display)
{
/* TODO: Move to common code */
#if 0
GdkDisplayX11 *display_x11;
g_return_if_fail (display != NULL);
display_x11 = GDK_DISPLAY_X11 (display);
generate_grab_broken_event (GDK_WINDOW (display_x11->pointer_grab.window),
FALSE,
display_x11->pointer_grab.implicit,
NULL);
display_x11->pointer_grab.window = NULL;
#endif
}
/**
* gdk_keyboard_grab_info_libgtk_only:
* @display: the display for which to get the grab information
@ -437,24 +427,20 @@ void
_gdk_xgrab_check_unmap (GdkWindow *window,
gulong serial)
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (gdk_drawable_get_display (window));
GdkDisplay *display = gdk_drawable_get_display (window);
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
if (display_x11->pointer_xgrab_window &&
serial >= display_x11->pointer_xgrab_serial)
if (display->pointer_grab.window &&
serial >= display->pointer_grab.serial)
{
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
GdkWindowObject *tmp = display_x11->pointer_xgrab_window;
GdkWindowObject *tmp = GDK_WINDOW_OBJECT (display->pointer_grab.native_window);
while (tmp && tmp != private)
tmp = tmp->parent;
if (tmp)
{
generate_grab_broken_event (GDK_WINDOW (display_x11->pointer_xgrab_window),
FALSE, display_x11->pointer_xgrab_implicit,
NULL);
display_x11->pointer_xgrab_window = NULL;
}
_gdk_display_unset_has_pointer_grab (display, TRUE, FALSE, GDK_CURRENT_TIME);
}
if (display_x11->keyboard_xgrab_window &&
@ -486,17 +472,15 @@ _gdk_xgrab_check_unmap (GdkWindow *window,
void
_gdk_xgrab_check_destroy (GdkWindow *window)
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (gdk_drawable_get_display (window));
GdkDisplay *display = gdk_drawable_get_display (window);
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
if ((GdkWindowObject *)window == display_x11->pointer_xgrab_window)
{
generate_grab_broken_event (GDK_WINDOW (display_x11->pointer_xgrab_window),
FALSE, display_x11->pointer_xgrab_implicit,
NULL);
display_x11->pointer_xgrab_window = NULL;
}
if (window == display->pointer_grab.native_window &&
display->pointer_grab.window != NULL)
_gdk_display_unset_has_pointer_grab (display, TRUE, FALSE, GDK_CURRENT_TIME);
if ((GdkWindowObject *)window == display_x11->keyboard_xgrab_window)
if ((GdkWindowObject *)window == display_x11->keyboard_xgrab_native_window &&
display_x11->keyboard_xgrab_window != NULL)
{
generate_grab_broken_event (GDK_WINDOW (display_x11->keyboard_xgrab_window),
TRUE, FALSE, NULL);
@ -521,27 +505,31 @@ void
_gdk_xgrab_check_button_event (GdkWindow *window,
XEvent *xevent)
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (gdk_drawable_get_display (window));
GdkDisplay *display = gdk_drawable_get_display (window);
/* track implicit grabs for button presses */
switch (xevent->type)
{
case ButtonPress:
if (!display_x11->pointer_xgrab_window)
if (!display->pointer_grab.window)
{
display_x11->pointer_xgrab_window = (GdkWindowObject *)window;
display_x11->pointer_xgrab_serial = xevent->xany.serial;
display_x11->pointer_xgrab_owner_events = FALSE;
display_x11->pointer_xgrab_time = xevent->xbutton.time;
display_x11->pointer_xgrab_implicit = TRUE;
_gdk_display_set_has_pointer_grab (display,
window,
window,
FALSE,
gdk_window_get_events (window),
xevent->xany.serial,
xevent->xbutton.time,
TRUE);
}
break;
case ButtonRelease:
if (display_x11->pointer_xgrab_window &&
display_x11->pointer_xgrab_implicit &&
if (display->pointer_grab.window &&
display->pointer_grab.implicit &&
(xevent->xbutton.state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (xevent->xbutton.button - 1))) == 0)
{
display_x11->pointer_xgrab_window = NULL;
_gdk_display_unset_has_pointer_grab (display, TRUE, TRUE,
xevent->xbutton.time);
}
break;
default:

View File

@ -137,10 +137,10 @@ gdk_pixmap_impl_x11_get_size (GdkDrawable *drawable,
}
GdkPixmap*
gdk_pixmap_new (GdkDrawable *drawable,
gint width,
gint height,
gint depth)
_gdk_pixmap_new (GdkDrawable *drawable,
gint width,
gint height,
gint depth)
{
GdkPixmap *pixmap;
GdkDrawableImplX11 *draw_impl;
@ -194,10 +194,10 @@ gdk_pixmap_new (GdkDrawable *drawable,
}
GdkPixmap *
gdk_bitmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height)
_gdk_bitmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height)
{
GdkPixmap *pixmap;
GdkDrawableImplX11 *draw_impl;
@ -238,13 +238,13 @@ gdk_bitmap_create_from_data (GdkDrawable *drawable,
}
GdkPixmap*
gdk_pixmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height,
gint depth,
const GdkColor *fg,
const GdkColor *bg)
_gdk_pixmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height,
gint depth,
const GdkColor *fg,
const GdkColor *bg)
{
GdkPixmap *pixmap;
GdkDrawableImplX11 *draw_impl;

View File

@ -118,7 +118,6 @@ GdkImage *_gdk_x11_copy_to_image (GdkDrawable *drawable,
Pixmap _gdk_x11_image_get_shm_pixmap (GdkImage *image);
/* Routines from gdkgeometry-x11.c */
void _gdk_window_init_position (GdkWindow *window);
void _gdk_window_move_resize_child (GdkWindow *window,
gint x,
gint y,
@ -128,13 +127,9 @@ void _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area);
void _gdk_x11_window_scroll (GdkWindow *window,
gint dx,
gint dy);
void _gdk_x11_window_move_region (GdkWindow *window,
const GdkRegion *region,
gint dx,
gint dy);
gboolean _gdk_x11_window_queue_antiexpose (GdkWindow *window,
GdkRegion *area);
void _gdk_selection_window_destroyed (GdkWindow *window);
gboolean _gdk_selection_filter_clear_event (XSelectionClearEvent *event);
@ -216,5 +211,6 @@ extern gboolean _gdk_synchronize;
#define GDK_WINDOW_DISPLAY(win) (GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (win))->display)
#define GDK_WINDOW_XROOTWIN(win) (GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (win))->xroot_window)
#define GDK_GC_DISPLAY(gc) (GDK_SCREEN_DISPLAY (GDK_GC_X11(gc)->screen))
#define GDK_WINDOW_IS_X11(win) (GDK_IS_WINDOW_IMPL_X11 (((GdkWindowObject *)win)->impl))
#endif /* __GDK_PRIVATE_X11_H__ */

View File

@ -541,7 +541,7 @@ gdk_property_get (GdkWindow *window,
Atom xtype;
int res;
g_return_val_if_fail (!window || GDK_IS_WINDOW (window), FALSE);
g_return_val_if_fail (!window || GDK_WINDOW_IS_X11 (window), FALSE);
if (!window)
{
@ -550,6 +550,8 @@ gdk_property_get (GdkWindow *window,
GDK_NOTE (MULTIHEAD, g_message ("gdk_property_get(): window is NULL\n"));
}
else if (!GDK_WINDOW_IS_X11 (window))
return FALSE;
if (GDK_WINDOW_DESTROYED (window))
return FALSE;
@ -675,7 +677,7 @@ gdk_property_change (GdkWindow *window,
Atom xproperty;
Atom xtype;
g_return_if_fail (!window || GDK_IS_WINDOW (window));
g_return_if_fail (!window || GDK_WINDOW_IS_X11 (window));
if (!window)
{
@ -686,7 +688,8 @@ gdk_property_change (GdkWindow *window,
GDK_NOTE (MULTIHEAD, g_message ("gdk_property_change(): window is NULL\n"));
}
else if (!GDK_WINDOW_IS_X11 (window))
return;
if (GDK_WINDOW_DESTROYED (window))
return;
@ -726,7 +729,7 @@ void
gdk_property_delete (GdkWindow *window,
GdkAtom property)
{
g_return_if_fail (!window || GDK_IS_WINDOW (window));
g_return_if_fail (!window || GDK_WINDOW_IS_X11 (window));
if (!window)
{
@ -736,6 +739,8 @@ gdk_property_delete (GdkWindow *window,
GDK_NOTE (MULTIHEAD,
g_message ("gdk_property_delete(): window is NULL\n"));
}
else if (!GDK_WINDOW_IS_X11 (window))
return;
if (GDK_WINDOW_DESTROYED (window))
return;

View File

@ -141,7 +141,7 @@ gdk_selection_owner_set_for_display (GdkDisplay *display,
if (owner)
{
if (GDK_WINDOW_DESTROYED (owner))
if (GDK_WINDOW_DESTROYED (owner) || !GDK_WINDOW_IS_X11 (owner))
return FALSE;
xdisplay = GDK_WINDOW_XDISPLAY (owner);
@ -231,7 +231,7 @@ gdk_selection_convert (GdkWindow *requestor,
g_return_if_fail (selection != GDK_NONE);
if (GDK_WINDOW_DESTROYED (requestor))
if (GDK_WINDOW_DESTROYED (requestor) || !GDK_WINDOW_IS_X11 (requestor))
return;
display = GDK_WINDOW_DISPLAY (requestor);
@ -279,10 +279,11 @@ gdk_selection_property_get (GdkWindow *requestor,
g_return_val_if_fail (requestor != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
g_return_val_if_fail (GDK_WINDOW_IS_X11 (requestor), 0);
display = GDK_WINDOW_DISPLAY (requestor);
if (GDK_WINDOW_DESTROYED (requestor))
if (GDK_WINDOW_DESTROYED (requestor) || !GDK_WINDOW_IS_X11 (requestor))
goto err;
t = NULL;

File diff suppressed because it is too large Load Diff

View File

@ -44,22 +44,6 @@ typedef struct _GdkWindowImplX11 GdkWindowImplX11;
typedef struct _GdkWindowImplX11Class GdkWindowImplX11Class;
typedef struct _GdkXPositionInfo GdkXPositionInfo;
struct _GdkXPositionInfo
{
gint x;
gint y;
gint width;
gint height;
gint x_offset; /* Offsets to add to X coordinates within window */
gint y_offset; /* to get GDK coodinates within window */
guint big : 1;
guint mapped : 1;
guint no_bg : 1; /* Set when the window background is temporarily
* unset during resizing and scaling */
GdkRectangle clip_rect; /* visible rectangle of window */
};
/* Window implementation for X11
*/
@ -74,10 +58,8 @@ struct _GdkWindowImplX11
{
GdkDrawableImplX11 parent_instance;
gint width;
gint height;
GdkXPositionInfo position_info;
guint no_bg : 1; /* Set when the window background is temporarily
* unset during resizing and scaling */
GdkToplevelX11 *toplevel; /* Toplevel-specific information */
GdkCursor *cursor;
gint8 toplevel_window_type;