dporobic

Getting _GTK_FRAME_EXTENTS

Jan 27th, 2021 (edited)
284
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     auto windowId = X11Wrapper::getActiveWindowId();
  2.     auto windowRect = X11Wrapper::getWindowRect(windowId);
  3.  
  4.     auto connection = QX11Info::connection();
  5.  
  6.     xcb_get_property_cookie_t cookie;
  7.     xcb_get_property_reply_t *reply;
  8.     xcb_intern_atom_cookie_t atom_cookie;
  9.     xcb_intern_atom_reply_t *atom_reply;
  10.  
  11.     atom_cookie = xcb_intern_atom(connection, 0, strlen("_GTK_FRAME_EXTENTS"), "_GTK_FRAME_EXTENTS");
  12.  
  13.     if ((atom_reply = xcb_intern_atom_reply(connection, atom_cookie, nullptr))) {
  14.         printf("The _GTK_FRAME_EXTENTS atom has ID %u\n", atom_reply->atom);
  15.     }
  16.  
  17.     cookie = xcb_get_property(connection, 0, windowId, atom_reply->atom, XCB_ATOM_CARDINAL, 0, 4);
  18.  
  19.     qDebug("Checking reply");
  20.     if ((reply = xcb_get_property_reply(connection, cookie, nullptr))) {
  21.         int len = xcb_get_property_value_length(reply);
  22.         if (len == 0) {
  23.             printf("Length zero\n");
  24.         } else {
  25.             printf("_GTK_FRAME_EXTENTS is %.*s\n", len, (char*)xcb_get_property_value(reply));
  26.         }
  27.     }
  28.     free(reply);
  29.     free(atom_reply);
RAW Paste Data