Commit 126212b4 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Add a vfunc for _gdk_window_impl_new

parent d5803fa9
......@@ -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);
}
......@@ -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
......
......@@ -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;
......
......@@ -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;
}
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment