Exemplo n.º 1
0
ExcCode screen_window_unmaximize(xcb_window_t window) {
	xcb_atom_t net_wm_state,
			net_wm_state_maximized_horz, net_wm_state_maximized_vert;
	TRY(create_atom("_NET_WM_STATE", 0, &net_wm_state));
	TRY(create_atom("_NET_WM_STATE_MAXIMIZED_HORZ", 0,
			&net_wm_state_maximized_horz));
	TRY(create_atom("_NET_WM_STATE_MAXIMIZED_VERT", 0,
			&net_wm_state_maximized_vert));
	xcb_client_message_event_t event;
	event.response_type = XCB_CLIENT_MESSAGE;
	event.format = 32;
	event.sequence = 0;
	event.window = window;
	event.type = net_wm_state;
	event.data.data32[0] = 0; // 0 - disable, 1 - enable, 2 - toggle
	event.data.data32[1] = net_wm_state_maximized_horz;
	event.data.data32[2] = net_wm_state_maximized_vert;
	event.data.data32[3] = 0;
	event.data.data32[4] = 0;
	xcb_void_cookie_t cookie = xcb_send_event_checked(display, 0, root,
			XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
			XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
			(const char*) &event);
	if (xcb_request_check(display, cookie) != NULL)
		PANIC(ERR_X_REQUEST, "screen_window_unmaximize (xcb_request_check)");
	if (xcb_flush(display) <= 0)
		PANIC(ERR_X_REQUEST, "screen_window_unmaximize (xcb_flush)");
	return 0;
}
Exemplo n.º 2
0
void XSendEvent(Display *display, Window w, Bool propagate, long event_mask, XEvent *event_send) {
	xcb_void_cookie_t cookie = xcb_send_event_checked (display, propagate, w, event_mask, (const char *) event_send);
	xcb_generic_error_t *error = xcb_request_check(display, cookie);
	if (error != NULL)
		fatal("Error in X11 communication\n");
}