Commit 214342ea authored by Matthias Clasen's avatar Matthias Clasen

Clean up gdkx.h a bit

Moving the direct-access redefinitions of various macros
to gdkprivate-x11.h and use that header throughout in x11/.

Also remove a workaround for a long-fixed X server bug.
parent 32e3dcfb
......@@ -31,18 +31,14 @@
#include "gdkwindow.h"
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h" /* For workaround */
#endif
#include "gdkrectangle.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkscreen.h"
#include "gdkscreenprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkvisualprivate.h"
#include "gdkmarshalers.h"
#include "gdkscreen.h"
#include "gdkwindowimpl.h"
#include <math.h>
......@@ -1340,19 +1336,6 @@ gdk_window_new (GdkWindow *parent,
window->width = (attributes->width > 1) ? (attributes->width) : (1);
window->height = (attributes->height > 1) ? (attributes->height) : (1);
#ifdef GDK_WINDOWING_X11
/* Work around a bug where Xorg refuses to map toplevel InputOnly windows
* from an untrusted client: http://bugs.freedesktop.org/show_bug.cgi?id=6988
*/
if (attributes->wclass == GDK_INPUT_ONLY &&
window->parent->window_type == GDK_WINDOW_ROOT &&
!G_LIKELY (GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (parent))->trusted_client))
{
g_warning ("Coercing GDK_INPUT_ONLY toplevel window to GDK_INPUT_OUTPUT to work around bug in Xorg server");
attributes->wclass = GDK_INPUT_OUTPUT;
}
#endif
if (attributes->wclass == GDK_INPUT_ONLY)
{
/* Backwards compatiblity - we've always ignored
......
......@@ -23,10 +23,9 @@
#include "config.h"
#include "gdkapplaunchcontextprivate.h"
#include "gdkx.h"
#include "gdkscreen.h"
#include "gdkintl.h"
#include "gdkprivate-x11.h"
#include <glib.h>
#include <gio/gdesktopappinfo.h>
......
......@@ -46,7 +46,7 @@ in this Software without prior written authorization from The Open Group.
#include "config.h"
#include "gdkasync.h"
#include "gdkx.h"
#include "gdkprivate-x11.h"
#ifdef NEED_XIPROTO_H_FOR_XREPLY
#include <X11/extensions/XIproto.h>
......
......@@ -31,10 +31,8 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gdkcursor.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdkx.h"
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
......
......@@ -19,14 +19,12 @@
#include "config.h"
#include "glib.h"
#include "gdkdevice-core.h"
#include "gdkinternals.h"
#include "gdkwindow.h"
#include "gdkprivate-x11.h"
#include "gdkasync.h"
#include "gdkx.h"
static gboolean gdk_device_core_get_history (GdkDevice *device,
GdkWindow *window,
......
......@@ -22,11 +22,10 @@
#include "gdkdevice-xi.h"
#include "gdkwindow.h"
#include "gdkintl.h"
#include "gdkdeviceprivate.h"
#include "gdkprivate-x11.h"
#include "gdkintl.h"
#include "gdkasync.h"
#include "gdkx.h"
#define MAX_DEVICE_CLASSES 13
......
......@@ -23,7 +23,7 @@
#include "gdkintl.h"
#include "gdkasync.h"
#include "gdkx.h"
#include "gdkprivate-x11.h"
#include <X11/extensions/XInput2.h>
......
......@@ -21,14 +21,12 @@
#include "gdkdevicemanager-core.h"
#include "gdktypes.h"
#include "gdkkeysyms.h"
#include "gdkdevicemanagerprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkeventtranslator.h"
#include "gdkdevice-core.h"
#include "gdkkeysyms.h"
#include "gdkprivate-x11.h"
#include "gdkx.h"
#ifdef HAVE_XKB
#include <X11/XKBlib.h>
......
......@@ -26,7 +26,8 @@
#include "gdkdevicemanager-xi2.h"
#endif
#endif
#include "gdkx.h"
#include "gdkinternals.h"
#include "gdkprivate-x11.h"
GdkDeviceManager *
_gdk_x11_device_manager_new (GdkDisplay *display)
......
......@@ -24,7 +24,7 @@
#include "gdkeventtranslator.h"
#include "gdkdevice-xi.h"
#include "gdkintl.h"
#include "gdkx.h"
#include "gdkprivate-x11.h"
#include <X11/extensions/XInput.h>
......
......@@ -21,13 +21,12 @@
#include "gdkdevicemanager-xi2.h"
#include "gdkkeysyms.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkeventtranslator.h"
#include "gdkdevice-xi2.h"
#include "gdkkeysyms.h"
#include "gdkprivate-x11.h"
#include "gdkx.h"
#include <string.h>
......
......@@ -24,20 +24,19 @@
#include "config.h"
#include "gdkdisplay-x11.h"
#include "gdkx.h"
#include "gdkasync.h"
#include "gdkdisplay.h"
#include "gdkeventsource.h"
#include "gdkeventtranslator.h"
#include "gdkinternals.h"
#include "gdkscreen.h"
#include "gdkscreen-x11.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include "gdkdevicemanager.h"
#include "xsettings-client.h"
#include "gdkdisplay-x11.h"
#include "gdkprivate-x11.h"
#include "gdkscreen-x11.h"
#include <glib.h>
#include <glib/gprintf.h>
......
......@@ -29,11 +29,10 @@
#include "gdkdndprivate.h"
#include "gdkmain.h"
#include "gdkx.h"
#include "gdkinternals.h"
#include "gdkasync.h"
#include "gdkproperty.h"
#include "gdkprivate-x11.h"
#include "gdkinternals.h"
#include "gdkscreen-x11.h"
#include "gdkdisplay-x11.h"
......
......@@ -22,7 +22,8 @@
#include "gdkeventsource.h"
#include "gdkinternals.h"
#include "gdkx.h"
#include "gdkwindow-x11.h"
#include "gdkprivate-x11.h"
static gboolean gdk_event_source_prepare (GSource *source,
......
......@@ -21,7 +21,6 @@
#define __GDK_EVENT_SOURCE_H__
#include "gdkeventtranslator.h"
#include "gdkprivate-x11.h"
G_BEGIN_DECLS
......
......@@ -20,9 +20,10 @@
#ifndef __GDK_EVENT_TRANSLATOR_H__
#define __GDK_EVENT_TRANSLATOR_H__
#include <gdk/gdktypes.h>
#include <gdk/gdkdisplay.h>
#include "gdkprivate-x11.h"
#include "gdktypes.h"
#include "gdkdisplay.h"
#include <X11/Xlib.h>
G_BEGIN_DECLS
......
......@@ -19,10 +19,9 @@
#include "config.h"
#include "gdkinternals.h"
#include "gdkrectangle.h"
#include "gdkprivate-x11.h"
#include "gdkx.h"
#include "gdkinternals.h"
#include "gdkscreen-x11.h"
#include "gdkdisplay-x11.h"
#include "gdkwindow-x11.h"
......
......@@ -26,10 +26,10 @@
#include "config.h"
#include "gdkx.h"
#include "gdkmain.h"
#include "gdkinternals.h"
#include "gdkdisplay-x11.h"
#include "gdkprivate-x11.h"
#include <locale.h>
#include <stdlib.h>
......
......@@ -30,7 +30,6 @@
#include "gdkkeysyms.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdkx.h"
#include <stdio.h>
#include <stdlib.h>
......
......@@ -26,13 +26,12 @@
#include "config.h"
#include "gdkx.h"
#include "gdkdeviceprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkasync.h"
#include "gdkdisplay-x11.h"
#include "gdkinternals.h"
#include "gdkprivate-x11.h"
#include "gdkintl.h"
#include "gdkdeviceprivate.h"
#include <glib/gprintf.h>
#include <stdlib.h>
......
......@@ -34,7 +34,9 @@
#include "gdkcursor.h"
#include "gdkprivate.h"
#include "gdkinternals.h"
#include "gdkx.h"
#include "gdkwindow-x11.h"
#include "gdkscreen-x11.h"
#include "gdkdisplay-x11.h"
#include <cairo-xlib.h>
......@@ -229,4 +231,15 @@ extern gboolean _gdk_synchronize;
#define GDK_GC_DISPLAY(gc) (GDK_SCREEN_DISPLAY (GDK_GC_X11(gc)->screen))
#define GDK_WINDOW_IS_X11(win) (GDK_IS_WINDOW_IMPL_X11 ((win)->impl))
/* override some macros from gdkx.h with direct-access variants */
#undef GDK_DISPLAY_XDISPLAY
#undef GDK_WINDOW_XDISPLAY
#undef GDK_WINDOW_XID
#undef GDK_SCREEN_XDISPLAY
#define GDK_DISPLAY_XDISPLAY(display) (GDK_DISPLAY_X11(display)->xdisplay)
#define GDK_WINDOW_XDISPLAY(win) (GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (win))->xdisplay)
#define GDK_WINDOW_XID(win) (GDK_WINDOW_IMPL_X11(GDK_WINDOW (win)->impl)->xid)
#define GDK_SCREEN_XDISPLAY(screen) (GDK_SCREEN_X11 (screen)->xdisplay)
#endif /* __GDK_PRIVATE_X11_H__ */
......@@ -27,14 +27,13 @@
#include "config.h"
#include "gdkproperty.h"
#include "gdkmain.h"
#include "gdkx.h"
#include "gdkprivate.h"
#include "gdkinternals.h"
#include "gdkselection.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdkscreen-x11.h"
#include "gdkselection.h"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
......
......@@ -24,11 +24,8 @@
#include "config.h"
#include "gdkscreen-x11.h"
#include "gdkscreen.h"
#include "gdkdisplay.h"
#include "gdkdisplay-x11.h"
#include "gdkx.h"
#include "gdkprivate-x11.h"
#include <glib.h>
......
......@@ -26,7 +26,6 @@
#include "gdkscreenprivate.h"
#include "gdkvisual.h"
#include "gdkprivate-x11.h"
#include "xsettings-client.h"
#include <X11/X.h>
#include <X11/Xlib.h>
......
......@@ -27,8 +27,6 @@
#include "config.h"
#include "gdkselection.h"
#include "gdkx.h"
#include "gdkproperty.h"
#include "gdkprivate.h"
#include "gdkprivate-x11.h"
......
......@@ -23,7 +23,7 @@
#include "gdktestutils.h"
#include "gdkkeysyms.h"
#include "gdkx.h"
#include "gdkprivate-x11.h"
#include <X11/Xlib.h>
......@@ -121,7 +121,7 @@ gdk_test_simulate_key (GdkWindow *window,
xev.type = key_pressrelease == GDK_KEY_PRESS ? KeyPress : KeyRelease;
xev.display = GDK_WINDOW_XDISPLAY (window);
xev.window = GDK_WINDOW_XID (window);
xev.root = RootWindow (xev.display, GDK_SCREEN_XNUMBER (screen));
xev.root = RootWindow (xev.display, GDK_SCREEN_X11 (screen)->screen_num);
xev.subwindow = 0;
xev.time = 0;
xev.x = MAX (x, 0);
......@@ -226,7 +226,7 @@ gdk_test_simulate_button (GdkWindow *window,
xev.type = button_pressrelease == GDK_BUTTON_PRESS ? ButtonPress : ButtonRelease;
xev.display = GDK_WINDOW_XDISPLAY (window);
xev.window = GDK_WINDOW_XID (window);
xev.root = RootWindow (xev.display, GDK_SCREEN_XNUMBER (screen));
xev.root = RootWindow (xev.display, GDK_SCREEN_X11 (screen)->screen_num);
xev.subwindow = 0;
xev.time = 0;
xev.x = x;
......
......@@ -27,8 +27,6 @@
#include "config.h"
#include "gdkvisualprivate.h"
#include "gdkx.h"
#include "gdkprivate-x11.h"
#include "gdkscreen-x11.h"
......
......@@ -29,16 +29,15 @@
#include "gdkwindow-x11.h"
#include "gdkx.h"
#include "gdkwindow.h"
#include "gdkwindowimpl.h"
#include "gdkasync.h"
#include "gdkdisplay-x11.h"
#include "gdkprivate-x11.h"
#include "gdkvisualprivate.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include "gdkasync.h"
#include "gdkeventsource.h"
#include "gdkdisplay-x11.h"
#include "gdkprivate-x11.h"
#include <stdlib.h>
#include <stdio.h>
......@@ -313,7 +312,7 @@ _gdk_x11_window_create_bitmap_surface (GdkWindow *window,
width, height, 1);
surface = cairo_xlib_surface_create_for_bitmap (GDK_WINDOW_XDISPLAY (window),
pixmap,
GDK_SCREEN_XSCREEN (GDK_WINDOW_SCREEN (window)),
GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (window))->xscreen,
width, height);
attach_free_pixmap_handler (surface, GDK_WINDOW_DISPLAY (window), pixmap);
......
......@@ -57,15 +57,16 @@ G_BEGIN_DECLS
Window gdk_x11_window_get_xid (GdkWindow *window);
void gdk_x11_window_set_user_time (GdkWindow *window,
guint32 timestamp);
void gdk_x11_window_move_to_current_desktop (GdkWindow *window);
Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor);
Display *gdk_x11_display_get_xdisplay (GdkDisplay *display);
Visual * gdk_x11_visual_get_xvisual (GdkVisual *visual);
Screen * gdk_x11_screen_get_xscreen (GdkScreen *screen);
int gdk_x11_screen_get_screen_number (GdkScreen *screen);
void gdk_x11_window_set_user_time (GdkWindow *window,
guint32 timestamp);
void gdk_x11_window_move_to_current_desktop (GdkWindow *window);
const char* gdk_x11_screen_get_window_manager_name (GdkScreen *screen);
......@@ -97,20 +98,16 @@ gint gdk_x11_get_default_screen (void);
#define GDK_IS_DISPLAY_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), g_type_from_name ("GdkDisplayX11")))
#ifdef GDK_COMPILATION
#include "gdkprivate-x11.h"
#include "gdkscreen-x11.h"
#ifndef GDK_MULTIHEAD_SAFE
/**
* GDK_DISPLAY_XDISPLAY:
* @display: a #GdkDisplay.
*
* Returns the display of a #GdkDisplay.
* GDK_ROOT_WINDOW:
*
* Returns: an Xlib <type>Display*</type>
* Obtains the Xlib window id of the root window of the current screen.
*/
#define GDK_DISPLAY_XDISPLAY(display) (GDK_DISPLAY_X11(display)->xdisplay)
#define GDK_ROOT_WINDOW() (gdk_x11_get_default_root_xwindow ())
#endif
#define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))
/**
* GDK_WINDOW_XDISPLAY:
......@@ -120,48 +117,36 @@ gint gdk_x11_get_default_screen (void);
*
* Returns: an Xlib <type>Display*</type>.
*/
#define GDK_WINDOW_XDISPLAY(win) (GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (win))->xdisplay)
#define GDK_WINDOW_XID(win) (GDK_WINDOW_IMPL_X11(GDK_WINDOW (win)->impl)->xid)
#define GDK_SCREEN_XDISPLAY(screen) (GDK_SCREEN_X11 (screen)->xdisplay)
#define GDK_WINDOW_XDISPLAY(win) (GDK_DISPLAY_XDISPLAY (gdk_window_get_display (win)))
/**
* GDK_SCREEN_XSCREEN:
* @screen: a #GdkScreen
* GDK_WINDOW_XID:
* @win: a #GdkWindow.
*
* Returns the screen of a #GdkScreen.
* Returns the X window belonging to a #GdkWindow.
*
* Returns: an Xlib <type>Screen*</type>.
* Returns: the Xlib <type>Window</type> of @win.
*/
#define GDK_SCREEN_XSCREEN(screen) (GDK_SCREEN_X11 (screen)->xscreen)
#define GDK_SCREEN_XNUMBER(screen) (GDK_SCREEN_X11 (screen)->screen_num)
#else /* GDK_COMPILATION */
#define GDK_WINDOW_XID(win) (gdk_x11_window_get_xid (win))
#ifndef GDK_MULTIHEAD_SAFE
/**
* GDK_ROOT_WINDOW:
* GDK_DISPLAY_XDISPLAY:
* @display: a #GdkDisplay.
*
* Obtains the Xlib window id of the root window of the current screen.
* Returns the display of a #GdkDisplay.
*
* Returns: an Xlib <type>Display*</type>
*/
#define GDK_ROOT_WINDOW() (gdk_x11_get_default_root_xwindow ())
#endif
#define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))
#define GDK_WINDOW_XDISPLAY(win) (GDK_DISPLAY_XDISPLAY (gdk_window_get_display (win)))
#define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
/**
* GDK_WINDOW_XID:
* @win: a #GdkWindow.
* GDK_SCREEN_XSCREEN:
* @screen: a #GdkScreen
*
* Returns the X window belonging to a #GdkWindow.
* Returns the screen of a #GdkScreen.
*
* Returns: the Xlib <type>Window</type> of @win.
* Returns: an Xlib <type>Screen*</type>.
*/
#define GDK_WINDOW_XID(win) (gdk_x11_window_get_xid (win))
#define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
#define GDK_SCREEN_XSCREEN(screen) (gdk_x11_screen_get_xscreen (screen))
/**
......@@ -175,8 +160,6 @@ gint gdk_x11_get_default_screen (void);
*/
#define GDK_SCREEN_XNUMBER(screen) (gdk_x11_screen_get_screen_number (screen))
#endif /* GDK_COMPILATION */
#define GDK_VISUAL_XVISUAL(visual) (gdk_x11_visual_get_xvisual (visual))
GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
......
......@@ -54,7 +54,7 @@
#endif
#include <gdkscreen-x11.h>
#include <gdkx.h>
#include <gdkprivate-x11.h>
static gint
parse_boolean (char *v)
......@@ -153,7 +153,6 @@ init_xft_settings (GdkScreen *screen)
{
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
Display *xdisplay = GDK_SCREEN_XDISPLAY (screen);
int xscreen = GDK_SCREEN_XNUMBER (screen);
double dpi_double;
if (screen_x11->xft_init)
......@@ -174,8 +173,8 @@ init_xft_settings (GdkScreen *screen)
screen_x11->xft_rgba = FC_RGBA_UNKNOWN;
if (!get_double_default (xdisplay, "dpi", &dpi_double))
dpi_double = (((double) DisplayHeight (xdisplay, xscreen) * 25.4) /
(double) DisplayHeightMM (xdisplay, xscreen));
dpi_double = (((double) DisplayHeight (xdisplay, screen_x11->screen_num) * 25.4) /
(double) DisplayHeightMM (xdisplay, screen_x11->screen_num));
screen_x11->xft_dpi = (int)(0.5 + PANGO_SCALE * dpi_double);
}
......
......@@ -26,7 +26,6 @@
#include "config.h"
#include "gdkx.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
......
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