| 1 |
/* Clutter. |
| 2 |
* An OpenGL based 'interactive canvas' library. |
| 3 |
* Authored By Matthew Allum <[email protected]> |
| 4 |
* Copyright (C) 2006-2007 OpenedHand |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
* |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifdef HAVE_CONFIG_H |
| 23 |
#include "config.h" |
| 24 |
#endif |
| 25 |
|
| 26 |
#define CLUTTER_ENABLE_EXPERIMENTAL_API |
| 27 |
|
| 28 |
#include <glib/gi18n-lib.h> |
| 29 |
|
| 30 |
#include <string.h> |
| 31 |
#ifdef HAVE_UNISTD_H |
| 32 |
#include <unistd.h> |
| 33 |
#endif |
| 34 |
#include <sys/stat.h> |
| 35 |
#include <sys/types.h> |
| 36 |
#include <fcntl.h> |
| 37 |
#include <errno.h> |
| 38 |
|
| 39 |
#include <gdk/gdk.h> |
| 40 |
#include <cogl/cogl.h> |
| 41 |
|
| 42 |
#ifndef GDK_WINDOWING_WIN32 |
| 43 |
#include <sys/ioctl.h> |
| 44 |
#endif |
| 45 |
|
| 46 |
#if defined(GDK_WINDOWING_X11) && defined(COGL_HAS_XLIB_SUPPORT) |
| 47 |
#include <cogl/cogl-xlib.h> |
| 48 |
#endif |
| 49 |
|
| 50 |
#if defined(GDK_WINDOWING_WAYLAND) && defined(COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) |
| 51 |
#include <cogl/cogl-wayland-client.h> |
| 52 |
#endif |
| 53 |
|
| 54 |
#ifdef GDK_WINDOWING_X11 |
| 55 |
#include <gdk/gdkx.h> |
| 56 |
#endif |
| 57 |
|
| 58 |
#ifdef GDK_WINDOWING_WAYLAND |
| 59 |
#include <gdk/gdkwayland.h> |
| 60 |
#endif |
| 61 |
|
| 62 |
#ifdef GDK_WINDOWING_WIN32 |
| 63 |
#include <gdk/gdkwin32.h> |
| 64 |
#endif |
| 65 |
|
| 66 |
#include "clutter-backend-gdk.h" |
| 67 |
#include "clutter-device-manager-gdk.h" |
| 68 |
#include "clutter-settings-gdk.h" |
| 69 |
#include "clutter-stage-gdk.h" |
| 70 |
#include "clutter-gdk.h" |
| 71 |
|
| 72 |
#include "clutter-backend.h" |
| 73 |
#include "clutter-debug.h" |
| 74 |
#include "clutter-device-manager-private.h" |
| 75 |
#include "clutter-event-private.h" |
| 76 |
#include "clutter-main.h" |
| 77 |
#include "clutter-private.h" |
| 78 |
#include "clutter-settings-private.h" |
| 79 |
|
| 80 |
G_DEFINE_TYPE (ClutterBackendGdk, clutter_backend_gdk, CLUTTER_TYPE_BACKEND); |
| 81 |
|
| 82 |
/* global for pre init setup calls */ |
| 83 |
static GdkDisplay *_foreign_dpy = NULL; |
| 84 |
|
| 85 |
static gboolean disable_event_retrieval = FALSE; |
| 86 |
|
| 87 |
static void |
| 88 |
clutter_backend_gdk_init_settings (ClutterBackendGdk *backend_gdk) |
| 89 |
{ |
| 90 |
ClutterSettings *settings = clutter_settings_get_default (); |
| 91 |
int i; |
| 92 |
|
| 93 |
for (i = 0; i < G_N_ELEMENTS (_clutter_settings_map); i++) |
| 94 |
{ |
| 95 |
GValue val = G_VALUE_INIT; |
| 96 |
|
| 97 |
g_value_init (&val, CLUTTER_SETTING_TYPE(i)); |
| 98 |
if (gdk_screen_get_setting (backend_gdk->screen, |
| 99 |
CLUTTER_SETTING_GDK_NAME (i), |
| 100 |
&val)) |
| 101 |
{ |
| 102 |
clutter_settings_set_property_internal (settings, |
| 103 |
CLUTTER_SETTING_PROPERTY (i), |
| 104 |
&val); |
| 105 |
} |
| 106 |
g_value_unset (&val); |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
void |
| 111 |
_clutter_backend_gdk_update_setting (ClutterBackendGdk *backend_gdk, |
| 112 |
const gchar *setting_name) |
| 113 |
{ |
| 114 |
ClutterSettings *settings = clutter_settings_get_default (); |
| 115 |
int i; |
| 116 |
|
| 117 |
for (i = 0; i < G_N_ELEMENTS (_clutter_settings_map); i++) |
| 118 |
{ |
| 119 |
if (g_strcmp0 (CLUTTER_SETTING_GDK_NAME (i), setting_name) == 0) |
| 120 |
{ |
| 121 |
GValue val = G_VALUE_INIT; |
| 122 |
|
| 123 |
g_value_init (&val, CLUTTER_SETTING_TYPE (i)); |
| 124 |
gdk_screen_get_setting (backend_gdk->screen, |
| 125 |
CLUTTER_SETTING_GDK_NAME (i), |
| 126 |
&val); |
| 127 |
clutter_settings_set_property_internal (settings, |
| 128 |
CLUTTER_SETTING_PROPERTY (i), |
| 129 |
&val); |
| 130 |
g_value_unset (&val); |
| 131 |
|
| 132 |
break; |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
static GdkFilterReturn |
| 138 |
cogl_gdk_filter (GdkXEvent *xevent, |
| 139 |
GdkEvent *event, |
| 140 |
gpointer data) |
| 141 |
{ |
| 142 |
#ifdef GDK_WINDOWING_X11 |
| 143 |
ClutterBackend *backend = data; |
| 144 |
CoglFilterReturn ret; |
| 145 |
|
| 146 |
ret = cogl_xlib_renderer_handle_event (backend->cogl_renderer, (XEvent *) xevent); |
| 147 |
switch (ret) |
| 148 |
{ |
| 149 |
case COGL_FILTER_REMOVE: |
| 150 |
return GDK_FILTER_REMOVE; |
| 151 |
|
| 152 |
case COGL_FILTER_CONTINUE: |
| 153 |
default: |
| 154 |
return GDK_FILTER_CONTINUE; |
| 155 |
} |
| 156 |
#endif |
| 157 |
|
| 158 |
return GDK_FILTER_CONTINUE; |
| 159 |
} |
| 160 |
|
| 161 |
static gboolean |
| 162 |
_clutter_backend_gdk_post_parse (ClutterBackend *backend, |
| 163 |
GError **error) |
| 164 |
{ |
| 165 |
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend); |
| 166 |
|
| 167 |
if (_foreign_dpy != NULL) |
| 168 |
backend_gdk->display = _foreign_dpy; |
| 169 |
|
| 170 |
/* Init Gdk, if outside code did not already */ |
| 171 |
if (!gdk_init_check (NULL, NULL)) |
| 172 |
{ |
| 173 |
g_set_error (error, CLUTTER_INIT_ERROR, CLUTTER_INIT_ERROR_BACKEND, |
| 174 |
_("Could not initialize Gdk")); |
| 175 |
return FALSE; |
| 176 |
} |
| 177 |
|
| 178 |
/* |
| 179 |
* Only open connection if not already set by prior call to |
| 180 |
* clutter_gdk_set_display() |
| 181 |
*/ |
| 182 |
if (backend_gdk->display == NULL) |
| 183 |
backend_gdk->display = g_object_ref (gdk_display_get_default ()); |
| 184 |
|
| 185 |
g_assert (backend_gdk->display != NULL); |
| 186 |
|
| 187 |
backend_gdk->screen = gdk_display_get_default_screen (backend_gdk->display); |
| 188 |
|
| 189 |
/* add event filter for Cogl events */ |
| 190 |
gdk_window_add_filter (NULL, cogl_gdk_filter, backend_gdk); |
| 191 |
|
| 192 |
clutter_backend_gdk_init_settings (backend_gdk); |
| 193 |
|
| 194 |
CLUTTER_NOTE (BACKEND, |
| 195 |
"Gdk Display '%s' opened", |
| 196 |
gdk_display_get_name (backend_gdk->display)); |
| 197 |
|
| 198 |
return TRUE; |
| 199 |
} |
| 200 |
|
| 201 |
static void |
| 202 |
gdk_event_handler (GdkEvent *event, |
| 203 |
gpointer user_data) |
| 204 |
{ |
| 205 |
clutter_gdk_handle_event (event); |
| 206 |
} |
| 207 |
|
| 208 |
void |
| 209 |
_clutter_backend_gdk_events_init (ClutterBackend *backend) |
| 210 |
{ |
| 211 |
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend); |
| 212 |
|
| 213 |
CLUTTER_NOTE (EVENT, "initialising the event loop"); |
| 214 |
|
| 215 |
backend->device_manager = |
| 216 |
g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_GDK, |
| 217 |
"backend", backend, |
| 218 |
"gdk-display", backend_gdk->display, |
| 219 |
NULL); |
| 220 |
|
| 221 |
if (!disable_event_retrieval) |
| 222 |
gdk_event_handler_set (gdk_event_handler, NULL, NULL); |
| 223 |
} |
| 224 |
|
| 225 |
static void |
| 226 |
clutter_backend_gdk_finalize (GObject *gobject) |
| 227 |
{ |
| 228 |
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (gobject); |
| 229 |
|
| 230 |
gdk_window_remove_filter (NULL, cogl_gdk_filter, backend_gdk); |
| 231 |
g_object_unref (backend_gdk->display); |
| 232 |
|
| 233 |
G_OBJECT_CLASS (clutter_backend_gdk_parent_class)->finalize (gobject); |
| 234 |
} |
| 235 |
|
| 236 |
static void |
| 237 |
clutter_backend_gdk_dispose (GObject *gobject) |
| 238 |
{ |
| 239 |
G_OBJECT_CLASS (clutter_backend_gdk_parent_class)->dispose (gobject); |
| 240 |
} |
| 241 |
|
| 242 |
static ClutterFeatureFlags |
| 243 |
clutter_backend_gdk_get_features (ClutterBackend *backend) |
| 244 |
{ |
| 245 |
ClutterBackendClass *parent_class; |
| 246 |
|
| 247 |
parent_class = CLUTTER_BACKEND_CLASS (clutter_backend_gdk_parent_class); |
| 248 |
|
| 249 |
return parent_class->get_features (backend) |
| 250 |
| CLUTTER_FEATURE_STAGE_USER_RESIZE |
| 251 |
| CLUTTER_FEATURE_STAGE_CURSOR; |
| 252 |
} |
| 253 |
|
| 254 |
static CoglRenderer * |
| 255 |
clutter_backend_gdk_get_renderer (ClutterBackend *backend, |
| 256 |
GError **error) |
| 257 |
{ |
| 258 |
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend); |
| 259 |
CoglRenderer *renderer = cogl_renderer_new (); |
| 260 |
|
| 261 |
#if defined(GDK_WINDOWING_X11) && defined(COGL_HAS_XLIB_SUPPORT) |
| 262 |
if (GDK_IS_X11_DISPLAY (backend_gdk->display)) |
| 263 |
{ |
| 264 |
Display *xdisplay = gdk_x11_display_get_xdisplay (backend_gdk->display); |
| 265 |
|
| 266 |
cogl_xlib_renderer_set_foreign_display (renderer, xdisplay); |
| 267 |
} |
| 268 |
else |
| 269 |
#endif |
| 270 |
#if defined(GDK_WINDOWING_WAYLAND) && defined(COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) |
| 271 |
if (GDK_IS_WAYLAND_DISPLAY (backend_gdk->display)) |
| 272 |
{ |
| 273 |
struct wl_display *display = gdk_wayland_display_get_wl_display (backend_gdk->display); |
| 274 |
|
| 275 |
/* Force a Wayland winsys */ |
| 276 |
cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_EGL_WAYLAND); |
| 277 |
cogl_wayland_renderer_set_foreign_display (renderer, display); |
| •278 |
cogl_wayland_renderer_set_event_dispatch_enabled (renderer, FALSE); |
| 279 |
} |
| 280 |
else |
| 281 |
#endif |
| 282 |
#if defined(GDK_WINDOWING_WIN32) |
| 283 |
if (GDK_IS_WIN32_DISPLAY (backend_gdk->display)) |
| 284 |
{ |
| 285 |
/* Force a WGL winsys on windows */ |
| 286 |
cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_WGL); |
| 287 |
cogl_win32_renderer_set_event_retrieval_enabled (renderer, FALSE); |
| 288 |
} |
| 289 |
else |
| 290 |
#endif |
| 291 |
{ |
| 292 |
g_set_error (error, CLUTTER_INIT_ERROR, |
| 293 |
CLUTTER_INIT_ERROR_BACKEND, |
| 294 |
_("Could not find a suitable CoglWinsys for a GdkDisplay of type %s"), |
| 295 |
G_OBJECT_TYPE_NAME (backend_gdk->display)); |
| 296 |
cogl_object_unref (renderer); |
| 297 |
|
| 298 |
return NULL; |
| 299 |
} |
| 300 |
|
| 301 |
return renderer; |
| 302 |
} |
| 303 |
|
| 304 |
static CoglDisplay * |
| 305 |
clutter_backend_gdk_get_display (ClutterBackend *backend, |
| 306 |
CoglRenderer *renderer, |
| 307 |
CoglSwapChain *swap_chain, |
| 308 |
GError **error) |
| 309 |
{ |
| 310 |
ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend); |
| 311 |
CoglOnscreenTemplate *onscreen_template; |
| 312 |
GError *internal_error = NULL; |
| 313 |
CoglDisplay *display; |
| 314 |
gboolean has_rgba_visual; |
| 315 |
gboolean res; |
| 316 |
|
| 317 |
/* We default to an RGBA visual if there is one */ |
| 318 |
has_rgba_visual = gdk_screen_get_rgba_visual (backend_gdk->screen) != NULL; |
| 319 |
|
| 320 |
CLUTTER_NOTE (BACKEND, "Alpha on Cogl swap chain: %s", |
| 321 |
has_rgba_visual ? "enabled" : "disabled"); |
| 322 |
|
| 323 |
cogl_swap_chain_set_has_alpha (swap_chain, has_rgba_visual); |
| 324 |
|
| 325 |
onscreen_template = cogl_onscreen_template_new (swap_chain); |
| 326 |
|
| 327 |
res = cogl_renderer_check_onscreen_template (renderer, |
| 328 |
onscreen_template, |
| 329 |
&internal_error); |
| 330 |
if (!res && has_rgba_visual) |
| 331 |
{ |
| 332 |
CLUTTER_NOTE (BACKEND, |
| 333 |
"Creation of a context with a ARGB visual failed: %s", |
| 334 |
internal_error != NULL ? internal_error->message |
| 335 |
: "Unknown reason"); |
| 336 |
|
| 337 |
g_clear_error (&internal_error); |
| 338 |
|
| 339 |
/* It's possible that the current renderer doesn't support transparency |
| 340 |
* in a swap_chain so lets see if we can fallback to not having any |
| 341 |
* transparency... |
| 342 |
* |
| 343 |
* XXX: It might be nice to have a CoglRenderer feature we could |
| 344 |
* explicitly check for ahead of time. |
| 345 |
*/ |
| 346 |
cogl_swap_chain_set_has_alpha (swap_chain, FALSE); |
| 347 |
res = cogl_renderer_check_onscreen_template (renderer, |
| 348 |
onscreen_template, |
| 349 |
&internal_error); |
| 350 |
} |
| 351 |
|
| 352 |
if (!res) |
| 353 |
{ |
| 354 |
g_set_error_literal (error, CLUTTER_INIT_ERROR, |
| 355 |
CLUTTER_INIT_ERROR_BACKEND, |
| 356 |
internal_error->message); |
| 357 |
|
| 358 |
g_error_free (internal_error); |
| 359 |
cogl_object_unref (onscreen_template); |
| 360 |
|
| 361 |
return NULL; |
| 362 |
} |
| 363 |
|
| 364 |
display = cogl_display_new (renderer, onscreen_template); |
| 365 |
cogl_object_unref (onscreen_template); |
| 366 |
|
| 367 |
return display; |
| 368 |
} |
| 369 |
|
| 370 |
static void |
| 371 |
clutter_backend_gdk_class_init (ClutterBackendGdkClass *klass) |
| 372 |
{ |
| 373 |
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 374 |
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass); |
| 375 |
|
| 376 |
gobject_class->dispose = clutter_backend_gdk_dispose; |
| 377 |
gobject_class->finalize = clutter_backend_gdk_finalize; |
| 378 |
|
| 379 |
backend_class->stage_window_type = CLUTTER_TYPE_STAGE_GDK; |
| 380 |
|
| 381 |
backend_class->post_parse = _clutter_backend_gdk_post_parse; |
| 382 |
|
| 383 |
backend_class->get_features = clutter_backend_gdk_get_features; |
| 384 |
|
| 385 |
backend_class->get_renderer = clutter_backend_gdk_get_renderer; |
| 386 |
backend_class->get_display = clutter_backend_gdk_get_display; |
| 387 |
} |
| 388 |
|
| 389 |
static void |
| 390 |
clutter_backend_gdk_init (ClutterBackendGdk *backend_gdk) |
| 391 |
{ |
| 392 |
/* Deactivate sync to vblank since we have the GdkFrameClock to |
| 393 |
* drive us from the compositor. |
| 394 |
*/ |
| 395 |
_clutter_set_sync_to_vblank (FALSE); |
| 396 |
} |
| 397 |
|
| 398 |
ClutterBackend * |
| 399 |
clutter_backend_gdk_new (void) |
| 400 |
{ |
| 401 |
return g_object_new (CLUTTER_TYPE_BACKEND_GDK, NULL); |
| 402 |
} |
| 403 |
|
| 404 |
/** |
| 405 |
* clutter_gdk_get_default_display: |
| 406 |
* |
| 407 |
* Retrieves the pointer to the default display. |
| 408 |
* |
| 409 |
* Return value: (transfer none): the default display |
| 410 |
* |
| 411 |
* Since: 0.6 |
| 412 |
*/ |
| 413 |
GdkDisplay * |
| 414 |
clutter_gdk_get_default_display (void) |
| 415 |
{ |
| 416 |
ClutterBackend *backend = clutter_get_default_backend (); |
| 417 |
|
| 418 |
if (backend == NULL) |
| 419 |
{ |
| 420 |
g_critical ("The Clutter backend has not been initialised"); |
| 421 |
return NULL; |
| 422 |
} |
| 423 |
|
| 424 |
if (!CLUTTER_IS_BACKEND_GDK (backend)) |
| 425 |
{ |
| 426 |
g_critical ("The Clutter backend is not a GDK backend"); |
| 427 |
return NULL; |
| 428 |
} |
| 429 |
|
| 430 |
return CLUTTER_BACKEND_GDK (backend)->display; |
| 431 |
} |
| 432 |
|
| 433 |
/** |
| 434 |
* clutter_gdk_set_display: |
| 435 |
* @display: pointer to a GDK display connection. |
| 436 |
* |
| 437 |
* Sets the display connection Clutter should use; must be called |
| 438 |
* before clutter_init(), clutter_init_with_args() or other functions |
| 439 |
* pertaining Clutter's initialization process. |
| 440 |
* |
| 441 |
* If you are parsing the command line arguments by retrieving Clutter's |
| 442 |
* #GOptionGroup with clutter_get_option_group() and calling |
| 443 |
* g_option_context_parse() yourself, you should also call |
| 444 |
* clutter_gdk_set_display() before g_option_context_parse(). |
| 445 |
* |
| 446 |
* Since: 0.8 |
| 447 |
*/ |
| 448 |
void |
| 449 |
clutter_gdk_set_display (GdkDisplay *display) |
| 450 |
{ |
| 451 |
if (_clutter_context_is_initialized ()) |
| 452 |
{ |
| 453 |
g_warning ("%s() can only be used before calling clutter_init()", |
| 454 |
G_STRFUNC); |
| 455 |
return; |
| 456 |
} |
| 457 |
|
| 458 |
_foreign_dpy = g_object_ref (display); |
| 459 |
} |
| 460 |
|
| 461 |
/** |
| 462 |
* clutter_gdk_disable_event_retrieval: |
| 463 |
* |
| 464 |
* Disable the event retrieval in Clutter. |
| 465 |
* |
| 466 |
* Callers of this function have to set up an event filter using the |
| 467 |
* GDK API, and call clutter_gdk_handle_event(). |
| 468 |
* |
| 469 |
* This function should only be used when embedding Clutter into |
| 470 |
* a GDK based toolkit. |
| 471 |
* |
| 472 |
* Since: 1.10 |
| 473 |
*/ |
| 474 |
void |
| 475 |
clutter_gdk_disable_event_retrieval (void) |
| 476 |
{ |
| 477 |
if (_clutter_context_is_initialized ()) |
| 478 |
{ |
| 479 |
g_warning ("%s() can only be used before calling clutter_init()", |
| 480 |
G_STRFUNC); |
| 481 |
return; |
| 482 |
} |
| 483 |
|
| 484 |
disable_event_retrieval = TRUE; |
| 485 |
} |
| 486 |
|
| 487 |
/** |
| 488 |
* clutter_gdk_get_visual: |
| 489 |
* |
| 490 |
* Retrieves the #GdkVisual used by Clutter. |
| 491 |
* |
| 492 |
* This function should be used when embedding Clutter inside GDK-based |
| 493 |
* foreign toolkits, to ensure that the visual applied to the #GdkWindow |
| 494 |
* used to render the #ClutterStage is the correct one. |
| 495 |
* |
| 496 |
* Returns: (transfer none): a #GdkVisual instance |
| 497 |
* |
| 498 |
* Since: 1.22 |
| 499 |
*/ |
| 500 |
GdkVisual * |
| 501 |
clutter_gdk_get_visual (void) |
| 502 |
{ |
| 503 |
ClutterBackend *backend = clutter_get_default_backend (); |
| 504 |
GdkScreen *screen; |
| 505 |
|
| 506 |
if (backend == NULL) |
| 507 |
{ |
| 508 |
g_critical ("The Clutter backend has not been initialised"); |
| 509 |
return NULL; |
| 510 |
} |
| 511 |
|
| 512 |
if (!CLUTTER_IS_BACKEND_GDK (backend)) |
| 513 |
{ |
| 514 |
g_critical ("The Clutter backend is not a GDK backend"); |
| 515 |
return NULL; |
| 516 |
} |
| 517 |
|
| 518 |
screen = CLUTTER_BACKEND_GDK (backend)->screen; |
| 519 |
g_assert (screen != NULL); |
| 520 |
|
| 521 |
#if defined(GDK_WINDOWING_X11) && defined(COGL_HAS_XLIB_SUPPORT) |
| 522 |
if (GDK_IS_X11_SCREEN (screen)) |
| 523 |
{ |
| 524 |
XVisualInfo *xvisinfo = cogl_xlib_renderer_get_visual_info (backend->cogl_renderer); |
| 525 |
if (xvisinfo != NULL) |
| 526 |
return gdk_x11_screen_lookup_visual (screen, xvisinfo->visualid); |
| 527 |
} |
| 528 |
#endif |
| 529 |
|
| 530 |
if (gdk_screen_get_rgba_visual (screen) != NULL) |
| 531 |
return gdk_screen_get_rgba_visual (screen); |
| 532 |
|
| 533 |
return gdk_screen_get_system_visual (screen); |
| 534 |
} |