From b17abb05c8a8ce19f18039b8c306c92daa7c9acf Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 19 May 2003 22:43:48 +0000 Subject: using property and changeProperty --- src/Ewmh.cc | 42 +++++++++++++++++------------------------- src/Gnome.cc | 59 +++++++++++++++++++++++++++-------------------------------- src/Window.cc | 12 +++++------- 3 files changed, 49 insertions(+), 64 deletions(-) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index d96a6d3..9df4967 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.cc,v 1.25 2003/05/15 12:00:42 fluxgen Exp $ +// $Id: Ewmh.cc,v 1.26 2003/05/19 22:40:16 fluxgen Exp $ #include "Ewmh.hh" @@ -56,8 +56,8 @@ void Ewmh::initForScreen(BScreen &screen) { if (wincheck != None) { m_windows.push_back(wincheck); - XChangeProperty(disp, screen.rootWindow().window(), m_net_supporting_wm_check, XA_WINDOW, 32, - PropModeReplace, (unsigned char *) &wincheck, 1); + screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32, + PropModeReplace, (unsigned char *) &wincheck, 1); XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32, PropModeReplace, (unsigned char *) &wincheck, 1); @@ -86,18 +86,16 @@ void Ewmh::initForScreen(BScreen &screen) { m_net_supporting_wm_check }; - XChangeProperty(disp, screen.rootWindow().window(), - m_net_supported, XA_ATOM, 32, - PropModeReplace, - (unsigned char *) &atomsupported, - (sizeof atomsupported)/sizeof atomsupported[0]); + screen.rootWindow().changeProperty(m_net_supported, XA_ATOM, 32, + PropModeReplace, + (unsigned char *) &atomsupported, + (sizeof atomsupported)/sizeof atomsupported[0]); } void Ewmh::setupWindow(FluxboxWindow &win) { - Display *disp = FbTk::App::instance()->display(); Atom ret_type; int fmt; unsigned long nitems, bytes_after; @@ -112,10 +110,9 @@ void Ewmh::setupWindow(FluxboxWindow &win) { XFree(data); } */ - if (XGetWindowProperty(disp, win.clientWindow(), - m_net_wm_desktop, 0, 1, False, XA_CARDINAL, - &ret_type, &fmt, &nitems, &bytes_after, - (unsigned char **) &data) == Success && data) { + if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL, + &ret_type, &fmt, &nitems, &bytes_after, + (unsigned char **) &data) && data) { unsigned int desktop = static_cast(*data); if (desktop == 0xFFFFFFFF && !win.isStuck()) win.stick(); @@ -192,11 +189,9 @@ void Ewmh::updateClientList(BScreen &screen) { //number of windows to show in client list num = win; - XChangeProperty(FbTk::App::instance()->display(), - screen.rootWindow().window(), - m_net_client_list, - XA_CARDINAL, 32, - PropModeReplace, (unsigned char *)wl, num); + screen.rootWindow().changeProperty(m_net_client_list, + XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)wl, num); delete [] wl; } @@ -224,18 +219,15 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) { void Ewmh::updateCurrentWorkspace(BScreen &screen) { size_t workspace = screen.currentWorkspaceID(); - XChangeProperty(FbTk::App::instance()->display(), - screen.rootWindow().window(), - m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&workspace, 1); + screen.rootWindow().changeProperty(m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&workspace, 1); } void Ewmh::updateWorkspaceCount(BScreen &screen) { size_t numworkspaces = screen.getCount(); - XChangeProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), - m_net_number_of_desktops, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&numworkspaces, 1); + screen.rootWindow().changeProperty(m_net_number_of_desktops, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&numworkspaces, 1); } void Ewmh::updateState(FluxboxWindow &win) { diff --git a/src/Gnome.cc b/src/Gnome.cc index bb867ac..bafcd78 100644 --- a/src/Gnome.cc +++ b/src/Gnome.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Gnome.cc,v 1.24 2003/05/15 12:00:42 fluxgen Exp $ +// $Id: Gnome.cc,v 1.25 2003/05/19 22:40:40 fluxgen Exp $ #include "Gnome.hh" @@ -53,9 +53,9 @@ void Gnome::initForScreen(BScreen &screen) { Window gnome_win = XCreateSimpleWindow(disp, screen.rootWindow().window(), 0, 0, 5, 5, 0, 0, 0); // supported WM check - XChangeProperty(disp, screen.rootWindow().window(), - m_gnome_wm_supporting_wm_check, - XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); + screen.rootWindow().changeProperty(m_gnome_wm_supporting_wm_check, + XA_CARDINAL, 32, + PropModeReplace, (unsigned char *) &gnome_win, 1); XChangeProperty(disp, gnome_win, m_gnome_wm_supporting_wm_check, @@ -71,9 +71,10 @@ void Gnome::initForScreen(BScreen &screen) { }; //list atoms that we support - XChangeProperty(disp, screen.rootWindow().window(), - m_gnome_wm_prot, XA_ATOM, 32, PropModeReplace, - (unsigned char *)gnomeatomlist, (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]); + screen.rootWindow().changeProperty(m_gnome_wm_prot, + XA_ATOM, 32, PropModeReplace, + (unsigned char *)gnomeatomlist, + (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]); m_gnomewindows.push_back(gnome_win); @@ -92,10 +93,9 @@ void Gnome::setupWindow(FluxboxWindow &win) { unsigned long nitems, bytes_after; long flags, *data = 0; - if (XGetWindowProperty(disp, win.clientWindow(), - m_gnome_wm_win_state, 0, 1, False, XA_CARDINAL, - &ret_type, &fmt, &nitems, &bytes_after, - (unsigned char **) &data) == Success && data) { + if (win.winClient().property(m_gnome_wm_win_state, 0, 1, False, XA_CARDINAL, + &ret_type, &fmt, &nitems, &bytes_after, + (unsigned char **) &data) && data) { flags = *data; setState(&win, flags); XFree (data); @@ -172,11 +172,9 @@ void Gnome::updateClientList(BScreen &screen) { } //number of windows to show in client list num = win; - XChangeProperty(FbTk::App::instance()->display(), - screen.rootWindow().window(), - m_gnome_wm_win_client_list, - XA_CARDINAL, 32, - PropModeReplace, (unsigned char *)wl, num); + screen.rootWindow().changeProperty(m_gnome_wm_win_client_list, + XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)wl, num); delete[] wl; } @@ -206,19 +204,16 @@ void Gnome::updateWorkspaceNames(BScreen &screen) { void Gnome::updateCurrentWorkspace(BScreen &screen) { int workspace = screen.currentWorkspaceID(); - XChangeProperty(FbTk::App::instance()->display(), - screen.rootWindow().window(), - m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&workspace, 1); + screen.rootWindow().changeProperty(m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&workspace, 1); updateClientList(screen); // make sure the client list is updated too } void Gnome::updateWorkspaceCount(BScreen &screen) { int numworkspaces = screen.getCount(); - XChangeProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), - m_gnome_wm_win_workspace_count, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&numworkspaces, 1); + screen.rootWindow().changeProperty(m_gnome_wm_win_workspace_count, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&numworkspaces, 1); } void Gnome::updateWorkspace(FluxboxWindow &win) { @@ -227,9 +222,9 @@ void Gnome::updateWorkspace(FluxboxWindow &win) { cerr<<__FILE__<<"("<<__LINE__<<"): setting workspace("<display(), win.clientWindow(), - m_gnome_wm_win_workspace, - XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); + win.winClient().changeProperty(m_gnome_wm_win_workspace, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&val, 1); } void Gnome::updateState(FluxboxWindow &win) { @@ -242,18 +237,18 @@ void Gnome::updateState(FluxboxWindow &win) { if (win.isShaded()) state |= WIN_STATE_SHADED; - XChangeProperty(FbTk::App::instance()->display(), win.clientWindow(), - m_gnome_wm_win_state, - XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&state, 1); + win.winClient().changeProperty(m_gnome_wm_win_state, + XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)&state, 1); } void Gnome::updateLayer(FluxboxWindow &win) { //TODO - map from flux layers to gnome ones // our layers are in the opposite direction to GNOME int layernum = Fluxbox::instance()->getDesktopLayer() - win.layerNum(); - XChangeProperty(FbTk::App::instance()->display(), win.clientWindow(), - m_gnome_wm_win_layer, - XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&layernum, 1); + win.winClient().changeProperty(m_gnome_wm_win_layer, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&layernum, 1); } diff --git a/src/Window.cc b/src/Window.cc index 488a37b..032c4cd 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.181 2003/05/19 15:39:06 rathnor Exp $ +// $Id: Window.cc,v 1.182 2003/05/19 22:43:48 fluxgen Exp $ #include "Window.hh" @@ -1023,8 +1023,7 @@ void FluxboxWindow::getMWMHints() { Atom atom_return; unsigned long num, len; Atom motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False); - if (!XGetWindowProperty(display, m_client->window(), - motif_wm_hints, 0, + if (!m_client->property(motif_wm_hints, 0, PropMwmHintsElements, false, motif_wm_hints, &atom_return, &format, &num, &len, @@ -1835,12 +1834,11 @@ void FluxboxWindow::restoreAttributes() { FbAtoms *fbatoms = FbAtoms::instance(); BlackboxAttributes *net; - if (XGetWindowProperty(display, m_client->window(), - fbatoms->getFluxboxAttributesAtom(), 0l, + if (m_client->property(fbatoms->getFluxboxAttributesAtom(), 0l, PropBlackboxAttributesElements, false, fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo, - &nitems, &ulfoo, (unsigned char **) &net) == - Success && net && nitems == (unsigned)PropBlackboxAttributesElements) { + &nitems, &ulfoo, (unsigned char **) &net) && + net && nitems == (unsigned)PropBlackboxAttributesElements) { m_blackbox_attrib.flags = net->flags; m_blackbox_attrib.attrib = net->attrib; m_blackbox_attrib.workspace = net->workspace; -- cgit v0.11.2