MCPcopy Create free account
hub / github.com/crownengine/crown / init

Method init

src/device/main_linux.cpp:1448–1532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1446 }
1447
1448 int init() override
1449 {
1450 x11_lib = os::library_open("libX11.so.6");
1451#define DL_IMPORT_FUNC(func_name, return_type, params) \
1452 func_name = (PROTO_ ## func_name)os::library_symbol(x11_lib, # func_name); \
1453 CE_ENSURE(func_name != NULL);
1454
1455 X11_IMPORT();
1456
1457#undef DL_IMPORT_FUNC
1458
1459 xrandr_lib = os::library_open("libXrandr.so.2");
1460#define DL_IMPORT_FUNC(func_name, return_type, params) \
1461 func_name = (PROTO_ ## func_name)os::library_symbol(xrandr_lib, # func_name); \
1462 CE_ENSURE(func_name != NULL);
1463
1464 XRR_IMPORT();
1465
1466#undef DL_IMPORT_FUNC
1467
1468 // http://tronche.com/gui/x/xlib/display/XInitThreads.html
1469 Status xs = XInitThreads();
1470 CE_ASSERT(xs != 0, "XInitThreads: error");
1471 CE_UNUSED(xs);
1472
1473 display = XOpenDisplay(NULL);
1474 CE_ASSERT(display != NULL, "XOpenDisplay: error");
1475 display_fd = ConnectionNumber(display);
1476
1477 int dummy_ret;
1478 char xwayland_ext[] = "XWAYLAND";
1479 xwayland = XQueryExtension(display, xwayland_ext, &dummy_ret, &dummy_ret, &dummy_ret);
1480
1481 root_window = RootWindow(display, DefaultScreen(display));
1482
1483 // Do we have detectable autorepeat?
1484 Bool detectable;
1485 detectable_autorepeat = (bool)XkbSetDetectableAutoRepeat(display, true, &detectable);
1486
1487 wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
1488 net_wm_state = XInternAtom(display, "_NET_WM_STATE", False);
1489 net_wm_state_maximized_horz = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
1490 net_wm_state_maximized_vert = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
1491 net_wm_state_fullscreen = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);
1492 net_wm_state_above = XInternAtom(display, "_NET_WM_STATE_ABOVE", False);
1493
1494 // Save screen configuration
1495 screen_config = XRRGetScreenInfo(display, root_window);
1496
1497 rr_old_sizeid = XRRConfigCurrentConfiguration(screen_config, &rr_old_rot);
1498
1499 im = XOpenIM(display, NULL, NULL, NULL);
1500 CE_ASSERT(im != NULL, "XOpenIM: error");
1501
1502 ic = XCreateIC(im
1503 , XNInputStyle
1504 , 0
1505 | XIMPreeditNothing

Callers 1

runMethod · 0.45

Calls 1

library_openFunction · 0.85

Tested by

no test coverage detected