summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-12-15 19:07:36 -0500
committerMatthias Clasen <mclasen@redhat.com>2010-12-21 12:07:01 -0500
commit126212b470552b230e000bd8ad5207f73da30026 (patch)
treed7554ace617161964c2630d6555088311063e810 /gdk
parentd5803fa9b2267447b6070c46c186d7bd1cbb66a4 (diff)
downloadgtk+-126212b470552b230e000bd8ad5207f73da30026.tar.gz
Add a vfunc for _gdk_window_impl_new
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdkdisplay.c18
-rw-r--r--gdk/gdkdisplayprivate.h15
-rw-r--r--gdk/gdkwindow.c15
-rw-r--r--gdk/x11/gdkdisplay-x11.c1
-rw-r--r--gdk/x11/gdkprivate-x11.h7
-rw-r--r--gdk/x11/gdkwindow-x11.c99
6 files changed, 101 insertions, 54 deletions
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 1dc331e0ed..bacefc9359 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -2517,3 +2517,21 @@ _gdk_display_event_data_free (GdkDisplay *display,
{
GDK_DISPLAY_GET_CLASS (display)->event_data_free (display, event);
}
+
+void
+_gdk_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask)
+{
+ GDK_DISPLAY_GET_CLASS (display)->create_window_impl (display,
+ window,
+ real_parent,
+ screen,
+ event_mask,
+ attributes,
+ attributes_mask);
+}
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 92398121f2..4b1530243d 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -21,6 +21,7 @@
#define __GDK_DISPLAY_PRIVATE_H__
#include "gdkdisplay.h"
+#include "gdkwindow.h"
#include "gdkcursor.h"
G_BEGIN_DECLS
@@ -182,6 +183,13 @@ struct _GdkDisplayClass
GdkEvent *new_event);
void (*event_data_free) (GdkDisplay *display,
GdkEvent *event);
+ void (*create_window_impl) (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
/* Signals */
void (*closed) (GdkDisplay *display,
@@ -234,6 +242,13 @@ void _gdk_display_event_data_copy (GdkDisplay *display
GdkEvent *new_event);
void _gdk_display_event_data_free (GdkDisplay *display,
GdkEvent *event);
+void _gdk_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
G_END_DECLS
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index d0deb91f1a..1a21b58e92 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1276,6 +1276,7 @@ gdk_window_new (GdkWindow *parent,
{
GdkWindow *window;
GdkScreen *screen;
+ GdkDisplay *display;
int x, y;
gboolean native;
GdkEventMask event_mask;
@@ -1425,10 +1426,11 @@ gdk_window_new (GdkWindow *parent,
}
else if (native)
{
+ display = gdk_screen_get_display (screen);
event_mask = get_native_event_mask (window);
/* Create the impl */
- _gdk_window_impl_new (window, real_parent, screen, event_mask, attributes, attributes_mask);
+ _gdk_display_create_window_impl (display, window, real_parent, screen, event_mask, attributes, attributes_mask);
window->impl_window = window;
/* This will put the native window topmost in the native parent, which may
@@ -1720,6 +1722,7 @@ gdk_window_ensure_native (GdkWindow *window)
{
GdkWindow *impl_window;
GdkWindowImpl *new_impl, *old_impl;
+ GdkDisplay *display;
GdkScreen *screen;
GdkWindow *above;
GList listhead;
@@ -1745,12 +1748,14 @@ gdk_window_ensure_native (GdkWindow *window)
gdk_window_drop_cairo_surface (window);
screen = gdk_window_get_screen (window);
+ display = gdk_screen_get_display (screen);
old_impl = window->impl;
- _gdk_window_impl_new (window, window->parent,
- screen,
- get_native_event_mask (window),
- NULL, 0);
+ _gdk_display_create_window_impl (display,
+ window, window->parent,
+ screen,
+ get_native_event_mask (window),
+ NULL, 0);
new_impl = window->impl;
window->impl = old_impl;
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 7db72d8be4..04475a2144 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -2726,5 +2726,6 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class)
display_class->notify_startup_complete = gdk_x11_display_notify_startup_complete;
display_class->event_data_copy = gdk_x11_display_event_data_copy;
display_class->event_data_free = gdk_x11_display_event_data_free;
+ display_class->create_window_impl = _gdk_x11_display_create_window_impl;
}
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 70c91a1024..e28d5a8a63 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -180,6 +180,13 @@ void _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
guint *height);
void _gdk_x11_display_before_process_all_updates (GdkDisplay *display);
void _gdk_x11_display_after_process_all_updates (GdkDisplay *display);
+void _gdk_x11_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
void _gdk_x11_precache_atoms (GdkDisplay *display,
const gchar * const *atom_names,
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 3a3c34e0e1..d0f8f039a2 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -677,17 +677,18 @@ setup_toplevel_window (GdkWindow *window,
}
void
-_gdk_window_impl_new (GdkWindow *window,
- GdkWindow *real_parent,
- GdkScreen *screen,
- GdkEventMask event_mask,
- GdkWindowAttr *attributes,
- gint attributes_mask)
+_gdk_x11_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask)
{
GdkWindowImplX11 *impl;
GdkScreenX11 *screen_x11;
GdkDisplayX11 *display_x11;
-
+
Window xparent;
Visual *xvisual;
Display *xdisplay;
@@ -695,53 +696,53 @@ _gdk_window_impl_new (GdkWindow *window,
XSetWindowAttributes xattributes;
long xattributes_mask;
XClassHint *class_hint;
-
+
unsigned int class;
const char *title;
-
- screen_x11 = GDK_SCREEN_X11 (screen);
+
+ display_x11 = GDK_DISPLAY_X11 (display);
xparent = GDK_WINDOW_XID (real_parent);
- display_x11 = GDK_DISPLAY_X11 (GDK_SCREEN_DISPLAY (screen));
-
+ screen_x11 = GDK_SCREEN_X11 (screen);
+
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL);
window->impl = GDK_WINDOW_IMPL (impl);
impl->wrapper = GDK_WINDOW (window);
-
+
xdisplay = screen_x11->xdisplay;
xattributes_mask = 0;
xvisual = gdk_x11_visual_get_xvisual (window->visual);
-
+
if (attributes_mask & GDK_WA_NOREDIR)
{
xattributes.override_redirect =
- (attributes->override_redirect == FALSE)?False:True;
+ (attributes->override_redirect == FALSE)?False:True;
xattributes_mask |= CWOverrideRedirect;
- }
+ }
else
xattributes.override_redirect = False;
impl->override_redirect = xattributes.override_redirect;
-
+
if (window->parent && window->parent->guffaw_gravity)
{
xattributes.win_gravity = StaticGravity;
xattributes_mask |= CWWinGravity;
}
-
+
/* Sanity checks */
switch (window->window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_TEMP:
if (GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT)
- {
- /* The common code warns for this case */
- xparent = GDK_SCREEN_XROOTWIN (screen);
- }
+ {
+ /* The common code warns for this case */
+ xparent = GDK_SCREEN_XROOTWIN (screen);
+ }
}
-
+
if (!window->input_only)
{
class = InputOutput;
@@ -752,24 +753,24 @@ _gdk_window_impl_new (GdkWindow *window,
xattributes_mask |= CWBorderPixel | CWBackPixel;
if (window->guffaw_gravity)
- xattributes.bit_gravity = StaticGravity;
+ xattributes.bit_gravity = StaticGravity;
else
- xattributes.bit_gravity = NorthWestGravity;
-
+ xattributes.bit_gravity = NorthWestGravity;
+
xattributes_mask |= CWBitGravity;
xattributes.colormap = _gdk_visual_get_x11_colormap (window->visual);
xattributes_mask |= CWColormap;
if (window->window_type == GDK_WINDOW_TEMP)
- {
- xattributes.save_under = True;
- xattributes.override_redirect = True;
- xattributes.cursor = None;
- xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
+ {
+ xattributes.save_under = True;
+ xattributes.override_redirect = True;
+ xattributes.cursor = None;
+ xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
- impl->override_redirect = TRUE;
- }
+ impl->override_redirect = TRUE;
+ }
}
else
{
@@ -780,13 +781,13 @@ _gdk_window_impl_new (GdkWindow *window,
window->height > 65535)
{
g_warning ("Native Windows wider or taller than 65535 pixels are not supported");
-
+
if (window->width > 65535)
- window->width = 65535;
+ window->width = 65535;
if (window->height > 65535)
- window->height = 65535;
+ window->height = 65535;
}
-
+
impl->xid = XCreateWindow (xdisplay, xparent,
window->x + window->parent->abs_x,
window->y + window->parent->abs_y,
@@ -802,21 +803,21 @@ _gdk_window_impl_new (GdkWindow *window,
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_TEMP:
if (attributes_mask & GDK_WA_TITLE)
- title = attributes->title;
+ title = attributes->title;
else
- title = get_default_title ();
-
+ title = get_default_title ();
+
gdk_window_set_title (window, title);
-
+
if (attributes_mask & GDK_WA_WMCLASS)
- {
- class_hint = XAllocClassHint ();
- class_hint->res_name = attributes->wmclass_name;
- class_hint->res_class = attributes->wmclass_class;
- XSetClassHint (xdisplay, impl->xid, class_hint);
- XFree (class_hint);
- }
-
+ {
+ class_hint = XAllocClassHint ();
+ class_hint->res_name = attributes->wmclass_name;
+ class_hint->res_class = attributes->wmclass_class;
+ XSetClassHint (xdisplay, impl->xid, class_hint);
+ XFree (class_hint);
+ }
+
setup_toplevel_window (window, window->parent);
break;