Lines Matching refs:HostX
90 static EphyrHostXVars HostX; variable
107 rep = xcb_get_extension_data(HostX.conn, extension); in hostx_has_extension()
115 #define host_depth_matches_server(_vars) (HostX.depth == (_vars)->server_depth)
124 HostX.use_fullscreen == TRUE)) { in hostx_want_screen_geometry()
139 int index = HostX.n_screens; in hostx_add_screen()
141 HostX.n_screens += 1; in hostx_add_screen()
142 HostX.screens = reallocarray(HostX.screens, in hostx_add_screen()
143 HostX.n_screens, sizeof(HostX.screens[0])); in hostx_add_screen()
144 HostX.screens[index] = screen; in hostx_add_screen()
155 HostX.server_dpy_name = strdup(name); in hostx_set_display_name()
178 xcb_icccm_set_wm_name(HostX.conn, in hostx_set_win_title()
190 HostX.server_dpy_name ? HostX.server_dpy_name : ":0", in hostx_set_win_title()
193 xcb_icccm_set_wm_name(HostX.conn, in hostx_set_win_title()
199 xcb_flush(HostX.conn); in hostx_set_win_title()
206 return !HostX.use_sw_cursor; in hostx_want_host_cursor()
212 HostX.use_sw_cursor = TRUE; in hostx_use_sw_cursor()
218 return HostX.empty_cursor; in hostx_get_empty_cursor()
260 version_c = xcb_randr_query_version(HostX.conn, 1, 2); in hostx_get_output_geometry()
261 version_r = xcb_randr_query_version_reply(HostX.conn, in hostx_get_output_geometry()
280 screen_resources_c = xcb_randr_get_screen_resources(HostX.conn, in hostx_get_output_geometry()
281 HostX.winroot); in hostx_get_output_geometry()
282 screen_resources_r = xcb_randr_get_screen_resources_reply(HostX.conn, in hostx_get_output_geometry()
290 output_info_c = xcb_randr_get_output_info(HostX.conn, in hostx_get_output_geometry()
293 output_info_r = xcb_randr_get_output_info_reply(HostX.conn, in hostx_get_output_geometry()
318 crtc_info_c = xcb_randr_get_crtc_info(HostX.conn, in hostx_get_output_geometry()
321 crtc_info_r = xcb_randr_get_crtc_info_reply(HostX.conn, in hostx_get_output_geometry()
350 HostX.use_fullscreen = TRUE; in hostx_use_fullscreen()
356 return HostX.use_fullscreen; in hostx_want_fullscreen()
369 reply = xcb_intern_atom_reply(HostX.conn, cookie_WINDOW_STATE, NULL); in hostx_set_fullscreen_hint()
373 reply = xcb_intern_atom_reply(HostX.conn, cookie_WINDOW_STATE_FULLSCREEN, in hostx_set_fullscreen_hint()
378 for (index = 0; index < HostX.n_screens; index++) { in hostx_set_fullscreen_hint()
379 EphyrScrPriv *scrpriv = HostX.screens[index]->driver; in hostx_set_fullscreen_hint()
380 xcb_change_property(HostX.conn, in hostx_set_fullscreen_hint()
427 HostX.have_shm = FALSE; in hostx_init_shm()
433 HostX.have_shm = TRUE; in hostx_init_shm()
434 HostX.have_shm_fd_passing = FALSE; in hostx_init_shm()
435 cookie = xcb_shm_query_version(HostX.conn); in hostx_init_shm()
436 reply = xcb_shm_query_version_reply(HostX.conn, cookie, &error); in hostx_init_shm()
438 HostX.have_shm_fd_passing = in hostx_init_shm()
452 if (HostX.have_shm_fd_passing) { in hostx_create_shm_segment()
457 shminfo->shmseg = xcb_generate_id(HostX.conn); in hostx_create_shm_segment()
458 cookie = xcb_shm_create_segment(HostX.conn, shminfo->shmseg, size, TRUE); in hostx_create_shm_segment()
459 reply = xcb_shm_create_segment_reply(HostX.conn, cookie, &error); in hostx_create_shm_segment()
462 xcb_shm_create_segment_reply_fds(HostX.conn, reply) : NULL; in hostx_create_shm_segment()
471 xcb_shm_detach(HostX.conn, shminfo->shmseg); in hostx_create_shm_segment()
488 shminfo->shmseg = xcb_generate_id(HostX.conn); in hostx_create_shm_segment()
489 cookie = xcb_shm_attach_checked(HostX.conn, shminfo->shmseg, shminfo->shmid, TRUE); in hostx_create_shm_segment()
490 error = xcb_request_check(HostX.conn, cookie); in hostx_create_shm_segment()
507 xcb_shm_detach(HostX.conn, shminfo->shmseg); in hostx_destroy_shm_segment()
509 if (HostX.have_shm_fd_passing) in hostx_destroy_shm_segment()
546 HostX.conn = ephyr_glamor_connect(); in hostx_init()
549 HostX.conn = xcb_connect(NULL, &HostX.screen); in hostx_init()
550 if (!HostX.conn || xcb_connection_has_error(HostX.conn)) { in hostx_init()
555 xscreen = xcb_aux_get_screen(HostX.conn, HostX.screen); in hostx_init()
556 HostX.winroot = xscreen->root; in hostx_init()
557 HostX.gc = xcb_generate_id(HostX.conn); in hostx_init()
558 HostX.depth = xscreen->root_depth; in hostx_init()
561 HostX.visual = ephyr_glamor_get_visual(); in hostx_init()
562 if (HostX.visual->visual_id != xscreen->root_visual) { in hostx_init()
563 attrs[1] = xcb_generate_id(HostX.conn); in hostx_init()
565 xcb_create_colormap(HostX.conn, in hostx_init()
568 HostX.winroot, in hostx_init()
569 HostX.visual->visual_id); in hostx_init()
573 HostX.visual = xcb_aux_find_visual_by_id(xscreen,xscreen->root_visual); in hostx_init()
575 xcb_create_gc(HostX.conn, HostX.gc, HostX.winroot, 0, NULL); in hostx_init()
576 cookie_WINDOW_STATE = xcb_intern_atom(HostX.conn, FALSE, in hostx_init()
580 xcb_intern_atom(HostX.conn, FALSE, in hostx_init()
584 for (index = 0; index < HostX.n_screens; index++) { in hostx_init()
585 KdScreenInfo *screen = HostX.screens[index]; in hostx_init()
588 scrpriv->win = xcb_generate_id(HostX.conn); in hostx_init()
589 scrpriv->server_depth = HostX.depth; in hostx_init()
600 cookie = xcb_get_geometry(HostX.conn, in hostx_init()
602 prewin_geom = xcb_get_geometry_reply(HostX.conn, cookie, &e); in hostx_init()
616 xcb_create_window(HostX.conn, in hostx_init()
625 HostX.visual->visual_id, in hostx_init()
630 xcb_create_window(HostX.conn, in hostx_init()
633 HostX.winroot, in hostx_init()
637 HostX.visual->visual_id, in hostx_init()
644 if (HostX.use_fullscreen) { in hostx_init()
657 HostX.use_fullscreen = TRUE; in hostx_init()
670 xcb_change_property(HostX.conn, in hostx_init()
685 xcb_lookup_color(HostX.conn, xscreen->default_colormap, 3, "red"); in hostx_init()
687 xcb_lookup_color_reply(HostX.conn, c, NULL); in hostx_init()
695 xcb_alloc_color_cookie_t c = xcb_alloc_color(HostX.conn, in hostx_init()
698 xcb_alloc_color_reply_t *r = xcb_alloc_color_reply(HostX.conn, c, NULL); in hostx_init()
706 xcb_change_gc(HostX.conn, HostX.gc, XCB_GC_FOREGROUND, &pixel); in hostx_init()
708 cursor_pxm = xcb_generate_id(HostX.conn); in hostx_init()
709 xcb_create_pixmap(HostX.conn, 1, cursor_pxm, HostX.winroot, 1, 1); in hostx_init()
710 cursor_gc = xcb_generate_id(HostX.conn); in hostx_init()
712 xcb_create_gc(HostX.conn, cursor_gc, cursor_pxm, in hostx_init()
714 xcb_poly_fill_rectangle(HostX.conn, cursor_pxm, cursor_gc, 1, &rect); in hostx_init()
715 xcb_free_gc(HostX.conn, cursor_gc); in hostx_init()
716 HostX.empty_cursor = xcb_generate_id(HostX.conn); in hostx_init()
717 xcb_create_cursor(HostX.conn, in hostx_init()
718 HostX.empty_cursor, in hostx_init()
723 xcb_free_pixmap(HostX.conn, cursor_pxm); in hostx_init()
727 for (index = 0; index < HostX.n_screens; index++) { in hostx_init()
728 KdScreenInfo *screen = HostX.screens[index]; in hostx_init()
731 xcb_change_window_attributes(HostX.conn, in hostx_init()
734 &HostX.empty_cursor); in hostx_init()
739 if (HostX.have_shm) { in hostx_init()
744 HostX.have_shm = FALSE; in hostx_init()
752 xcb_flush(HostX.conn); in hostx_init()
756 HostX.damage_debug_msec = 20000; /* 1/50 th of a second */ in hostx_init()
759 HostX.damage_debug_msec = strtol(getenv("XEPHYR_PAUSE"), NULL, 0); in hostx_init()
760 EPHYR_DBG("pause is %li\n", HostX.damage_debug_msec); in hostx_init()
769 return HostX.depth; in hostx_get_depth()
789 return HostX.visual->bits_per_rgb_value; in hostx_get_bpp()
804 *rmsk = HostX.visual->red_mask; in hostx_get_visual_masks()
805 *gmsk = HostX.visual->green_mask; in hostx_get_visual_masks()
806 *bmsk = HostX.visual->blue_mask; in hostx_get_visual_masks()
850 rshift = hostx_calculate_color_shift(HostX.visual->red_mask); in hostx_set_cmap_entry()
851 gshift = hostx_calculate_color_shift(HostX.visual->green_mask); in hostx_set_cmap_entry()
852 bshift = hostx_calculate_color_shift(HostX.visual->blue_mask); in hostx_set_cmap_entry()
854 scrpriv->cmap[idx] = ((r << rshift) & HostX.visual->red_mask) | in hostx_set_cmap_entry()
855 ((g << gshift) & HostX.visual->green_mask) | in hostx_set_cmap_entry()
856 ((b << bshift) & HostX.visual->blue_mask); in hostx_set_cmap_entry()
893 if (HostX.have_shm) { in hostx_screen_init()
905 if (!ephyr_glamor && HostX.have_shm) { in hostx_screen_init()
906 scrpriv->ximg = xcb_image_create_native(HostX.conn, in hostx_screen_init()
910 HostX.depth, in hostx_screen_init()
920 HostX.have_shm = FALSE; in hostx_screen_init()
933 scrpriv->ximg = xcb_image_create_native(HostX.conn, in hostx_screen_init()
937 HostX.depth, in hostx_screen_init()
951 if (!HostX.size_set_from_configure) in hostx_screen_init()
955 xcb_configure_window(HostX.conn, scrpriv->win, mask, values); in hostx_screen_init()
965 xcb_icccm_set_wm_normal_hints(HostX.conn, scrpriv->win, in hostx_screen_init()
972 xcb_map_window(HostX.conn, scrpriv->win); in hostx_screen_init()
983 xcb_configure_window(HostX.conn, scrpriv->win, mask, values); in hostx_screen_init()
987 xcb_aux_sync(HostX.conn); in hostx_screen_init()
1111 if (HostX.have_shm) { in hostx_paint_rect()
1112 xcb_image_shm_put(HostX.conn, scrpriv->win, in hostx_paint_rect()
1113 HostX.gc, scrpriv->ximg, in hostx_paint_rect()
1120 xcb_image_t *img = xcb_image_native(HostX.conn, subimg, 1); in hostx_paint_rect()
1121 xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, img, dx, dy, 0); in hostx_paint_rect()
1127 xcb_aux_sync(HostX.conn); in hostx_paint_rect()
1140 tspec.tv_sec = HostX.damage_debug_msec / (1000000); in hostx_paint_debug_rect()
1141 tspec.tv_nsec = (HostX.damage_debug_msec % 1000000) * 1000; in hostx_paint_debug_rect()
1144 HostX.damage_debug_msec, tspec.tv_sec, tspec.tv_nsec); in hostx_paint_debug_rect()
1148 cookie = xcb_poly_fill_rectangle_checked(HostX.conn, scrpriv->win, in hostx_paint_debug_rect()
1149 HostX.gc, 1, &rect); in hostx_paint_debug_rect()
1150 e = xcb_request_check(HostX.conn, cookie); in hostx_paint_debug_rect()
1178 min_keycode = xcb_get_setup(HostX.conn)->min_keycode; in hostx_load_keymap()
1179 max_keycode = xcb_get_setup(HostX.conn)->max_keycode; in hostx_load_keymap()
1192 use_c = xcb_xkb_use_extension(HostX.conn, in hostx_load_keymap()
1195 use_r = xcb_xkb_use_extension_reply(HostX.conn, use_c, NULL); in hostx_load_keymap()
1210 mapping_c = xcb_get_keyboard_mapping(HostX.conn, in hostx_load_keymap()
1213 modifier_c = xcb_get_modifier_mapping(HostX.conn); in hostx_load_keymap()
1214 controls_c = xcb_xkb_get_controls(HostX.conn, in hostx_load_keymap()
1217 mapping_r = xcb_get_keyboard_mapping_reply(HostX.conn, in hostx_load_keymap()
1245 modifier_r = xcb_get_modifier_mapping_reply(HostX.conn, in hostx_load_keymap()
1269 controls_r = xcb_xkb_get_controls_reply(HostX.conn, in hostx_load_keymap()
1292 HostX.size_set_from_configure = ss; in hostx_size_set_from_configure()
1298 return HostX.conn; in hostx_get_xcbconn()
1306 if (HostX.saved_event) { in hostx_get_event()
1307 xev = HostX.saved_event; in hostx_get_event()
1308 HostX.saved_event = NULL; in hostx_get_event()
1311 xev = xcb_poll_for_queued_event(HostX.conn); in hostx_get_event()
1313 xev = xcb_poll_for_event(HostX.conn); in hostx_get_event()
1321 if (!HostX.saved_event) in hostx_has_queued_event()
1322 HostX.saved_event = xcb_poll_for_queued_event(HostX.conn); in hostx_has_queued_event()
1323 return HostX.saved_event != NULL; in hostx_has_queued_event()
1329 return HostX.screen; in hostx_get_screen()
1335 return xcb_get_file_descriptor(HostX.conn); in hostx_get_fd()
1342 if (a_screen_number < 0 || a_screen_number >= HostX.n_screens) { in hostx_get_window()
1346 scrpriv = HostX.screens[a_screen_number]->driver; in hostx_get_window()
1358 geom_cookie = xcb_get_geometry(HostX.conn, a_window); in hostx_get_window_attributes()
1359 attr_cookie = xcb_get_window_attributes(HostX.conn, a_window); in hostx_get_window_attributes()
1360 geom_reply = xcb_get_geometry_reply(HostX.conn, geom_cookie, NULL); in hostx_get_window_attributes()
1361 attr_reply = xcb_get_window_attributes_reply(HostX.conn, attr_cookie, NULL); in hostx_get_window_attributes()
1386 screens = xcb_setup_roots_iterator(xcb_get_setup(HostX.conn)); in hostx_get_visuals_info()
1437 xcb_screen_t *screen = xcb_aux_get_screen(HostX.conn, hostx_get_screen()); in hostx_create_window()
1440 EphyrScrPriv *scrpriv = HostX.screens[a_screen_number]->driver; in hostx_create_window()
1461 attrs[1] = xcb_generate_id(HostX.conn); in hostx_create_window()
1462 xcb_create_colormap(HostX.conn, in hostx_create_window()
1468 win = xcb_generate_id(HostX.conn); in hostx_create_window()
1469 xcb_create_window(HostX.conn, in hostx_create_window()
1484 xcb_flush(HostX.conn); in hostx_create_window()
1485 xcb_map_window(HostX.conn, win); in hostx_create_window()
1496 xcb_destroy_window(HostX.conn, a_win); in hostx_destroy_window()
1497 xcb_flush(HostX.conn); in hostx_destroy_window()
1519 xcb_configure_window(HostX.conn, a_win, mask, values); in hostx_set_window_geometry()
1548 xcb_shape_rectangles(HostX.conn, in hostx_set_window_bounding_rectangles()