Add a changeProperty method to Xcb::Window
Used from Client to directly change properties on its client.
This commit is contained in:
parent
85ea66f736
commit
e687c91402
2 changed files with 19 additions and 14 deletions
22
client.cpp
22
client.cpp
|
@ -1113,11 +1113,10 @@ void Client::exportMappingState(int s)
|
|||
}
|
||||
assert(s == NormalState || s == IconicState);
|
||||
|
||||
unsigned long data[2];
|
||||
data[0] = (unsigned long) s;
|
||||
data[1] = (unsigned long) None;
|
||||
XChangeProperty(display(), window(), atoms->wm_state, atoms->wm_state, 32,
|
||||
PropModeReplace, (unsigned char*)(data), 2);
|
||||
int32_t data[2];
|
||||
data[0] = s;
|
||||
data[1] = XCB_NONE;
|
||||
m_client.changeProperty(atoms->wm_state, atoms->wm_state, 32, 2, data);
|
||||
}
|
||||
|
||||
void Client::internalShow()
|
||||
|
@ -1508,16 +1507,12 @@ void Client::setOnActivities(QStringList newActivitiesList)
|
|||
(newActivitiesList.count() == 1 && newActivitiesList.at(0) == Activities::nullUuid())) {
|
||||
activityList.clear();
|
||||
const QByteArray nullUuid = Activities::nullUuid().toUtf8();
|
||||
XChangeProperty(display(), window(), atoms->activities, XA_STRING, 8,
|
||||
PropModeReplace, (const unsigned char *)nullUuid.constData(), nullUuid.length());
|
||||
m_client.changeProperty(atoms->activities, XCB_ATOM_STRING, 8, nullUuid.length(), nullUuid.constData());
|
||||
|
||||
} else {
|
||||
QByteArray joined = joinedActivitiesList.toAscii();
|
||||
char *data = joined.data();
|
||||
activityList = newActivitiesList;
|
||||
XChangeProperty(display(), window(), atoms->activities, XA_STRING, 8,
|
||||
PropModeReplace, (unsigned char *)data, joined.size());
|
||||
|
||||
m_client.changeProperty(atoms->activities, XCB_ATOM_STRING, 8, joined.length(), joined.constData());
|
||||
}
|
||||
|
||||
updateActivities(false);
|
||||
|
@ -1901,9 +1896,8 @@ void Client::setTabGroup(TabGroup *group)
|
|||
{
|
||||
tab_group = group;
|
||||
if (group) {
|
||||
unsigned long data = qHash(group); //->id();
|
||||
XChangeProperty(display(), window(), atoms->kde_net_wm_tab_group, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char*)(&data), 1);
|
||||
unsigned long data[] = {qHash(group)}; //->id();
|
||||
m_client.changeProperty(atoms->kde_net_wm_tab_group, XCB_ATOM_CARDINAL, 32, 1, data);
|
||||
}
|
||||
else
|
||||
m_client.deleteProperty(atoms->kde_net_wm_tab_group);
|
||||
|
|
11
xcbutils.h
11
xcbutils.h
|
@ -436,6 +436,8 @@ public:
|
|||
void map();
|
||||
void unmap();
|
||||
void reparent(xcb_window_t parent, int x = 0, int y = 0);
|
||||
void changeProperty(xcb_atom_t property, xcb_atom_t type, uint8_t format, uint32_t lenght,
|
||||
const void *data, uint8_t mode = XCB_PROP_MODE_REPLACE);
|
||||
void deleteProperty(xcb_atom_t property);
|
||||
void setBorderWidth(uint32_t width);
|
||||
void grabButton(uint8_t pointerMode, uint8_t keyboardmode,
|
||||
|
@ -633,6 +635,15 @@ void Window::reparent(xcb_window_t parent, int x, int y)
|
|||
xcb_reparent_window(connection(), m_window, parent, x, y);
|
||||
}
|
||||
|
||||
inline
|
||||
void Window::changeProperty(xcb_atom_t property, xcb_atom_t type, uint8_t format, uint32_t lenght, const void *data, uint8_t mode)
|
||||
{
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
xcb_change_property(connection(), mode, m_window, property, type, format, lenght, data);
|
||||
}
|
||||
|
||||
inline
|
||||
void Window::deleteProperty(xcb_atom_t property)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue