minor code cosmetics

This commit is contained in:
Mathias Gumz 2016-01-09 18:30:22 +01:00
parent 6346368b58
commit 3c06e9e93f
2 changed files with 27 additions and 18 deletions

View file

@ -38,39 +38,47 @@
#include <string>
using std::string;
using std::endl;
using std::hex;
using std::dec;
namespace {
void getScreenCoordinates(Window win, int x, int y, int &screen_x, int &screen_y) {
XWindowAttributes attr;
if (XGetWindowAttributes(FbTk::App::instance()->display(), win, &attr) == 0) {
return;
}
Window child_win; // not used
Window parent_win; // not used
Window root_win = 0;
Window* child_windows; // not used
unsigned int num_child_windows; // not used
Window unused_win;
Window parent_win;
Window root_win = 0;
Window* unused_childs = 0;
unsigned int unused_number;
XQueryTree(FbTk::App::instance()->display(), win,
&root_win,
&parent_win,
&child_windows, &num_child_windows);
if (child_windows != 0) {
XFree(child_windows);
&unused_childs, &unused_number);
if (unused_childs != 0) {
XFree(unused_childs);
}
XTranslateCoordinates(FbTk::App::instance()->display(),
parent_win, root_win,
x, y,
&screen_x, &screen_y, &child_win);
&screen_x, &screen_y, &unused_win);
}
};
/// helper class for tray windows, so we dont call XDestroyWindow
class TrayWindow: public FbTk::FbWindow {
class SystemTray::TrayWindow : public FbTk::FbWindow {
public:
TrayWindow(Window win, bool using_xembed):FbTk::FbWindow(win), m_visible(false), m_xembedded(using_xembed) {
setEventMask(PropertyChangeMask);
@ -183,7 +191,7 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent,
m_screen(screen),
m_pixmap(0), m_num_visible_clients(0),
m_selection_owner(m_window, 0, 0, 1, 1, SubstructureNotifyMask, false, false, CopyFromParent, InputOnly) {
FbTk::EventManager::instance()->add(*this, m_window);
FbTk::EventManager::instance()->add(*this, m_selection_owner);
// setup signals

View file

@ -35,7 +35,6 @@
class BScreen;
class ButtonTheme;
class TrayWindow;
class AtomHandler;
namespace FbTk {
@ -73,12 +72,13 @@ public:
int numClients() const { return m_clients.size(); }
const FbTk::FbWindow &window() const { return m_window; }
void renderTheme(int alpha) {
void renderTheme(int alpha) {
m_window.setBorderWidth(m_theme->border().width());
m_window.setBorderColor(m_theme->border().color());
m_window.setAlpha(alpha);
update();
m_window.setAlpha(alpha);
update();
}
void updateSizing() { m_window.setBorderWidth(m_theme->border().width()); }
void parentMoved() { m_window.parentMoved(); }
@ -90,7 +90,8 @@ public:
private:
void update();
typedef std::list<TrayWindow *> ClientList;
class TrayWindow;
typedef std::list<TrayWindow*> ClientList;
ClientList::iterator findClient(Window win);
void rearrangeClients();