EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int *val, unsigned int num) { LOGFN(__FILE__, __LINE__, __FUNCTION__); CHECK_XCB_CONN; #if SIZEOF_INT == SIZEOF_LONG xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)val); // ecore_x_flush(); #else long *v2; unsigned int i; v2 = malloc(num * sizeof(long)); if (!v2) return; for (i = 0; i < num; i++) v2[i] = val[i]; xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)v2); free(v2); // ecore_x_flush(); #endif }
void ShellXcb::create_window() { win_ = xcb_generate_id(c_); uint32_t value_mask, value_list[32]; value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK; value_list[0] = scr_->black_pixel; value_list[1] = XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_STRUCTURE_NOTIFY; xcb_create_window(c_, XCB_COPY_FROM_PARENT, win_, scr_->root, 0, 0, settings_.initial_width, settings_.initial_height, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, scr_->root_visual, value_mask, value_list); xcb_intern_atom_cookie_t utf8_string_cookie = intern_atom_cookie(c_, "UTF8_STRING"); xcb_intern_atom_cookie_t _net_wm_name_cookie = intern_atom_cookie(c_, "_NET_WM_NAME"); xcb_intern_atom_cookie_t wm_protocols_cookie = intern_atom_cookie(c_, "WM_PROTOCOLS"); xcb_intern_atom_cookie_t wm_delete_window_cookie = intern_atom_cookie(c_, "WM_DELETE_WINDOW"); // set title xcb_atom_t utf8_string = intern_atom(c_, utf8_string_cookie); xcb_atom_t _net_wm_name = intern_atom(c_, _net_wm_name_cookie); xcb_change_property(c_, XCB_PROP_MODE_REPLACE, win_, _net_wm_name, utf8_string, 8, settings_.name.size(), settings_.name.c_str()); // advertise WM_DELETE_WINDOW wm_protocols_ = intern_atom(c_, wm_protocols_cookie); wm_delete_window_ = intern_atom(c_, wm_delete_window_cookie); xcb_change_property(c_, XCB_PROP_MODE_REPLACE, win_, wm_protocols_, XCB_ATOM_ATOM, 32, 1, &wm_delete_window_); }
static PyObject * _update_struts(PyObject *self, PyObject *args) { xcb_connection_t *connection; xcb_window_t window; uint32_t data[12]; int x, y, w, h, edge; memset(data, 0, sizeof(data)); if (!PyArg_ParseTuple(args, "lIiiiii", &connection, &window, &x, &y, &w, &h, &edge)) return NULL; if (edge == 0) { data[2] = h; data[8] = x; data[9] = x+w; } else if (edge == 1) { data[3] = h; data[10] = x; data[11] = x+w; } xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, atoms[_NET_WM_STRUT], CARDINAL, 32, 4, data); xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, atoms[_NET_WM_STRUT_PARTIAL], CARDINAL, 32, 12, data); Py_RETURN_NONE; }
/** * \brief Sends the selection data to the requestor on SelectionRequest * * \param [in] cb The clipboard context. * \param [in] e The selection request event. * \return true iff the data was sent (requestor's property was changed) * * Not currently ICCCM compliant as MULTIPLE target is unsupported. Also * not compliant because we're not supplying a proper TIMESTAMP value. */ static bool x11_transmit_selection(clipboard_c *cb, xcb_selection_request_event_t *e) { /* Default location to store data if none specified */ if (e->property == XCB_NONE) { e->property = e->target; } if (e->target == cb->std_atoms[X_ATOM_TARGETS].atom) { xcb_atom_t targets[] = { cb->std_atoms[X_ATOM_TIMESTAMP].atom, cb->std_atoms[X_ATOM_TARGETS].atom, cb->std_atoms[X_ATOM_UTF8_STRING].atom }; xcb_change_property(cb->xc, XCB_PROP_MODE_REPLACE, e->requestor, e->property, XCB_ATOM_ATOM, sizeof(xcb_atom_t) * 8, sizeof(targets) / sizeof(xcb_atom_t), targets); } else if (e->target == cb->std_atoms[X_ATOM_TIMESTAMP].atom) { xcb_timestamp_t cur = XCB_CURRENT_TIME; xcb_change_property(cb->xc, XCB_PROP_MODE_REPLACE, e->requestor, e->property, XCB_ATOM_INTEGER, sizeof(cur) * 8, 1, &cur); } else if (e->target == cb->std_atoms[X_ATOM_UTF8_STRING].atom) { selection_c *sel = NULL; if (pthread_mutex_lock(&cb->mu) != 0) { return false; } for (int i = 0; i < LCB_MODE_END; i++) { if (cb->selections[i].xmode == e->selection) { sel = &cb->selections[i]; break; } } if (sel == NULL || !sel->has_ownership || sel->data == NULL || sel->target != e->target) { pthread_mutex_unlock(&cb->mu); return false; } xcb_change_property(cb->xc, XCB_PROP_MODE_REPLACE, e->requestor, e->property, e->target, 8, sel->length, sel->data); pthread_mutex_unlock(&cb->mu); } else { /* Unknown target */ return false; } return true; }
/** * Sets the WM_COMMAND property for @a win. * * @param win The window. * @param argc Number of arguments. * @param argv Arguments. */ EAPI void ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv) { void *buf; char *b; int nbytes, i; LOGFN(__FILE__, __LINE__, __FUNCTION__); CHECK_XCB_CONN; for (i = 0, nbytes = 0; i < argc; i++) if (argv[i]) nbytes += strlen(argv[i]) + 1; buf = malloc(sizeof(char) * nbytes); if (!buf) return; b = (char *)buf; for (i = 0; i < argc; i++) { if (argv[i]) { strcpy(b, argv[i]); b += strlen(argv[i]) + 1; } else *b++ = '\0'; } xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, ECORE_X_ATOM_WM_COMMAND, ECORE_X_ATOM_STRING, 8, nbytes, buf); free(buf); }
void set_title(xcb_connection_t *con, xcb_window_t w, char *name) { xcb_change_property(con, XCB_PROP_MODE_REPLACE, w, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, strlen(name), name); xcb_flush(con); }
/* window_set_state - changes the state of a window {{{ * @window a window * @state the state we want to change it to */ void window_set_state(xcb_window_t window, long state) { long data[] = { state, XCB_NONE }; xcb_change_property(rootconf.connection, XCB_PROP_MODE_REPLACE, window, XCB_WM_HINT_STATE, XCB_WM_HINT_STATE, 32, 2, data); } /* }}} */
static xcb_window_t create_window(xcb_connection_t *conn, xcb_screen_t *screen, xcb_image_t *background) { xcb_window_t window = xcb_generate_id(conn); xcb_create_window(conn, XCB_COPY_FROM_PARENT, window, screen->root, 0, 0, screen->width_in_pixels, screen->height_in_pixels, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual, XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | XCB_CW_CURSOR, (uint32_t[]){ image_to_pixmap(conn, screen, background), 1, XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS, create_empty_cursor(conn, screen) }); const char name[] = "Hamartu"; xcb_change_property(conn, XCB_PROP_MODE_REPLACE, window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, sizeof(name), name); xcb_configure_window(conn, window, XCB_CONFIG_WINDOW_STACK_MODE, (uint32_t[]){ XCB_STACK_MODE_ABOVE }); return window; }
static void systray_draw(widget_t *widget, draw_context_t *ctx, area_t geometry, wibox_t *p) { uint32_t orient; switch(p->position) { case Right: case Left: orient = _NET_SYSTEM_TRAY_ORIENTATION_VERT; break; default: orient = _NET_SYSTEM_TRAY_ORIENTATION_HORZ; break; } systray_data_t *d = widget->data; if (p->orientation == East) d->height = p->geometry.height; else d->height = p->geometry.width; /* set wibox orientation */ /** \todo stop setting that property on each redraw */ xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, globalconf.screens.tab[p->ctx.phys_screen].systray.window, _NET_SYSTEM_TRAY_ORIENTATION, XCB_ATOM_CARDINAL, 32, 1, &orient); }
/** Set an X window property from a nul-terminated string */ static inline void set_string (xcb_connection_t *conn, xcb_window_t window, xcb_atom_t type, xcb_atom_t atom, const char *str) { xcb_change_property (conn, XCB_PROP_MODE_REPLACE, window, atom, type, /* format */ 8, strlen (str), str); }
void XWaylandManager::createWindowManager() { static const char name[] = "Green Island the Hawaii compositor"; m_wmWindow = new Xcb::Window(QRect(0, 0, 10, 10), XCB_WINDOW_CLASS_INPUT_OUTPUT, 0, Q_NULLPTR); xcb_window_t w = m_wmWindow->window(); m_wmWindow->changeProperty(Xcb::resources()->atoms->net_supporting_wm_check, XCB_ATOM_WINDOW, 32, 1, &w); m_wmWindow->changeProperty(Xcb::resources()->atoms->net_wm_name, Xcb::resources()->atoms->utf8_string, 8, strlen(name), name); xcb_change_property(Xcb::connection(), XCB_PROP_MODE_REPLACE, Xcb::rootWindow(), Xcb::resources()->atoms->net_supporting_wm_check, XCB_ATOM_WINDOW, 32, 1, &w); // Claim WM_S0 xcb_set_selection_owner(Xcb::connection(), w, Xcb::resources()->atoms->wm_s0, XCB_TIME_CURRENT_TIME); xcb_set_selection_owner(Xcb::connection(), w, Xcb::resources()->atoms->net_wm_cm_s0, XCB_TIME_CURRENT_TIME); }
static void weston_dnd_start(struct weston_wm *wm, xcb_window_t owner) { uint32_t values[1], version = 4; wm->dnd_window = xcb_generate_id(wm->conn); values[0] = XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE; xcb_create_window(wm->conn, XCB_COPY_FROM_PARENT, wm->dnd_window, wm->screen->root, 0, 0, 8192, 8192, 0, XCB_WINDOW_CLASS_INPUT_ONLY, wm->screen->root_visual, XCB_CW_EVENT_MASK, values); xcb_change_property(wm->conn, XCB_PROP_MODE_REPLACE, wm->dnd_window, wm->atom.xdnd_aware, XCB_ATOM_ATOM, 32, /* format */ 1, &version); xcb_map_window(wm->conn, wm->dnd_window); wm->dnd_owner = owner; }
void QXcbWindow::setNetWmWindowTypes(Qt::WindowFlags flags) { // in order of decreasing priority QVector<uint> windowTypes; Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); switch (type) { case Qt::Dialog: case Qt::Sheet: windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DIALOG)); break; case Qt::Tool: case Qt::Drawer: windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_UTILITY)); break; case Qt::ToolTip: windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_TOOLTIP)); break; case Qt::SplashScreen: windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_SPLASH)); break; default: break; } if (flags & Qt::FramelessWindowHint) windowTypes.append(atom(QXcbAtom::_KDE_NET_WM_WINDOW_TYPE_OVERRIDE)); windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_NORMAL)); Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::_NET_WM_WINDOW_TYPE), XCB_ATOM_ATOM, 32, windowTypes.count(), windowTypes.constData())); }
bool DesktopWindow::event(QEvent* event) { switch(event->type()) { case QEvent::WinIdChange: { qDebug() << "winid change:" << effectiveWinId(); if(effectiveWinId() == 0) { break; } // set freedesktop.org EWMH hints properly if(QX11Info::isPlatformX11() && QX11Info::connection()) { xcb_connection_t* con = QX11Info::connection(); const char* atom_name = "_NET_WM_WINDOW_TYPE_DESKTOP"; xcb_atom_t atom = xcb_intern_atom_reply(con, xcb_intern_atom(con, 0, strlen(atom_name), atom_name), nullptr)->atom; const char* prop_atom_name = "_NET_WM_WINDOW_TYPE"; xcb_atom_t prop_atom = xcb_intern_atom_reply(con, xcb_intern_atom(con, 0, strlen(prop_atom_name), prop_atom_name), nullptr)->atom; xcb_atom_t XA_ATOM = 4; xcb_change_property(con, XCB_PROP_MODE_REPLACE, effectiveWinId(), prop_atom, XA_ATOM, 32, 1, &atom); } break; } #undef FontChange // FontChange is defined in the headers of XLib and clashes with Qt, let's undefine it. case QEvent::StyleChange: case QEvent::FontChange: queueRelayout(); break; default: break; } return QWidget::event(event); }
void X11WindowedBackend::createWindow() { Xcb::Atom protocolsAtom(QByteArrayLiteral("WM_PROTOCOLS"), false, m_connection); Xcb::Atom deleteWindowAtom(QByteArrayLiteral("WM_DELETE_WINDOW"), false, m_connection); for (int i = 0; i < initialOutputCount(); ++i) { Output o; o.window = xcb_generate_id(m_connection); uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK; const uint32_t values[] = { m_screen->black_pixel, XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_EXPOSURE }; o.size = initialWindowSize(); if (!m_windows.isEmpty()) { const auto &p = m_windows.last(); o.internalPosition = QPoint(p.internalPosition.x() + p.size.width(), 0); } xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, o.window, m_screen->root, 0, 0, o.size.width(), o.size.height(), 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, mask, values); o.winInfo = new NETWinInfo(m_connection, o.window, m_screen->root, NET::WMWindowType, NET::Properties2()); o.winInfo->setWindowType(NET::Normal); o.winInfo->setPid(QCoreApplication::applicationPid()); QIcon windowIcon = QIcon::fromTheme(QStringLiteral("kwin")); auto addIcon = [&o, &windowIcon] (const QSize &size) { if (windowIcon.actualSize(size) != size) { return; } NETIcon icon; icon.data = windowIcon.pixmap(size).toImage().bits(); icon.size.width = size.width(); icon.size.height = size.height(); o.winInfo->setIcon(icon, false); }; addIcon(QSize(16, 16)); addIcon(QSize(32, 32)); addIcon(QSize(48, 48)); xcb_map_window(m_connection, o.window); m_protocols = protocolsAtom; m_deleteWindowProtocol = deleteWindowAtom; xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, o.window, m_protocols, XCB_ATOM_ATOM, 32, 1, &m_deleteWindowProtocol); m_windows << o; } updateWindowTitle(); xcb_flush(m_connection); }
static void towel_window_map(towel_window_t *win) { xcb_atom_t ATOM = towel_window_get_atom(win, "ATOM"); xcb_atom_t wm_state = towel_window_get_atom(win, "_NET_WM_STATE"); xcb_atom_t wm_state_fullscreen = towel_window_get_atom(win, "_NET_WM_STATE_FULLSCREEN"); xcb_client_message_event_t ev = { .response_type = XCB_CLIENT_MESSAGE, .format = 32, .window = win->id, .type = wm_state, }; ev.data.data32[0] = 1; ev.data.data32[1] = wm_state_fullscreen; ev.data.data32[2] = 0; ev.data.data32[3] = 1; xcb_change_property(win->conn, XCB_PROP_MODE_REPLACE, win->id, wm_state, ATOM, 8, sizeof(xcb_atom_t), &wm_state_fullscreen); xcb_map_window(win->conn, win->id); } static void towel_window_unmap(towel_window_t *win) { xcb_unmap_window(win->conn, win->id); }
/** Set client state (WM_STATE) property. * \param win The window to set state. * \param state The state to set. */ void window_state_set(xcb_window_t win, long state) { long data[] = { state, XCB_NONE }; xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win, WM_STATE, WM_STATE, 32, 2, data); }
/** Set client state (WM_STATE) property. * \param win The window to set state. * \param state The state to set. */ void xwindow_set_state(xcb_window_t win, uint32_t state) { uint32_t data[] = { state, XCB_NONE }; xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win, WM_STATE, WM_STATE, 32, 2, data); }
/* *Setup correct properties for a bar's window. */ static void ya_setup_ewmh(ya_bar_t *bar) { // I really hope I understood this correctly from lemonbar code :| const char *atom_names[] = { "_NET_WM_WINDOW_TYPE", "_NET_WM_WINDOW_TYPE_DOCK", "_NET_WM_DESKTOP", "_NET_WM_STRUT_PARTIAL", "_NET_WM_STRUT", "_NET_WM_STATE", "_NET_WM_STATE_STICKY", "_NET_WM_STATE_ABOVE", }; const int atoms = sizeof(atom_names)/sizeof(char *); xcb_intern_atom_cookie_t atom_cookie[atoms]; xcb_atom_t atom_list[atoms]; xcb_intern_atom_reply_t *atom_reply; for (int i = 0; i < atoms; i++) atom_cookie[i] = xcb_intern_atom(ya.c, 0, strlen(atom_names[i]), atom_names[i]); for (int i = 0; i < atoms; i++) { atom_reply = xcb_intern_atom_reply(ya.c, atom_cookie[i], NULL); if (!atom_reply) return; atom_list[i] = atom_reply->atom; free(atom_reply); } int strut[12]; if (bar->position == YA_TOP) { strut[2] = bar->height; strut[8] = bar->hgap; strut[9] = bar->hgap + bar->width; } else if (bar->position == YA_BOTTOM) { strut[3] = bar->height; strut[10] = bar->hgap; strut[11] = bar->hgap + bar->width; } else { //TODO right and left bars if implemented. } xcb_change_property(ya.c, XCB_PROP_MODE_REPLACE, bar->win, atom_list[NET_WM_WINDOW_TYPE], XCB_ATOM_ATOM, 32, 1, &atom_list[NET_WM_WINDOW_TYPE_DOCK]); xcb_change_property(ya.c, XCB_PROP_MODE_APPEND, bar->win, atom_list[NET_WM_STATE], XCB_ATOM_ATOM, 32, 2, &atom_list[NET_WM_STATE_STICKY]); xcb_change_property(ya.c, XCB_PROP_MODE_REPLACE, bar->win, atom_list[NET_WM_DESKTOP], XCB_ATOM_CARDINAL, 32, 1, (const uint32_t []){ -1 } );
// Set up a window using XCB and request event types xcb_window_t VulkanExampleBase::setupWindow() { uint32_t value_mask, value_list[32]; window = xcb_generate_id(connection); value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK; value_list[0] = screen->black_pixel; value_list[1] = XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE; xcb_create_window(connection, XCB_COPY_FROM_PARENT, window, screen->root, 0, 0, width, height, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual, value_mask, value_list); /* Magic code that will send notification when window is destroyed */ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(connection, 1, 12, "WM_PROTOCOLS"); xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(connection, cookie, 0); xcb_intern_atom_cookie_t cookie2 = xcb_intern_atom(connection, 0, 16, "WM_DELETE_WINDOW"); atom_wm_delete_window = xcb_intern_atom_reply(connection, cookie2, 0); xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, (*reply).atom, 4, 32, 1, &(*atom_wm_delete_window).atom); std::string windowTitle = getWindowTitle(); xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, title.size(), windowTitle.c_str()); free(reply); xcb_map_window(connection, window); return(window); }
void x11_set_window_opacity ( xcb_window_t box, unsigned int opacity ) { // Scale 0-100 to 0 - UINT32_MAX. unsigned int opacity_set = ( unsigned int ) ( ( opacity / 100.0 ) * UINT32_MAX ); xcb_change_property ( xcb->connection, XCB_PROP_MODE_REPLACE, box, netatoms[_NET_WM_WINDOW_OPACITY], XCB_ATOM_CARDINAL, 32, 1L, &opacity_set ); }
xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, char *color, xcb_pixmap_t pixmap) { uint32_t mask = 0; uint32_t values[3]; xcb_window_t win = xcb_generate_id(conn); if (pixmap == XCB_NONE) { mask |= XCB_CW_BACK_PIXEL; values[0] = get_colorpixel(color); } else { mask |= XCB_CW_BACK_PIXMAP; values[0] = pixmap; } mask |= XCB_CW_OVERRIDE_REDIRECT; values[1] = 1; mask |= XCB_CW_EVENT_MASK; values[2] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY; xcb_create_window(conn, XCB_COPY_FROM_PARENT, win, /* the window id */ scr->root, /* parent == root */ 0, 0, scr->width_in_pixels, scr->height_in_pixels, /* dimensions */ 0, /* border = 0, we draw our own */ XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */ mask, values); char *name = "i3lock"; xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, strlen(name), name); /* Map the window (= make it visible) */ xcb_map_window(conn, win); /* Raise window (put it on top) */ values[0] = XCB_STACK_MODE_ABOVE; xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values); /* Ensure that the window is created and set up before returning */ xcb_aux_sync(conn); return win; }
void _xcwm_atoms_set_wm_state(xcwm_window_t *window, xcwm_window_state_t state) { /* xcb_icccm_wm_state_t icccm_state; */ uint32_t icccm_state[2]; xcb_atom_t *ewmh_state = NULL; int ewmh_atom_cnt = 0; switch (state) { case XCWM_WINDOW_STATE_NORMAL: { icccm_state[0] = XCB_ICCCM_WM_STATE_NORMAL; icccm_state[1] = XCB_NONE; break; } case XCWM_WINDOW_STATE_ICONIC: { ewmh_atom_cnt = 1; icccm_state[0] = XCB_ICCCM_WM_STATE_ICONIC; icccm_state[1] = XCB_NONE; ewmh_state = calloc(ewmh_atom_cnt, sizeof(xcb_atom_t)); ewmh_state[0] = window->context->atoms.ewmh_conn._NET_WM_STATE_HIDDEN; break; } default: { /* No need to attempt to update the state */ return; } } /* Only set for top-level windows */ if (!window->transient_for && !window->override_redirect) { xcb_change_property(window->context->conn, XCB_PROP_MODE_REPLACE, window->window_id, window->context->atoms.wm_state_atom, window->context->atoms.wm_state_atom, 32, 2, icccm_state); } xcb_ewmh_set_wm_state(&window->context->atoms.ewmh_conn, window->window_id, ewmh_atom_cnt, ewmh_state); xcb_flush(window->context->conn); if (ewmh_state) { free(ewmh_state); } }
/* * Set CARD32 (array) property */ EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int *val, unsigned int num) { xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, ECORE_X_ATOM_CARDINAL, 32, num, (const void *)val); } /* ecore_x_window_prop_card32_set */
/* * Set X ID (array) property */ EAPI void ecore_x_window_prop_xid_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID *xids, unsigned int num) { xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, type, 32, num, xids); } /* ecore_x_window_prop_xid_set */
void KWinKScreenHelperEffect::setEffectProperty(long value) { #ifdef HAVE_XCB if (m_isValid && QX11Info::isPlatformX11()) { xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, QX11Info::appRootWindow(), m_atom, XCB_ATOM_CARDINAL, 32, 1, &value); } #else Q_UNUSED(value); #endif }
static inline void set_wm_hints (xcb_connection_t *conn, xcb_window_t window) { static const uint32_t wm_hints[8] = { 3, /* flags: Input, Initial state */ 1, /* input: True */ 1, /* initial state: Normal */ 0, 0, 0, 0, 0, /* Icon */ }; xcb_change_property (conn, XCB_PROP_MODE_REPLACE, window, XA_WM_HINTS, XA_WM_HINTS, 32, 8, wm_hints); }
/** * Set a window string property. * @param win The window * @param type The property * @param str The string * * Set a window string property */ EAPI void ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, const char *str) { if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, type, ECORE_X_ATOM_UTF8_STRING, 8, strlen(str), str); } /* ecore_x_window_prop_string_set */
void menuwin_init() { key_win.surface=cairo_xcb_surface_create(conn,key_win.window,visual_type,width,1); // Set the _NET_SUPPORTING_WM_CHECK property pointing to the window ID in both the root and fake windows // Also set the WM_NAME property in both windows to TWM_NAME xcb_change_property(conn,XCB_PROP_MODE_REPLACE,scr->root,atoms[TWM_ATOM__NET_SUPPORTING_WM_CHECK],XCB_ATOM_WINDOW,32,1,&key_win.window); xcb_change_property(conn,XCB_PROP_MODE_REPLACE,scr->root,atoms[TWM_ATOM__NET_WM_NAME],XCB_ATOM_STRING,8,strlen(TWM_NAME),TWM_NAME); xcb_change_property(conn,XCB_PROP_MODE_REPLACE,key_win.window,atoms[TWM_ATOM__NET_SUPPORTING_WM_CHECK],XCB_ATOM_WINDOW,32,1,&key_win.window); xcb_change_property(conn,XCB_PROP_MODE_REPLACE,key_win.window,atoms[TWM_ATOM__NET_WM_NAME],XCB_ATOM_STRING,8,strlen(TWM_NAME),TWM_NAME); xcb_change_property(conn,XCB_PROP_MODE_REPLACE,key_win.window,atoms[TWM_ATOM__NET_WM_WINDOW_TYPE],XCB_ATOM_ATOM,32,1,&atoms[TWM_ATOM__NET_WM_WINDOW_TYPE_DOCK]); xcb_map_window(conn,key_win.window); xcb_flush(conn); key_win.cache=wincache_fill_element(key_win.window); key_win.cache->mapped=1; key_win.possition=0; key_win.has_keyboard=0; key_win.width=width; key_win.height=1; key_win.enabled_by_mouse=0; key_win.wait_for=0; fill_keycodes(); }
EGLNativeWindowType QEglFSX11Hooks::createNativeWindow(QPlatformWindow *platformWindow, const QSize &size, const QSurfaceFormat &format) { Q_UNUSED(format); m_platformWindow = platformWindow; xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection)); m_window = xcb_generate_id(m_connection); xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_window, it.data->root, 0, 0, size.width(), size.height(), 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, it.data->root_visual, 0, 0); xcb_map_window(m_connection, m_window); xcb_intern_atom_cookie_t cookies[Atoms::N_ATOMS]; static const char *atomNames[Atoms::N_ATOMS] = { "_NET_WM_NAME", "UTF8_STRING", "WM_PROTOCOLS", "WM_DELETE_WINDOW", "_NET_WM_STATE", "_NET_WM_STATE_FULLSCREEN" }; for (int i = 0; i < Atoms::N_ATOMS; ++i) { cookies[i] = xcb_intern_atom(m_connection, false, strlen(atomNames[i]), atomNames[i]); xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(m_connection, cookies[i], 0); m_atoms[i] = reply->atom; free(reply); } // Set window title xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window, m_atoms[Atoms::_NET_WM_NAME], m_atoms[Atoms::UTF8_STRING], 8, 5, "EGLFS"); // Enable WM_DELETE_WINDOW xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window, m_atoms[Atoms::WM_PROTOCOLS], XCB_ATOM_ATOM, 32, 1, &m_atoms[Atoms::WM_DELETE_WINDOW]); if (qgetenv("EGLFS_X11_FULLSCREEN").toInt()) { // Go fullscreen. The QScreen and QWindow size is controlled by EGLFS_X11_SIZE regardless, // this is just the native window. xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window, m_atoms[Atoms::_NET_WM_STATE], XCB_ATOM_ATOM, 32, 1, &m_atoms[Atoms::_NET_WM_STATE_FULLSCREEN]); } xcb_flush(m_connection); return m_window; }