forked from AuroraMiddleware/gtk
x11: Move code where it belongs
Instead of the display telling the screen to tell the visuals to tell the display to initialize itself, just init the display directly. What a concept.
This commit is contained in:
parent
f2b41e708d
commit
1347573139
@ -1335,22 +1335,6 @@ set_sm_client_id (GdkDisplay *display,
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "SM_CLIENT_ID"));
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_setup_window_visual (GdkDisplay *display,
|
||||
int depth,
|
||||
Visual *visual,
|
||||
Colormap colormap,
|
||||
gboolean rgba)
|
||||
{
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
display_x11->window_depth = depth;
|
||||
display_x11->window_visual = visual;
|
||||
display_x11->window_colormap = colormap;
|
||||
|
||||
gdk_display_set_rgba (display, rgba);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_x11_display_open:
|
||||
* @display_name: (nullable): name of the X display.
|
||||
@ -1416,7 +1400,27 @@ gdk_x11_display_open (const char *display_name)
|
||||
#endif
|
||||
|
||||
/* initialize the display's screens */
|
||||
display_x11->screen = _gdk_x11_screen_new (display, DefaultScreen (display_x11->xdisplay), TRUE);
|
||||
display_x11->screen = _gdk_x11_screen_new (display, DefaultScreen (display_x11->xdisplay));
|
||||
|
||||
if (display_x11->screen->rgba_visual)
|
||||
{
|
||||
Visual *xvisual = GDK_X11_VISUAL (display_x11->screen->rgba_visual)->xvisual;
|
||||
|
||||
display_x11->window_depth = display_x11->screen->rgba_visual->depth;
|
||||
display_x11->window_visual = xvisual;
|
||||
display_x11->window_colormap = XCreateColormap (xdisplay,
|
||||
DefaultRootWindow (xdisplay),
|
||||
xvisual,
|
||||
AllocNone);
|
||||
gdk_display_set_rgba (display, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
display_x11->window_depth = DefaultDepth (xdisplay, DefaultScreen (xdisplay)),
|
||||
display_x11->window_visual = DefaultVisual (xdisplay, DefaultScreen (xdisplay));
|
||||
display_x11->window_colormap = DefaultColormap (xdisplay, DefaultScreen (xdisplay));
|
||||
gdk_display_set_rgba (display, FALSE);
|
||||
}
|
||||
|
||||
/* We need to initialize events after we have the screen
|
||||
* structures in places
|
||||
@ -2010,7 +2014,7 @@ _gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
|
||||
if (gdk_x11_display_error_trap_pop (display) || !result)
|
||||
return NULL;
|
||||
|
||||
screen = _gdk_x11_screen_new (display, XScreenNumberOfScreen (attrs.screen), FALSE);
|
||||
screen = _gdk_x11_screen_new (display, XScreenNumberOfScreen (attrs.screen));
|
||||
|
||||
display_x11->screens = g_list_prepend (display_x11->screens, screen);
|
||||
|
||||
|
@ -55,11 +55,6 @@ typedef GdkFilterReturn (*GdkFilterFunc) (const XEvent *xevent,
|
||||
void _gdk_x11_error_handler_push (void);
|
||||
void _gdk_x11_error_handler_pop (void);
|
||||
|
||||
void gdk_display_setup_window_visual (GdkDisplay *display,
|
||||
int depth,
|
||||
Visual *visual,
|
||||
Colormap colormap,
|
||||
gboolean rgba);
|
||||
int gdk_x11_display_get_window_depth (GdkX11Display *display);
|
||||
Visual * gdk_x11_display_get_window_visual (GdkX11Display *display);
|
||||
Colormap gdk_x11_display_get_window_colormap (GdkX11Display *display);
|
||||
|
@ -866,8 +866,7 @@ init_multihead (GdkX11Screen *screen)
|
||||
|
||||
GdkX11Screen *
|
||||
_gdk_x11_screen_new (GdkDisplay *display,
|
||||
int screen_number,
|
||||
gboolean setup_display)
|
||||
int screen_number)
|
||||
{
|
||||
GdkX11Screen *x11_screen;
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
@ -898,7 +897,7 @@ _gdk_x11_screen_new (GdkDisplay *display,
|
||||
init_randr_support (x11_screen);
|
||||
init_multihead (x11_screen);
|
||||
|
||||
_gdk_x11_screen_init_visuals (x11_screen, setup_display);
|
||||
_gdk_x11_screen_init_visuals (x11_screen);
|
||||
|
||||
return x11_screen;
|
||||
}
|
||||
|
@ -94,8 +94,7 @@ struct _GdkX11ScreenClass
|
||||
|
||||
GType _gdk_x11_screen_get_type (void);
|
||||
GdkX11Screen *_gdk_x11_screen_new (GdkDisplay *display,
|
||||
int screen_number,
|
||||
gboolean setup_display);
|
||||
int screen_number);
|
||||
|
||||
void _gdk_x11_screen_window_manager_changed (GdkX11Screen *screen);
|
||||
void _gdk_x11_screen_size_changed (GdkX11Screen *screen,
|
||||
@ -120,8 +119,7 @@ _gdk_x11_screen_get_xft_setting (GdkX11Screen *screen,
|
||||
const char *name,
|
||||
GValue *value);
|
||||
|
||||
void _gdk_x11_screen_init_visuals (GdkX11Screen *screen,
|
||||
gboolean setup_display);
|
||||
void _gdk_x11_screen_init_visuals (GdkX11Screen *screen);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -50,8 +50,7 @@ gdk_x11_visual_class_init (GdkX11VisualClass *class)
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen,
|
||||
gboolean setup_display)
|
||||
_gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen)
|
||||
{
|
||||
static const int possible_depths[8] = { 32, 30, 24, 16, 15, 8, 4, 1 };
|
||||
static const GdkVisualType possible_types[6] =
|
||||
@ -254,33 +253,6 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen,
|
||||
* stereo and double buffering
|
||||
*/
|
||||
gdk_x11_screen_update_visuals_for_glx (x11_screen);
|
||||
|
||||
if (setup_display)
|
||||
{
|
||||
if (x11_screen->rgba_visual)
|
||||
{
|
||||
Visual *xvisual = GDK_X11_VISUAL (x11_screen->rgba_visual)->xvisual;
|
||||
Colormap colormap;
|
||||
|
||||
colormap = XCreateColormap (x11_screen->xdisplay,
|
||||
RootWindow (x11_screen->xdisplay, x11_screen->screen_num),
|
||||
xvisual,
|
||||
AllocNone);
|
||||
gdk_display_setup_window_visual (GDK_SCREEN_DISPLAY (x11_screen),
|
||||
x11_screen->rgba_visual->depth,
|
||||
GDK_X11_VISUAL (x11_screen->rgba_visual)->xvisual,
|
||||
colormap,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
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),
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*< private >
|
||||
|
Loading…
Reference in New Issue
Block a user