Lines Matching refs:window

182 weston_wm_set_net_active_window(struct weston_wm *wm, xcb_window_t window);
185 weston_wm_window_schedule_repaint(struct weston_wm_window *window);
189 struct weston_wm_window *window,
193 xserver_map_shell_surface(struct weston_wm_window *window,
260 struct weston_wm_window **window) in wm_lookup_window() argument
262 *window = hash_table_lookup(wm->window_hash, hash); in wm_lookup_window()
263 if (*window) in wm_lookup_window()
479 xcb_window_t window, xcb_atom_t property) in read_and_dump_property() argument
484 cookie = xcb_get_property(wm->conn, 0, window, in read_and_dump_property()
503 weston_wm_window_read_properties(struct weston_wm_window *window) in weston_wm_window_read_properties() argument
505 struct weston_wm *wm = window->wm; in weston_wm_window_read_properties()
507 #define F(field) (&window->field) in weston_wm_window_read_properties()
535 if (!window->properties_dirty) in weston_wm_window_read_properties()
537 window->properties_dirty = 0; in weston_wm_window_read_properties()
542 window->id, in weston_wm_window_read_properties()
546 window->decorate = window->override_redirect ? 0 : MWM_DECOR_EVERYTHING; in weston_wm_window_read_properties()
547 window->size_hints.flags = 0; in weston_wm_window_read_properties()
548 window->motif_hints.flags = 0; in weston_wm_window_read_properties()
549 window->delete_window = 0; in weston_wm_window_read_properties()
591 window->delete_window = 1; in weston_wm_window_read_properties()
596 memcpy(&window->size_hints, in weston_wm_window_read_properties()
598 sizeof window->size_hints); in weston_wm_window_read_properties()
601 window->fullscreen = 0; in weston_wm_window_read_properties()
605 window->fullscreen = 1; in weston_wm_window_read_properties()
607 window->maximized_vert = 1; in weston_wm_window_read_properties()
609 window->maximized_horz = 1; in weston_wm_window_read_properties()
613 memcpy(&window->motif_hints, in weston_wm_window_read_properties()
615 sizeof window->motif_hints); in weston_wm_window_read_properties()
616 if (window->motif_hints.flags & MWM_HINTS_DECORATIONS) { in weston_wm_window_read_properties()
617 if (window->motif_hints.decorations & MWM_DECOR_ALL) in weston_wm_window_read_properties()
619 window->decorate = in weston_wm_window_read_properties()
620 MWM_DECOR_EVERYTHING & (~window->motif_hints.decorations); in weston_wm_window_read_properties()
622 window->decorate = in weston_wm_window_read_properties()
623 window->motif_hints.decorations; in weston_wm_window_read_properties()
632 if (window->pid > 0) { in weston_wm_window_read_properties()
644 if (!window->machine || strcmp(window->machine, name)) in weston_wm_window_read_properties()
645 window->pid = 0; in weston_wm_window_read_properties()
655 weston_wm_window_get_frame_size(struct weston_wm_window *window, in weston_wm_window_get_frame_size() argument
658 struct theme *t = window->wm->theme; in weston_wm_window_get_frame_size()
660 if (window->fullscreen) { in weston_wm_window_get_frame_size()
661 *width = window->width; in weston_wm_window_get_frame_size()
662 *height = window->height; in weston_wm_window_get_frame_size()
663 } else if (window->decorate && window->frame) { in weston_wm_window_get_frame_size()
664 *width = frame_width(window->frame); in weston_wm_window_get_frame_size()
665 *height = frame_height(window->frame); in weston_wm_window_get_frame_size()
667 *width = window->width + t->margin * 2; in weston_wm_window_get_frame_size()
668 *height = window->height + t->margin * 2; in weston_wm_window_get_frame_size()
673 weston_wm_window_get_child_position(struct weston_wm_window *window, in weston_wm_window_get_child_position() argument
676 struct theme *t = window->wm->theme; in weston_wm_window_get_child_position()
678 if (window->fullscreen) { in weston_wm_window_get_child_position()
681 } else if (window->decorate && window->frame) { in weston_wm_window_get_child_position()
682 frame_interior(window->frame, x, y, NULL, NULL); in weston_wm_window_get_child_position()
690 weston_wm_window_send_configure_notify(struct weston_wm_window *window) in weston_wm_window_send_configure_notify() argument
693 struct weston_wm *wm = window->wm; in weston_wm_window_send_configure_notify()
696 weston_wm_window_get_child_position(window, &x, &y); in weston_wm_window_send_configure_notify()
699 configure_notify.event = window->id; in weston_wm_window_send_configure_notify()
700 configure_notify.window = window->id; in weston_wm_window_send_configure_notify()
704 configure_notify.width = window->width; in weston_wm_window_send_configure_notify()
705 configure_notify.height = window->height; in weston_wm_window_send_configure_notify()
710 xcb_send_event(wm->conn, 0, window->id, in weston_wm_window_send_configure_notify()
720 struct weston_wm_window *window; in weston_wm_handle_configure_request() local
725 configure_request->window, in weston_wm_handle_configure_request()
729 if (!wm_lookup_window(wm, configure_request->window, &window)) in weston_wm_handle_configure_request()
732 if (window->fullscreen) { in weston_wm_handle_configure_request()
733 weston_wm_window_send_configure_notify(window); in weston_wm_handle_configure_request()
738 window->width = configure_request->width; in weston_wm_handle_configure_request()
740 window->height = configure_request->height; in weston_wm_handle_configure_request()
742 if (window->frame) in weston_wm_handle_configure_request()
743 frame_resize_inside(window->frame, window->width, window->height); in weston_wm_handle_configure_request()
745 weston_wm_window_get_child_position(window, &x, &y); in weston_wm_handle_configure_request()
748 values[i++] = window->width; in weston_wm_handle_configure_request()
749 values[i++] = window->height; in weston_wm_handle_configure_request()
763 xcb_configure_window(wm->conn, window->id, mask, values); in weston_wm_handle_configure_request()
765 weston_wm_window_get_frame_size(window, &width, &height); in weston_wm_handle_configure_request()
769 xcb_configure_window(wm->conn, window->frame_id, mask, values); in weston_wm_handle_configure_request()
771 weston_wm_window_schedule_repaint(window); in weston_wm_handle_configure_request()
791 struct weston_wm_window *window; in weston_wm_handle_configure_notify() local
794 configure_notify->window, in weston_wm_handle_configure_notify()
799 if (!wm_lookup_window(wm, configure_notify->window, &window)) in weston_wm_handle_configure_notify()
802 window->x = configure_notify->x; in weston_wm_handle_configure_notify()
803 window->y = configure_notify->y; in weston_wm_handle_configure_notify()
804 window->pos_dirty = false; in weston_wm_handle_configure_notify()
806 if (window->override_redirect) { in weston_wm_handle_configure_notify()
807 window->width = configure_notify->width; in weston_wm_handle_configure_notify()
808 window->height = configure_notify->height; in weston_wm_handle_configure_notify()
809 if (window->frame) in weston_wm_handle_configure_notify()
810 frame_resize_inside(window->frame, in weston_wm_handle_configure_notify()
811 window->width, window->height); in weston_wm_handle_configure_notify()
816 if (window->shsurf) in weston_wm_handle_configure_notify()
817 xwayland_api->set_xwayland(window->shsurf, in weston_wm_handle_configure_notify()
818 window->x, window->y); in weston_wm_handle_configure_notify()
826 struct weston_wm_window *window = get_wm_window(surface); in weston_wm_kill_client() local
827 if (!window) in weston_wm_kill_client()
830 if (window->pid > 0) in weston_wm_kill_client()
831 kill(window->pid, SIGKILL); in weston_wm_kill_client()
841 struct weston_wm_window *window; in weston_wm_create_surface() local
848 wl_list_for_each(window, &wm->unpaired_window_list, link) in weston_wm_create_surface()
849 if (window->surface_id == in weston_wm_create_surface()
851 xserver_map_shell_surface(window, surface); in weston_wm_create_surface()
852 window->surface_id = 0; in weston_wm_create_surface()
853 wl_list_remove(&window->link); in weston_wm_create_surface()
860 struct weston_wm_window *window) in weston_wm_send_focus_window() argument
864 if (window) { in weston_wm_send_focus_window()
867 if (window->override_redirect) in weston_wm_send_focus_window()
872 client_message.window = window->id; in weston_wm_send_focus_window()
877 xcb_send_event(wm->conn, 0, window->id, in weston_wm_send_focus_window()
882 window->id, XCB_TIME_CURRENT_TIME); in weston_wm_send_focus_window()
885 xcb_configure_window (wm->conn, window->frame_id, in weston_wm_send_focus_window()
900 struct weston_wm_window *window = NULL; in weston_wm_window_activate() local
905 window = get_wm_window(surface); in weston_wm_window_activate()
908 if (window) { in weston_wm_window_activate()
909 weston_wm_set_net_active_window(wm, window->id); in weston_wm_window_activate()
914 weston_wm_send_focus_window(wm, window); in weston_wm_window_activate()
921 wm->focus_window = window; in weston_wm_window_activate()
945 weston_wm_window_set_allow_commits(struct weston_wm_window *window, bool allow) in weston_wm_window_set_allow_commits() argument
947 struct weston_wm *wm = window->wm; in weston_wm_window_set_allow_commits()
950 assert(window->frame_id != XCB_WINDOW_NONE); in weston_wm_window_set_allow_commits()
956 window->frame_id, in weston_wm_window_set_allow_commits()
968 weston_wm_window_set_wm_state(struct weston_wm_window *window, int32_t state) in weston_wm_window_set_wm_state() argument
970 struct weston_wm *wm = window->wm; in weston_wm_window_set_wm_state()
978 window->id, in weston_wm_window_set_wm_state()
986 weston_wm_window_set_net_wm_state(struct weston_wm_window *window) in weston_wm_window_set_net_wm_state() argument
988 struct weston_wm *wm = window->wm; in weston_wm_window_set_net_wm_state()
993 if (window->fullscreen) in weston_wm_window_set_net_wm_state()
995 if (window->maximized_vert) in weston_wm_window_set_net_wm_state()
997 if (window->maximized_horz) in weston_wm_window_set_net_wm_state()
1002 window->id, in weston_wm_window_set_net_wm_state()
1010 weston_wm_window_create_frame(struct weston_wm_window *window) in weston_wm_window_create_frame() argument
1012 struct weston_wm *wm = window->wm; in weston_wm_window_create_frame()
1017 if (window->decorate & MWM_DECOR_MAXIMIZE) in weston_wm_window_create_frame()
1020 window->frame = frame_create(window->wm->theme, in weston_wm_window_create_frame()
1021 window->width, window->height, in weston_wm_window_create_frame()
1022 buttons, window->name, NULL); in weston_wm_window_create_frame()
1023 frame_resize_inside(window->frame, window->width, window->height); in weston_wm_window_create_frame()
1025 weston_wm_window_get_frame_size(window, &width, &height); in weston_wm_window_create_frame()
1026 weston_wm_window_get_child_position(window, &x, &y); in weston_wm_window_create_frame()
1041 window->frame_id = xcb_generate_id(wm->conn); in weston_wm_window_create_frame()
1044 window->frame_id, in weston_wm_window_create_frame()
1055 xcb_reparent_window(wm->conn, window->id, window->frame_id, x, y); in weston_wm_window_create_frame()
1058 xcb_configure_window(wm->conn, window->id, in weston_wm_window_create_frame()
1061 window->cairo_surface = in weston_wm_window_create_frame()
1064 window->frame_id, in weston_wm_window_create_frame()
1068 hash_table_insert(wm->window_hash, window->frame_id, window); in weston_wm_window_create_frame()
1076 weston_wm_window_set_virtual_desktop(struct weston_wm_window *window, in weston_wm_window_set_virtual_desktop() argument
1080 xcb_change_property(window->wm->conn, in weston_wm_window_set_virtual_desktop()
1082 window->id, in weston_wm_window_set_virtual_desktop()
1083 window->wm->atom.net_wm_desktop, in weston_wm_window_set_virtual_desktop()
1088 xcb_delete_property(window->wm->conn, in weston_wm_window_set_virtual_desktop()
1089 window->id, in weston_wm_window_set_virtual_desktop()
1090 window->wm->atom.net_wm_desktop); in weston_wm_window_set_virtual_desktop()
1099 struct weston_wm_window *window; in weston_wm_handle_map_request() local
1102 if (our_resource(wm, map_request->window)) { in weston_wm_handle_map_request()
1104 map_request->window); in weston_wm_handle_map_request()
1108 if (!wm_lookup_window(wm, map_request->window, &window)) in weston_wm_handle_map_request()
1111 weston_wm_window_read_properties(window); in weston_wm_handle_map_request()
1124 assert(!window->shsurf); in weston_wm_handle_map_request()
1126 window->map_request_x = window->x; in weston_wm_handle_map_request()
1127 window->map_request_y = window->y; in weston_wm_handle_map_request()
1129 if (window->frame_id == XCB_WINDOW_NONE) in weston_wm_handle_map_request()
1130 weston_wm_window_create_frame(window); /* sets frame_id */ in weston_wm_handle_map_request()
1131 assert(window->frame_id != XCB_WINDOW_NONE); in weston_wm_handle_map_request()
1134 window->id, window, window->frame_id, in weston_wm_handle_map_request()
1135 window->width, window->height, in weston_wm_handle_map_request()
1136 window->map_request_x, window->map_request_y); in weston_wm_handle_map_request()
1138 weston_wm_window_set_allow_commits(window, false); in weston_wm_handle_map_request()
1139 weston_wm_window_set_wm_state(window, ICCCM_NORMAL_STATE); in weston_wm_handle_map_request()
1140 weston_wm_window_set_net_wm_state(window); in weston_wm_handle_map_request()
1141 weston_wm_window_set_virtual_desktop(window, 0); in weston_wm_handle_map_request()
1143 if (legacy_fullscreen(wm, window, &output)) { in weston_wm_handle_map_request()
1144 window->fullscreen = 1; in weston_wm_handle_map_request()
1145 weston_output_weak_ref_set(&window->legacy_fullscreen_output, in weston_wm_handle_map_request()
1149 xcb_map_window(wm->conn, map_request->window); in weston_wm_handle_map_request()
1150 xcb_map_window(wm->conn, window->frame_id); in weston_wm_handle_map_request()
1155 weston_wm_window_schedule_repaint(window); in weston_wm_handle_map_request()
1163 if (our_resource(wm, map_notify->window)) { in weston_wm_handle_map_notify()
1165 map_notify->window); in weston_wm_handle_map_notify()
1169 wm_printf(wm, "XCB_MAP_NOTIFY (window %d%s)\n", map_notify->window, in weston_wm_handle_map_notify()
1178 struct weston_wm_window *window; in weston_wm_handle_unmap_notify() local
1181 unmap_notify->window, in weston_wm_handle_unmap_notify()
1183 our_resource(wm, unmap_notify->window) ? ", ours" : ""); in weston_wm_handle_unmap_notify()
1185 if (our_resource(wm, unmap_notify->window)) in weston_wm_handle_unmap_notify()
1193 if (!wm_lookup_window(wm, unmap_notify->window, &window)) in weston_wm_handle_unmap_notify()
1196 if (window->surface_id) { in weston_wm_handle_unmap_notify()
1201 wl_list_remove(&window->link); in weston_wm_handle_unmap_notify()
1202 window->surface_id = 0; in weston_wm_handle_unmap_notify()
1204 if (wm->focus_window == window) in weston_wm_handle_unmap_notify()
1206 if (window->surface) in weston_wm_handle_unmap_notify()
1207 wl_list_remove(&window->surface_destroy_listener.link); in weston_wm_handle_unmap_notify()
1208 window->surface = NULL; in weston_wm_handle_unmap_notify()
1209 window->shsurf = NULL; in weston_wm_handle_unmap_notify()
1211 weston_wm_window_set_wm_state(window, ICCCM_WITHDRAWN_STATE); in weston_wm_handle_unmap_notify()
1212 weston_wm_window_set_virtual_desktop(window, -1); in weston_wm_handle_unmap_notify()
1214 xcb_unmap_window(wm->conn, window->frame_id); in weston_wm_handle_unmap_notify()
1218 weston_wm_window_draw_decoration(struct weston_wm_window *window) in weston_wm_window_draw_decoration() argument
1223 wm_printf(window->wm, "XWM: draw decoration, win %d\n", window->id); in weston_wm_window_draw_decoration()
1225 weston_wm_window_get_frame_size(window, &width, &height); in weston_wm_window_draw_decoration()
1227 cairo_xcb_surface_set_size(window->cairo_surface, width, height); in weston_wm_window_draw_decoration()
1228 cr = cairo_create(window->cairo_surface); in weston_wm_window_draw_decoration()
1230 if (window->fullscreen) { in weston_wm_window_draw_decoration()
1232 } else if (window->decorate) { in weston_wm_window_draw_decoration()
1233 frame_set_title(window->frame, window->name); in weston_wm_window_draw_decoration()
1234 frame_repaint(window->frame, cr); in weston_wm_window_draw_decoration()
1240 render_shadow(cr, window->wm->theme->shadow, in weston_wm_window_draw_decoration()
1245 cairo_surface_flush(window->cairo_surface); in weston_wm_window_draw_decoration()
1246 xcb_flush(window->wm->conn); in weston_wm_window_draw_decoration()
1250 weston_wm_window_set_pending_state(struct weston_wm_window *window) in weston_wm_window_set_pending_state() argument
1255 window->wm->server->compositor->xwayland_interface; in weston_wm_window_set_pending_state()
1257 if (!window->surface) in weston_wm_window_set_pending_state()
1260 weston_wm_window_get_frame_size(window, &width, &height); in weston_wm_window_set_pending_state()
1261 weston_wm_window_get_child_position(window, &x, &y); in weston_wm_window_set_pending_state()
1263 pixman_region32_fini(&window->surface->pending.opaque); in weston_wm_window_set_pending_state()
1264 if (window->has_alpha) { in weston_wm_window_set_pending_state()
1265 pixman_region32_init(&window->surface->pending.opaque); in weston_wm_window_set_pending_state()
1270 pixman_region32_init_rect(&window->surface->pending.opaque, in weston_wm_window_set_pending_state()
1272 window->width + 2, in weston_wm_window_set_pending_state()
1273 window->height + 2); in weston_wm_window_set_pending_state()
1276 if (window->decorate && !window->fullscreen) { in weston_wm_window_set_pending_state()
1277 frame_input_rect(window->frame, &input_x, &input_y, in weston_wm_window_set_pending_state()
1286 wm_printf(window->wm, "XWM: win %d geometry: %d,%d %dx%d\n", in weston_wm_window_set_pending_state()
1287 window->id, input_x, input_y, input_w, input_h); in weston_wm_window_set_pending_state()
1289 pixman_region32_fini(&window->surface->pending.input); in weston_wm_window_set_pending_state()
1290 pixman_region32_init_rect(&window->surface->pending.input, in weston_wm_window_set_pending_state()
1293 xwayland_interface->set_window_geometry(window->shsurf, in weston_wm_window_set_pending_state()
1296 if (window->name) in weston_wm_window_set_pending_state()
1297 xwayland_interface->set_title(window->shsurf, window->name); in weston_wm_window_set_pending_state()
1298 if (window->pid > 0) in weston_wm_window_set_pending_state()
1299 xwayland_interface->set_pid(window->shsurf, window->pid); in weston_wm_window_set_pending_state()
1305 struct weston_wm_window *window = data; in weston_wm_window_do_repaint() local
1307 window->repaint_source = NULL; in weston_wm_window_do_repaint()
1309 weston_wm_window_read_properties(window); in weston_wm_window_do_repaint()
1311 weston_wm_window_draw_decoration(window); in weston_wm_window_do_repaint()
1312 weston_wm_window_set_pending_state(window); in weston_wm_window_do_repaint()
1316 weston_wm_window_set_pending_state_OR(struct weston_wm_window *window) in weston_wm_window_set_pending_state_OR() argument
1321 assert(window->frame_id == XCB_WINDOW_NONE); in weston_wm_window_set_pending_state_OR()
1323 if (!window->surface) in weston_wm_window_set_pending_state_OR()
1326 weston_wm_window_get_frame_size(window, &width, &height); in weston_wm_window_set_pending_state_OR()
1327 pixman_region32_fini(&window->surface->pending.opaque); in weston_wm_window_set_pending_state_OR()
1328 if (window->has_alpha) { in weston_wm_window_set_pending_state_OR()
1329 pixman_region32_init(&window->surface->pending.opaque); in weston_wm_window_set_pending_state_OR()
1331 pixman_region32_init_rect(&window->surface->pending.opaque, 0, 0, in weston_wm_window_set_pending_state_OR()
1337 weston_wm_window_schedule_repaint(struct weston_wm_window *window) in weston_wm_window_schedule_repaint() argument
1339 struct weston_wm *wm = window->wm; in weston_wm_window_schedule_repaint()
1341 if (window->frame_id == XCB_WINDOW_NONE) { in weston_wm_window_schedule_repaint()
1347 weston_wm_window_set_pending_state_OR(window); in weston_wm_window_schedule_repaint()
1351 if (window->repaint_source) in weston_wm_window_schedule_repaint()
1354 wm_printf(wm, "XWM: schedule repaint, win %d\n", window->id); in weston_wm_window_schedule_repaint()
1356 window->repaint_source = in weston_wm_window_schedule_repaint()
1358 weston_wm_window_do_repaint, window); in weston_wm_window_schedule_repaint()
1366 struct weston_wm_window *window; in weston_wm_handle_property_notify() local
1372 if (!wm_lookup_window(wm, property_notify->window, &window)) in weston_wm_handle_property_notify()
1375 window->properties_dirty = 1; in weston_wm_handle_property_notify()
1384 property_notify->window); in weston_wm_handle_property_notify()
1389 read_and_dump_property(fp, wm, property_notify->window, in weston_wm_handle_property_notify()
1406 weston_wm_window_schedule_repaint(window); in weston_wm_handle_property_notify()
1413 struct weston_wm_window *window; in weston_wm_window_create() local
1418 window = zalloc(sizeof *window); in weston_wm_window_create()
1419 if (window == NULL) { in weston_wm_window_create()
1430 window->wm = wm; in weston_wm_window_create()
1431 window->id = id; in weston_wm_window_create()
1432 window->properties_dirty = 1; in weston_wm_window_create()
1433 window->override_redirect = override; in weston_wm_window_create()
1434 window->width = width; in weston_wm_window_create()
1435 window->height = height; in weston_wm_window_create()
1436 window->x = x; in weston_wm_window_create()
1437 window->y = y; in weston_wm_window_create()
1438 window->pos_dirty = false; in weston_wm_window_create()
1439 window->map_request_x = INT_MIN; /* out of range for valid positions */ in weston_wm_window_create()
1440 window->map_request_y = INT_MIN; /* out of range for valid positions */ in weston_wm_window_create()
1441 weston_output_weak_ref_init(&window->legacy_fullscreen_output); in weston_wm_window_create()
1447 window->has_alpha = geometry_reply->depth == 32; in weston_wm_window_create()
1450 hash_table_insert(wm->window_hash, id, window); in weston_wm_window_create()
1454 weston_wm_window_destroy(struct weston_wm_window *window) in weston_wm_window_destroy() argument
1456 struct weston_wm *wm = window->wm; in weston_wm_window_destroy()
1458 weston_output_weak_ref_clear(&window->legacy_fullscreen_output); in weston_wm_window_destroy()
1460 if (window->repaint_source) in weston_wm_window_destroy()
1461 wl_event_source_remove(window->repaint_source); in weston_wm_window_destroy()
1462 if (window->cairo_surface) in weston_wm_window_destroy()
1463 cairo_surface_destroy(window->cairo_surface); in weston_wm_window_destroy()
1465 if (window->frame_id) { in weston_wm_window_destroy()
1466 xcb_reparent_window(wm->conn, window->id, wm->wm_window, 0, 0); in weston_wm_window_destroy()
1467 xcb_destroy_window(wm->conn, window->frame_id); in weston_wm_window_destroy()
1468 weston_wm_window_set_wm_state(window, ICCCM_WITHDRAWN_STATE); in weston_wm_window_destroy()
1469 weston_wm_window_set_virtual_desktop(window, -1); in weston_wm_window_destroy()
1470 hash_table_remove(wm->window_hash, window->frame_id); in weston_wm_window_destroy()
1471 window->frame_id = XCB_WINDOW_NONE; in weston_wm_window_destroy()
1474 if (window->frame) in weston_wm_window_destroy()
1475 frame_destroy(window->frame); in weston_wm_window_destroy()
1477 if (window->surface_id) in weston_wm_window_destroy()
1478 wl_list_remove(&window->link); in weston_wm_window_destroy()
1480 if (window->surface) in weston_wm_window_destroy()
1481 wl_list_remove(&window->surface_destroy_listener.link); in weston_wm_window_destroy()
1483 hash_table_remove(window->wm->window_hash, window->id); in weston_wm_window_destroy()
1484 free(window); in weston_wm_window_destroy()
1494 create_notify->window, in weston_wm_handle_create_notify()
1498 our_resource(wm, create_notify->window) ? ", ours" : ""); in weston_wm_handle_create_notify()
1500 if (our_resource(wm, create_notify->window)) in weston_wm_handle_create_notify()
1503 weston_wm_window_create(wm, create_notify->window, in weston_wm_handle_create_notify()
1514 struct weston_wm_window *window; in weston_wm_handle_destroy_notify() local
1517 destroy_notify->window, in weston_wm_handle_destroy_notify()
1519 our_resource(wm, destroy_notify->window) ? ", ours" : ""); in weston_wm_handle_destroy_notify()
1521 if (our_resource(wm, destroy_notify->window)) in weston_wm_handle_destroy_notify()
1524 if (!wm_lookup_window(wm, destroy_notify->window, &window)) in weston_wm_handle_destroy_notify()
1527 weston_wm_window_destroy(window); in weston_wm_handle_destroy_notify()
1535 struct weston_wm_window *window; in weston_wm_handle_reparent_notify() local
1538 reparent_notify->window, in weston_wm_handle_reparent_notify()
1544 weston_wm_window_create(wm, reparent_notify->window, 10, 10, in weston_wm_handle_reparent_notify()
1548 if (!wm_lookup_window(wm, reparent_notify->window, &window)) in weston_wm_handle_reparent_notify()
1550 weston_wm_window_destroy(window); in weston_wm_handle_reparent_notify()
1564 weston_wm_pick_seat_for_window(struct weston_wm_window *window) in weston_wm_pick_seat_for_window() argument
1566 struct weston_wm *wm = window->wm; in weston_wm_pick_seat_for_window()
1576 pointer->focus->surface == window->surface && in weston_wm_pick_seat_for_window()
1588 weston_wm_window_handle_moveresize(struct weston_wm_window *window, in weston_wm_window_handle_moveresize() argument
1602 struct weston_wm *wm = window->wm; in weston_wm_window_handle_moveresize()
1603 struct weston_seat *seat = weston_wm_pick_seat_for_window(window); in weston_wm_window_handle_moveresize()
1611 || pointer->focus->surface != window->surface) in weston_wm_window_handle_moveresize()
1617 xwayland_interface->move(window->shsurf, pointer); in weston_wm_window_handle_moveresize()
1627 xwayland_interface->resize(window->shsurf, pointer, map[detail]); in weston_wm_window_handle_moveresize()
1667 weston_wm_window_set_toplevel(struct weston_wm_window *window) in weston_wm_window_set_toplevel() argument
1670 window->wm->server->compositor->xwayland_interface; in weston_wm_window_set_toplevel()
1672 xwayland_interface->set_toplevel(window->shsurf); in weston_wm_window_set_toplevel()
1673 window->width = window->saved_width; in weston_wm_window_set_toplevel()
1674 window->height = window->saved_height; in weston_wm_window_set_toplevel()
1675 if (window->frame) in weston_wm_window_set_toplevel()
1676 frame_resize_inside(window->frame, in weston_wm_window_set_toplevel()
1677 window->width, in weston_wm_window_set_toplevel()
1678 window->height); in weston_wm_window_set_toplevel()
1679 weston_wm_window_configure(window); in weston_wm_window_set_toplevel()
1683 weston_wm_window_is_maximized(struct weston_wm_window *window) in weston_wm_window_is_maximized() argument
1685 return window->maximized_horz && window->maximized_vert; in weston_wm_window_is_maximized()
1689 weston_wm_window_handle_state(struct weston_wm_window *window, in weston_wm_window_handle_state() argument
1692 struct weston_wm *wm = window->wm; in weston_wm_window_handle_state()
1696 int maximized = weston_wm_window_is_maximized(window); in weston_wm_window_handle_state()
1704 update_state(action, &window->fullscreen)) { in weston_wm_window_handle_state()
1705 weston_wm_window_set_net_wm_state(window); in weston_wm_window_handle_state()
1706 if (window->fullscreen) { in weston_wm_window_handle_state()
1707 window->saved_width = window->width; in weston_wm_window_handle_state()
1708 window->saved_height = window->height; in weston_wm_window_handle_state()
1710 if (window->shsurf) in weston_wm_window_handle_state()
1711 xwayland_interface->set_fullscreen(window->shsurf, in weston_wm_window_handle_state()
1714 if (window->shsurf) in weston_wm_window_handle_state()
1715 weston_wm_window_set_toplevel(window); in weston_wm_window_handle_state()
1720 update_state(action, &window->maximized_vert)) in weston_wm_window_handle_state()
1721 weston_wm_window_set_net_wm_state(window); in weston_wm_window_handle_state()
1724 update_state(action, &window->maximized_horz)) in weston_wm_window_handle_state()
1725 weston_wm_window_set_net_wm_state(window); in weston_wm_window_handle_state()
1727 if (maximized != weston_wm_window_is_maximized(window)) { in weston_wm_window_handle_state()
1728 if (weston_wm_window_is_maximized(window)) { in weston_wm_window_handle_state()
1729 window->saved_width = window->width; in weston_wm_window_handle_state()
1730 window->saved_height = window->height; in weston_wm_window_handle_state()
1732 if (window->shsurf) in weston_wm_window_handle_state()
1733 xwayland_interface->set_maximized(window->shsurf); in weston_wm_window_handle_state()
1734 } else if (window->shsurf) { in weston_wm_window_handle_state()
1735 weston_wm_window_set_toplevel(window); in weston_wm_window_handle_state()
1744 struct weston_wm_window *window = in surface_destroy() local
1748 wm_printf(window->wm, "surface for xid %d destroyed\n", window->id); in surface_destroy()
1752 window->shsurf = NULL; in surface_destroy()
1753 window->surface = NULL; in surface_destroy()
1757 weston_wm_window_handle_surface_id(struct weston_wm_window *window, in weston_wm_window_handle_surface_id() argument
1760 struct weston_wm *wm = window->wm; in weston_wm_window_handle_surface_id()
1763 if (window->surface_id != 0) { in weston_wm_window_handle_surface_id()
1765 window->id); in weston_wm_window_handle_surface_id()
1779 window->surface_id = 0; in weston_wm_window_handle_surface_id()
1780 xserver_map_shell_surface(window, in weston_wm_window_handle_surface_id()
1784 window->surface_id = id; in weston_wm_window_handle_surface_id()
1785 wl_list_insert(&wm->unpaired_window_list, &window->link); in weston_wm_window_handle_surface_id()
1795 struct weston_wm_window *window; in weston_wm_handle_client_message() local
1804 client_message->window); in weston_wm_handle_client_message()
1809 if (!wm_lookup_window(wm, client_message->window, &window)) in weston_wm_handle_client_message()
1813 weston_wm_window_handle_moveresize(window, client_message); in weston_wm_handle_client_message()
1815 weston_wm_window_handle_state(window, client_message); in weston_wm_handle_client_message()
1817 weston_wm_window_handle_surface_id(window, client_message); in weston_wm_handle_client_message()
1986 weston_wm_window_close(struct weston_wm_window *window, xcb_timestamp_t time) in weston_wm_window_close() argument
1990 if (window->delete_window) { in weston_wm_window_close()
1993 client_message.window = window->id; in weston_wm_window_close()
1994 client_message.type = window->wm->atom.wm_protocols; in weston_wm_window_close()
1996 window->wm->atom.wm_delete_window; in weston_wm_window_close()
1999 xcb_send_event(window->wm->conn, 0, window->id, in weston_wm_window_close()
2003 xcb_kill_client(window->wm->conn, window->id); in weston_wm_window_close()
2016 struct weston_wm_window *window; in weston_wm_handle_button() local
2026 if (!wm_lookup_window(wm, button->event, &window) || in weston_wm_handle_button()
2027 !window->decorate) in weston_wm_handle_button()
2033 seat = weston_wm_pick_seat_for_window(window); in weston_wm_handle_button()
2042 if (button->time - window->last_button_time <= DOUBLE_CLICK_PERIOD) { in weston_wm_handle_button()
2044 window->did_double = 1; in weston_wm_handle_button()
2046 window->did_double = 0; in weston_wm_handle_button()
2048 window->last_button_time = button->time; in weston_wm_handle_button()
2049 } else if (window->did_double == 1) { in weston_wm_handle_button()
2051 window->did_double = 0; in weston_wm_handle_button()
2059 location = frame_pointer_motion(window->frame, NULL, in weston_wm_handle_button()
2062 location = frame_double_click(window->frame, NULL, in weston_wm_handle_button()
2065 location = frame_pointer_button(window->frame, NULL, in weston_wm_handle_button()
2068 if (frame_status(window->frame) & FRAME_STATUS_REPAINT) in weston_wm_handle_button()
2069 weston_wm_window_schedule_repaint(window); in weston_wm_handle_button()
2071 if (frame_status(window->frame) & FRAME_STATUS_MOVE) { in weston_wm_handle_button()
2073 xwayland_interface->move(window->shsurf, pointer); in weston_wm_handle_button()
2074 frame_status_clear(window->frame, FRAME_STATUS_MOVE); in weston_wm_handle_button()
2077 if (frame_status(window->frame) & FRAME_STATUS_RESIZE) { in weston_wm_handle_button()
2079 xwayland_interface->resize(window->shsurf, pointer, location); in weston_wm_handle_button()
2080 frame_status_clear(window->frame, FRAME_STATUS_RESIZE); in weston_wm_handle_button()
2083 if (frame_status(window->frame) & FRAME_STATUS_CLOSE) { in weston_wm_handle_button()
2084 weston_wm_window_close(window, button->time); in weston_wm_handle_button()
2085 frame_status_clear(window->frame, FRAME_STATUS_CLOSE); in weston_wm_handle_button()
2088 if (frame_status(window->frame) & FRAME_STATUS_MAXIMIZE) { in weston_wm_handle_button()
2089 window->maximized_horz = !window->maximized_horz; in weston_wm_handle_button()
2090 window->maximized_vert = !window->maximized_vert; in weston_wm_handle_button()
2091 if (weston_wm_window_is_maximized(window)) { in weston_wm_handle_button()
2092 window->saved_width = window->width; in weston_wm_handle_button()
2093 window->saved_height = window->height; in weston_wm_handle_button()
2094 xwayland_interface->set_maximized(window->shsurf); in weston_wm_handle_button()
2096 weston_wm_window_set_toplevel(window); in weston_wm_handle_button()
2098 frame_status_clear(window->frame, FRAME_STATUS_MAXIMIZE); in weston_wm_handle_button()
2106 struct weston_wm_window *window; in weston_wm_handle_motion() local
2110 if (!wm_lookup_window(wm, motion->event, &window) || in weston_wm_handle_motion()
2111 !window->decorate) in weston_wm_handle_motion()
2114 location = frame_pointer_motion(window->frame, NULL, in weston_wm_handle_motion()
2116 if (frame_status(window->frame) & FRAME_STATUS_REPAINT) in weston_wm_handle_motion()
2117 weston_wm_window_schedule_repaint(window); in weston_wm_handle_motion()
2120 weston_wm_window_set_cursor(wm, window->frame_id, cursor); in weston_wm_handle_motion()
2127 struct weston_wm_window *window; in weston_wm_handle_enter() local
2131 if (!wm_lookup_window(wm, enter->event, &window) || in weston_wm_handle_enter()
2132 !window->decorate) in weston_wm_handle_enter()
2135 location = frame_pointer_enter(window->frame, NULL, in weston_wm_handle_enter()
2137 if (frame_status(window->frame) & FRAME_STATUS_REPAINT) in weston_wm_handle_enter()
2138 weston_wm_window_schedule_repaint(window); in weston_wm_handle_enter()
2141 weston_wm_window_set_cursor(wm, window->frame_id, cursor); in weston_wm_handle_enter()
2148 struct weston_wm_window *window; in weston_wm_handle_leave() local
2150 if (!wm_lookup_window(wm, leave->event, &window) || in weston_wm_handle_leave()
2151 !window->decorate) in weston_wm_handle_leave()
2154 frame_pointer_leave(window->frame, NULL); in weston_wm_handle_leave()
2155 if (frame_status(window->frame) & FRAME_STATUS_REPAINT) in weston_wm_handle_leave()
2156 weston_wm_window_schedule_repaint(window); in weston_wm_handle_leave()
2158 weston_wm_window_set_cursor(wm, window->frame_id, XWM_CURSOR_LEFT_PTR); in weston_wm_handle_leave()
2260 weston_wm_set_net_active_window(struct weston_wm *wm, xcb_window_t window) { in weston_wm_set_net_active_window() argument
2263 wm->atom.window, 32, 1, &window); in weston_wm_set_net_active_window()
2356 { "WINDOW", F(atom.window) }, in weston_wm_get_resources()
2628 struct weston_wm_window *window = data; in weston_wm_window_configure() local
2629 struct weston_wm *wm = window->wm; in weston_wm_window_configure()
2633 weston_wm_window_get_child_position(window, &x, &y); in weston_wm_window_configure()
2636 values[2] = window->width; in weston_wm_window_configure()
2637 values[3] = window->height; in weston_wm_window_configure()
2639 window->id, in weston_wm_window_configure()
2646 weston_wm_window_get_frame_size(window, &width, &height); in weston_wm_window_configure()
2650 window->frame_id, in weston_wm_window_configure()
2655 window->configure_source = NULL; in weston_wm_window_configure()
2657 weston_wm_window_schedule_repaint(window); in weston_wm_window_configure()
2663 struct weston_wm_window *window = get_wm_window(surface); in send_configure() local
2669 if (!window || !window->wm) in send_configure()
2671 wm = window->wm; in send_configure()
2674 if (window->decorate && !window->fullscreen) { in send_configure()
2692 if (window->width == new_width && window->height == new_height) in send_configure()
2695 window->width = new_width; in send_configure()
2696 window->height = new_height; in send_configure()
2698 if (window->frame) in send_configure()
2699 frame_resize_inside(window->frame, window->width, window->height); in send_configure()
2701 if (window->configure_source) in send_configure()
2704 window->configure_source = in send_configure()
2706 weston_wm_window_configure, window); in send_configure()
2712 struct weston_wm_window *window = get_wm_window(surface); in send_position() local
2716 if (!window || !window->wm) in send_position()
2719 wm = window->wm; in send_position()
2724 if (window->x != x || window->y != y || window->pos_dirty) { in send_position()
2725 window->pos_dirty = true; in send_position()
2730 xcb_configure_window(wm->conn, window->frame_id, mask, values); in send_position()
2741 struct weston_wm_window *window, in legacy_fullscreen() argument
2752 if (output->x == window->x && in legacy_fullscreen()
2753 output->y == window->y && in legacy_fullscreen()
2754 output->width == window->width && in legacy_fullscreen()
2755 output->height == window->height && in legacy_fullscreen()
2756 window->override_redirect) { in legacy_fullscreen()
2762 if ((window->size_hints.flags & (USSize |PSize)) && in legacy_fullscreen()
2763 window->size_hints.width == output->width && in legacy_fullscreen()
2764 window->size_hints.height == output->height) in legacy_fullscreen()
2766 if ((window->size_hints.flags & minmax) == minmax && in legacy_fullscreen()
2767 window->size_hints.min_width == output->width && in legacy_fullscreen()
2768 window->size_hints.min_height == output->height && in legacy_fullscreen()
2769 window->size_hints.max_width == output->width && in legacy_fullscreen()
2770 window->size_hints.max_height == output->height) in legacy_fullscreen()
2773 if (matching_size && !window->decorate && in legacy_fullscreen()
2774 (window->size_hints.flags & (USPosition | PPosition)) && in legacy_fullscreen()
2775 window->size_hints.x == output->x && in legacy_fullscreen()
2776 window->size_hints.y == output->y) { in legacy_fullscreen()
2786 weston_wm_window_is_positioned(struct weston_wm_window *window) in weston_wm_window_is_positioned() argument
2788 if (window->map_request_x == INT_MIN || in weston_wm_window_is_positioned()
2789 window->map_request_y == INT_MIN) in weston_wm_window_is_positioned()
2791 window->id); in weston_wm_window_is_positioned()
2793 return window->map_request_x != 0 || window->map_request_y != 0; in weston_wm_window_is_positioned()
2797 weston_wm_window_type_inactive(struct weston_wm_window *window) in weston_wm_window_type_inactive() argument
2799 struct weston_wm *wm = window->wm; in weston_wm_window_type_inactive()
2801 return window->type == wm->atom.net_wm_window_type_tooltip || in weston_wm_window_type_inactive()
2802 window->type == wm->atom.net_wm_window_type_dropdown || in weston_wm_window_type_inactive()
2803 window->type == wm->atom.net_wm_window_type_dnd || in weston_wm_window_type_inactive()
2804 window->type == wm->atom.net_wm_window_type_combo || in weston_wm_window_type_inactive()
2805 window->type == wm->atom.net_wm_window_type_popup || in weston_wm_window_type_inactive()
2806 window->type == wm->atom.net_wm_window_type_utility; in weston_wm_window_type_inactive()
2810 xserver_map_shell_surface(struct weston_wm_window *window, in xserver_map_shell_surface() argument
2813 struct weston_wm *wm = window->wm; in xserver_map_shell_surface()
2829 weston_wm_window_read_properties(window); in xserver_map_shell_surface()
2834 if (window->surface) in xserver_map_shell_surface()
2835 wl_list_remove(&window->surface_destroy_listener.link); in xserver_map_shell_surface()
2837 window->surface = surface; in xserver_map_shell_surface()
2838 window->surface_destroy_listener.notify = surface_destroy; in xserver_map_shell_surface()
2839 wl_signal_add(&window->surface->destroy_signal, in xserver_map_shell_surface()
2840 &window->surface_destroy_listener); in xserver_map_shell_surface()
2845 if (window->surface->committed) { in xserver_map_shell_surface()
2852 window->shsurf = in xserver_map_shell_surface()
2854 window->surface, in xserver_map_shell_surface()
2858 window->id, window->surface, window->shsurf); in xserver_map_shell_surface()
2860 if (window->name) in xserver_map_shell_surface()
2861 xwayland_interface->set_title(window->shsurf, window->name); in xserver_map_shell_surface()
2862 if (window->pid > 0) in xserver_map_shell_surface()
2863 xwayland_interface->set_pid(window->shsurf, window->pid); in xserver_map_shell_surface()
2865 if (window->fullscreen) { in xserver_map_shell_surface()
2866 window->saved_width = window->width; in xserver_map_shell_surface()
2867 window->saved_height = window->height; in xserver_map_shell_surface()
2868 xwayland_interface->set_fullscreen(window->shsurf, in xserver_map_shell_surface()
2869 window->legacy_fullscreen_output.output); in xserver_map_shell_surface()
2871 } else if (window->override_redirect) { in xserver_map_shell_surface()
2872 xwayland_interface->set_xwayland(window->shsurf, in xserver_map_shell_surface()
2873 window->x, window->y); in xserver_map_shell_surface()
2874 } else if (window->transient_for && window->transient_for->surface) { in xserver_map_shell_surface()
2875 parent = window->transient_for; in xserver_map_shell_surface()
2876 if (weston_wm_window_type_inactive(window)) { in xserver_map_shell_surface()
2877 xwayland_interface->set_transient(window->shsurf, in xserver_map_shell_surface()
2879 window->x - parent->x, in xserver_map_shell_surface()
2880 window->y - parent->y); in xserver_map_shell_surface()
2882 xwayland_interface->set_toplevel(window->shsurf); in xserver_map_shell_surface()
2883 xwayland_interface->set_parent(window->shsurf, in xserver_map_shell_surface()
2886 } else if (weston_wm_window_is_maximized(window)) { in xserver_map_shell_surface()
2887 xwayland_interface->set_maximized(window->shsurf); in xserver_map_shell_surface()
2889 if (weston_wm_window_type_inactive(window)) { in xserver_map_shell_surface()
2890 xwayland_interface->set_xwayland(window->shsurf, in xserver_map_shell_surface()
2891 window->x, in xserver_map_shell_surface()
2892 window->y); in xserver_map_shell_surface()
2893 } else if (weston_wm_window_is_positioned(window)) { in xserver_map_shell_surface()
2894 xwayland_interface->set_toplevel_with_position(window->shsurf, in xserver_map_shell_surface()
2895 window->map_request_x, in xserver_map_shell_surface()
2896 window->map_request_y); in xserver_map_shell_surface()
2898 xwayland_interface->set_toplevel(window->shsurf); in xserver_map_shell_surface()
2902 if (window->frame_id == XCB_WINDOW_NONE) { in xserver_map_shell_surface()
2903 weston_wm_window_set_pending_state_OR(window); in xserver_map_shell_surface()
2905 weston_wm_window_set_pending_state(window); in xserver_map_shell_surface()
2906 weston_wm_window_set_allow_commits(window, true); in xserver_map_shell_surface()