forked from AuroraMiddleware/gtk
x11: Stop using GdkScreen altogether
Derive GdkX11Screen directly from GObject, and remove the last remaining uses of GdkScreen.
This commit is contained in:
parent
2daa7d1a53
commit
8ced2c6478
@ -237,7 +237,7 @@ gdk_x11_device_core_warp (GdkDevice *device,
|
||||
GdkDisplay *display;
|
||||
Display *xdisplay;
|
||||
Window dest;
|
||||
GdkScreen *screen;
|
||||
GdkX11Screen *screen;
|
||||
|
||||
display = gdk_device_get_display (device);
|
||||
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
@ -245,8 +245,8 @@ gdk_x11_device_core_warp (GdkDevice *device,
|
||||
dest = GDK_SCREEN_XROOTWIN (screen);
|
||||
|
||||
XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
|
||||
round (x * GDK_X11_SCREEN (screen)->window_scale),
|
||||
round (y * GDK_X11_SCREEN (screen)->window_scale));
|
||||
round (x * screen->window_scale),
|
||||
round (y * screen->window_scale));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -260,7 +260,7 @@ gdk_x11_device_core_query_state (GdkDevice *device,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkScreen *screen;
|
||||
GdkX11Screen *screen;
|
||||
Window xwindow, w;
|
||||
Window xroot_window, xchild_window;
|
||||
int xroot_x, xroot_y, xwin_x, xwin_y;
|
||||
@ -272,7 +272,7 @@ gdk_x11_device_core_query_state (GdkDevice *device,
|
||||
if (window == NULL)
|
||||
{
|
||||
xwindow = GDK_SCREEN_XROOTWIN (screen);
|
||||
scale = GDK_X11_SCREEN (screen)->window_scale;
|
||||
scale = screen->window_scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -437,7 +437,7 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
|
||||
GdkDisplay *display;
|
||||
Display *xdisplay;
|
||||
GdkWindow *window;
|
||||
GdkScreen *screen;
|
||||
GdkX11Screen *screen;
|
||||
Window xwindow, root, child, last;
|
||||
int xroot_x, xroot_y, xwin_x, xwin_y;
|
||||
unsigned int xmask;
|
||||
|
@ -304,15 +304,15 @@ gdk_x11_device_xi2_warp (GdkDevice *device,
|
||||
{
|
||||
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
||||
GdkDisplay *display = gdk_device_get_display (device);
|
||||
GdkScreen *screen = GDK_X11_DISPLAY (display)->screen;
|
||||
GdkX11Screen *screen = GDK_X11_DISPLAY (display)->screen;
|
||||
Window dest = GDK_DISPLAY_XROOTWIN (display);
|
||||
|
||||
XIWarpPointer (GDK_SCREEN_XDISPLAY (screen),
|
||||
device_xi2->device_id,
|
||||
None, dest,
|
||||
0, 0, 0, 0,
|
||||
round (x * GDK_X11_SCREEN (screen)->window_scale),
|
||||
round (y * GDK_X11_SCREEN (screen)->window_scale));
|
||||
round (x * screen->window_scale),
|
||||
round (y * screen->window_scale));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -327,7 +327,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
|
||||
{
|
||||
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
||||
GdkDisplay *display;
|
||||
GdkScreen *default_screen;
|
||||
GdkX11Screen *default_screen;
|
||||
Window xroot_window, xchild_window, xwindow;
|
||||
gdouble xroot_x, xroot_y, xwin_x, xwin_y;
|
||||
XIButtonState button_state;
|
||||
@ -340,7 +340,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
|
||||
if (window == NULL)
|
||||
{
|
||||
xwindow = GDK_DISPLAY_XROOTWIN (display);
|
||||
scale = GDK_X11_SCREEN (default_screen)->window_scale;
|
||||
scale = default_screen->window_scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -499,7 +499,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
||||
GdkWindowImplX11 *impl;
|
||||
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
||||
GdkDisplay *display;
|
||||
GdkScreen *screen;
|
||||
GdkX11Screen *screen;
|
||||
Display *xdisplay;
|
||||
GdkWindow *window;
|
||||
Window xwindow, root, child, last = None;
|
||||
|
@ -2066,7 +2066,7 @@ gdk_x11_display_finalize (GObject *object)
|
||||
/* input GdkWindow list */
|
||||
g_list_free_full (display_x11->input_windows, g_free);
|
||||
|
||||
/* Free all GdkScreens */
|
||||
/* Free all GdkX11Screens */
|
||||
g_object_unref (display_x11->screen);
|
||||
g_list_free_full (display_x11->screens, g_object_unref);
|
||||
|
||||
@ -2142,7 +2142,7 @@ gdk_x11_lookup_xdisplay (Display *xdisplay)
|
||||
* Given the root window ID of one of the screen’s of a #GdkDisplay,
|
||||
* finds the screen.
|
||||
*
|
||||
* Returns: (transfer none): the #GdkScreen corresponding to
|
||||
* Returns: (transfer none): the #GdkX11Screen corresponding to
|
||||
* @xrootwin, or %NULL.
|
||||
**/
|
||||
GdkX11Screen *
|
||||
|
@ -561,7 +561,7 @@ static GdkWindowCache *
|
||||
gdk_window_cache_new (GdkDisplay *display)
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
GdkScreen *screen = GDK_X11_DISPLAY (display)->screen;
|
||||
GdkX11Screen *screen = GDK_X11_DISPLAY (display)->screen;
|
||||
Display *xdisplay = GDK_SCREEN_XDISPLAY (screen);
|
||||
Window xroot_window = GDK_DISPLAY_XROOTWIN (display);
|
||||
GdkChildInfoX11 *children;
|
||||
|
@ -783,7 +783,7 @@ gdk_x11_gl_context_init (GdkX11GLContext *self)
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_x11_screen_init_gl (GdkScreen *screen)
|
||||
gdk_x11_screen_init_gl (GdkX11Screen *screen)
|
||||
{
|
||||
GdkDisplay *display = GDK_SCREEN_DISPLAY (screen);
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
@ -805,7 +805,7 @@ gdk_x11_screen_init_gl (GdkScreen *screen)
|
||||
if (!glXQueryExtension (dpy, &error_base, &event_base))
|
||||
return FALSE;
|
||||
|
||||
screen_num = GDK_X11_SCREEN (screen)->screen_num;
|
||||
screen_num = screen->screen_num;
|
||||
|
||||
display_x11->have_glx = TRUE;
|
||||
|
||||
|
@ -54,7 +54,7 @@ struct _GdkX11GLContextClass
|
||||
GdkGLContextClass parent_class;
|
||||
};
|
||||
|
||||
gboolean gdk_x11_screen_init_gl (GdkScreen *screen);
|
||||
gboolean gdk_x11_screen_init_gl (GdkX11Screen *screen);
|
||||
GdkGLContext * gdk_x11_window_create_gl_context (GdkWindow *window,
|
||||
gboolean attached,
|
||||
GdkGLContext *share,
|
||||
|
@ -62,7 +62,7 @@ static void
|
||||
gdk_x11_monitor_get_workarea (GdkMonitor *monitor,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
GdkScreen *screen = GDK_X11_DISPLAY (monitor->display)->screen;
|
||||
GdkX11Screen *screen = GDK_X11_DISPLAY (monitor->display)->screen;
|
||||
GdkRectangle workarea;
|
||||
|
||||
gdk_monitor_get_geometry (monitor, dest);
|
||||
|
@ -58,7 +58,7 @@ enum
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (GdkX11Screen, gdk_x11_screen, GDK_TYPE_SCREEN)
|
||||
G_DEFINE_TYPE (GdkX11Screen, gdk_x11_screen, G_TYPE_OBJECT)
|
||||
|
||||
typedef struct _NetWmSupportedAtoms NetWmSupportedAtoms;
|
||||
|
||||
@ -119,7 +119,7 @@ gdk_x11_screen_finalize (GObject *object)
|
||||
|
||||
/**
|
||||
* gdk_x11_screen_get_monitor_output:
|
||||
* @screen: (type GdkX11Screen): a #GdkScreen
|
||||
* @screen: a #GdkX11Screen
|
||||
* @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
|
||||
*
|
||||
* Gets the XID of the specified output/monitor.
|
||||
@ -256,9 +256,9 @@ out:
|
||||
|
||||
/**
|
||||
* gdk_x11_screen_get_xscreen:
|
||||
* @screen: (type GdkX11Screen): a #GdkScreen
|
||||
* @screen: a #GdkX11Screen
|
||||
*
|
||||
* Returns the screen of a #GdkScreen.
|
||||
* Returns the screen of a #GdkX11Screen.
|
||||
*
|
||||
* Returns: (transfer none): an Xlib Screen*
|
||||
*
|
||||
@ -272,9 +272,9 @@ gdk_x11_screen_get_xscreen (GdkX11Screen *screen)
|
||||
|
||||
/**
|
||||
* gdk_x11_screen_get_screen_number:
|
||||
* @screen: (type GdkX11Screen): a #GdkScreen
|
||||
* @screen: a #GdkX11Screen
|
||||
*
|
||||
* Returns the index of a #GdkScreen.
|
||||
* Returns the index of a #GdkX11Screen.
|
||||
*
|
||||
* Returns: the position of @screen among the screens
|
||||
* of its display
|
||||
@ -1061,7 +1061,7 @@ fetch_net_wm_check_window (GdkX11Screen *x11_screen)
|
||||
|
||||
/**
|
||||
* gdk_x11_screen_supports_net_wm_hint:
|
||||
* @screen: (type GdkX11Screen): the relevant #GdkScreen.
|
||||
* @screen: the relevant #GdkX11Screen.
|
||||
* @property: a property atom.
|
||||
*
|
||||
* This function is specific to the X11 backend of GDK, and indicates
|
||||
@ -1074,7 +1074,7 @@ fetch_net_wm_check_window (GdkX11Screen *x11_screen)
|
||||
* is that your application can start up before the window manager
|
||||
* does when the user logs in, and before the window manager starts
|
||||
* gdk_x11_screen_supports_net_wm_hint() will return %FALSE for every property.
|
||||
* You can monitor the window_manager_changed signal on #GdkScreen to detect
|
||||
* You can monitor the window_manager_changed signal on #GdkX11Screen to detect
|
||||
* a window manager change.
|
||||
*
|
||||
* Returns: %TRUE if the window manager supports @property
|
||||
@ -1150,7 +1150,7 @@ gdk_x11_screen_supports_net_wm_hint (GdkX11Screen *x11_screen,
|
||||
|
||||
/**
|
||||
* gdk_x11_screen_get_window_manager_name:
|
||||
* @screen: (type GdkX11Screen): a #GdkScreen
|
||||
* @screen: a #GdkX11Screen
|
||||
*
|
||||
* Returns the name of the window manager for @screen.
|
||||
*
|
||||
@ -1270,7 +1270,7 @@ get_netwm_cardinal_property (GdkX11Screen *x11_screen,
|
||||
|
||||
/**
|
||||
* gdk_x11_screen_get_number_of_desktops:
|
||||
* @screen: (type GdkX11Screen): a #GdkScreen
|
||||
* @screen: a #GdkX11Screen
|
||||
*
|
||||
* Returns the number of workspaces for @screen when running under a
|
||||
* window manager that supports multiple workspaces, as described
|
||||
@ -1289,7 +1289,7 @@ gdk_x11_screen_get_number_of_desktops (GdkX11Screen *screen)
|
||||
|
||||
/**
|
||||
* gdk_x11_screen_get_current_desktop:
|
||||
* @screen: (type GdkX11Screen): a #GdkScreen
|
||||
* @screen: a #GdkX11Screen
|
||||
*
|
||||
* Returns the current workspace for @screen when running under a
|
||||
* window manager that supports multiple workspaces, as described
|
||||
|
@ -22,7 +22,6 @@
|
||||
#ifndef __GDK_X11_SCREEN__
|
||||
#define __GDK_X11_SCREEN__
|
||||
|
||||
#include "gdkscreenprivate.h"
|
||||
#include "gdkx11screen.h"
|
||||
#include "gdkx11visual.h"
|
||||
#include <X11/X.h>
|
||||
@ -34,7 +33,7 @@ typedef struct _GdkX11Monitor GdkX11Monitor;
|
||||
|
||||
struct _GdkX11Screen
|
||||
{
|
||||
GdkScreen parent_instance;
|
||||
GObject parent_instance;
|
||||
|
||||
GdkDisplay *display;
|
||||
Display *xdisplay;
|
||||
@ -90,7 +89,7 @@ struct _GdkX11Screen
|
||||
|
||||
struct _GdkX11ScreenClass
|
||||
{
|
||||
GdkScreenClass parent_class;
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* window_manager_changed) (GdkX11Screen *x11_screen);
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ gdk_x11_visual_class_init (GdkX11VisualClass *class)
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_x11_screen_init_visuals (GdkX11Screen *screen,
|
||||
_gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen,
|
||||
gboolean setup_display)
|
||||
{
|
||||
static const gint possible_depths[8] = { 32, 30, 24, 16, 15, 8, 4, 1 };
|
||||
@ -63,7 +63,6 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *screen,
|
||||
GDK_VISUAL_STATIC_GRAY
|
||||
};
|
||||
|
||||
GdkX11Screen *x11_screen;
|
||||
XVisualInfo *visual_list;
|
||||
XVisualInfo visual_template;
|
||||
GdkX11Visual *temp_visual;
|
||||
@ -73,9 +72,6 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *screen,
|
||||
int nvisuals;
|
||||
int i, j;
|
||||
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
nxvisuals = 0;
|
||||
visual_template.screen = x11_screen->screen_num;
|
||||
visual_list = XGetVisualInfo (x11_screen->xdisplay, VisualScreenMask, &visual_template, &nxvisuals);
|
||||
@ -268,7 +264,7 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *screen,
|
||||
RootWindow (x11_screen->xdisplay, x11_screen->screen_num),
|
||||
xvisual,
|
||||
AllocNone);
|
||||
gdk_display_setup_window_visual (GDK_SCREEN_DISPLAY (screen),
|
||||
gdk_display_setup_window_visual (GDK_SCREEN_DISPLAY (x11_screen),
|
||||
x11_screen->rgba_visual->depth,
|
||||
GDK_X11_VISUAL (x11_screen->rgba_visual)->xvisual,
|
||||
colormap,
|
||||
@ -276,7 +272,7 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *screen,
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_display_setup_window_visual (GDK_SCREEN_DISPLAY (screen),
|
||||
gdk_display_setup_window_visual (GDK_SCREEN_DISPLAY (x11_screen),
|
||||
DefaultDepth (x11_screen->xdisplay, x11_screen->screen_num),
|
||||
DefaultVisual (x11_screen->xdisplay, x11_screen->screen_num),
|
||||
DefaultColormap (x11_screen->xdisplay, x11_screen->screen_num),
|
||||
@ -287,7 +283,7 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *screen,
|
||||
|
||||
/**
|
||||
* gdk_x11_screen_lookup_visual:
|
||||
* @screen: (type GdkX11Screen): a #GdkScreen.
|
||||
* @screen: a #GdkX11Screen.
|
||||
* @xvisualid: an X Visual ID.
|
||||
*
|
||||
* Looks up the #GdkVisual for a particular screen and X Visual ID.
|
||||
@ -298,13 +294,10 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *screen,
|
||||
* Since: 2.2
|
||||
*/
|
||||
GdkX11Visual *
|
||||
gdk_x11_screen_lookup_visual (GdkScreen *screen,
|
||||
gdk_x11_screen_lookup_visual (GdkX11Screen *x11_screen,
|
||||
VisualID xvisualid)
|
||||
{
|
||||
int i;
|
||||
GdkX11Screen *x11_screen;
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
for (i = 0; i < x11_screen->nvisuals; i++)
|
||||
if (xvisualid == GDK_X11_VISUAL (x11_screen->visuals[i])->xvisual->visualid)
|
||||
|
@ -1740,8 +1740,7 @@ static guint32
|
||||
get_netwm_cardinal_property (GdkWindow *window,
|
||||
const gchar *name)
|
||||
{
|
||||
GdkScreen *screen = GDK_WINDOW_SCREEN (window);
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
GdkX11Screen *x11_screen = GDK_WINDOW_SCREEN (window);
|
||||
GdkAtom atom;
|
||||
guint32 prop = 0;
|
||||
Atom type;
|
||||
@ -1752,7 +1751,7 @@ get_netwm_cardinal_property (GdkWindow *window,
|
||||
|
||||
atom = gdk_atom_intern_static_string (name);
|
||||
|
||||
if (!gdk_x11_screen_supports_net_wm_hint (screen, atom))
|
||||
if (!gdk_x11_screen_supports_net_wm_hint (x11_screen, atom))
|
||||
return 0;
|
||||
|
||||
XGetWindowProperty (x11_screen->xdisplay,
|
||||
|
@ -30,6 +30,7 @@
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/x11/gdkx11screen.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
@ -65,8 +66,8 @@ Visual * gdk_x11_visual_get_xvisual (GdkX11Visual *visual);
|
||||
#define GDK_VISUAL_XVISUAL(visual) (gdk_x11_visual_get_xvisual (visual))
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkX11Visual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
|
||||
VisualID xvisualid);
|
||||
GdkX11Visual* gdk_x11_screen_lookup_visual (GdkX11Screen *screen,
|
||||
VisualID xvisualid);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user