fix systray client sizing

This commit is contained in:
simonb 2005-04-26 04:18:10 +00:00
parent 1c2f92a3d2
commit e57a30f664
7 changed files with 42 additions and 34 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day)
Changes for 0.9.13
*05/04/26:
* Fix systray icon sizing (send a configurenotify on resize) (Simon)
SystemTray.cc WinClient.hh/cc FbTk/FbWindow.hh/cc Window.cc
* Extension of previous patch, pushing various bits of menu items and
text buttons onto the background, and fixing various issues (Simon)
+ Incidentally, adds some new theme items (due to backwards

View file

@ -555,6 +555,30 @@ void FbWindow::create(Window parent, int x, int y,
FbWindow::setBackgroundColor(Color("gray", screenNumber()));
}
void FbWindow::sendConfigureNotify(int x, int y,
unsigned int width, unsigned int height) {
Display *disp = FbTk::App::instance()->display();
XEvent event;
event.type = ConfigureNotify;
event.xconfigure.display = disp;
event.xconfigure.event = window();
event.xconfigure.window = window();
event.xconfigure.x = x;
event.xconfigure.y = y;
event.xconfigure.width = width;
event.xconfigure.height = height;
//!! TODO
event.xconfigure.border_width = 1;
//!! TODO
event.xconfigure.above = None;
event.xconfigure.override_redirect = false;
XSendEvent(disp, window(), False, StructureNotifyMask, &event);
}
bool operator == (Window win, const FbWindow &fbwin) {
return win == fbwin.window();
}

View file

@ -186,6 +186,8 @@ public:
void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; }
void sendConfigureNotify(int x, int y, unsigned int width, unsigned int height);
protected:
/// creates a window with x window client (m_window = client)
explicit FbWindow(Window client);

View file

@ -326,7 +326,6 @@ void SystemTray::removeClient(Window win) {
void SystemTray::exposeEvent(XExposeEvent &event) {
m_window.clear();
update(0);
}
void SystemTray::handleEvent(XEvent &event) {
@ -350,6 +349,8 @@ void SystemTray::handleEvent(XEvent &event) {
// copy of position
(*it)->moveResize((*it)->x(), (*it)->y(),
(*it)->width(), (*it)->height());
// this was why gaim wasn't centring the icon
(*it)->sendConfigureNotify(0, 0, (*it)->width(), (*it)->height());
}
// so toolbar know that we changed size
resizeSig().notify();
@ -359,19 +360,23 @@ void SystemTray::handleEvent(XEvent &event) {
}
void SystemTray::rearrangeClients() {
const unsigned int h = height();
const unsigned int bw = m_theme.border().width();
int final_size = m_clients.size()*h + bw;
resize(final_size, h);
update(0);
// move and resize clients
ClientList::iterator client_it = m_clients.begin();
ClientList::iterator client_it_end = m_clients.end();
int next_x = 0;
const unsigned int h = height();
const unsigned int b = m_theme.border().width();
int next_x = bw;
for (; client_it != client_it_end;
++client_it, next_x += h - 2 * b) {
(*client_it)->moveResize(next_x, b, h - b, h - b);
++client_it, next_x += h+bw) {
(*client_it)->moveResize(next_x, bw, h, h);
(*client_it)->sendConfigureNotify(next_x, bw, h, h);
}
resize(next_x, height());
update(0);
client_it = m_clients.begin();
}
void SystemTray::removeAllClients() {

View file

@ -129,29 +129,6 @@ WinClient::~WinClient() {
m_win = 0;
}
void WinClient::updateRect(int x, int y,
unsigned int width, unsigned int height) {
Display *disp = FbTk::App::instance()->display();
XEvent event;
event.type = ConfigureNotify;
event.xconfigure.display = disp;
event.xconfigure.event = window();
event.xconfigure.window = window();
event.xconfigure.x = x;
event.xconfigure.y = y;
event.xconfigure.width = width;
event.xconfigure.height = height;
//!! TODO
event.xconfigure.border_width = 1;//client.old_bw;
//!! TODO
event.xconfigure.above = None; //m_frame.window().window();
event.xconfigure.override_redirect = false;
XSendEvent(disp, window(), False, StructureNotifyMask, &event);
}
bool WinClient::acceptsFocus() const {
return (m_focus_mode == F_LOCALLYACTIVE ||
m_focus_mode == F_PASSIVE ||

View file

@ -50,8 +50,6 @@ public:
~WinClient();
void updateRect(int x, int y, unsigned int width, unsigned int height);
bool sendFocus(); // returns whether we sent a message or not
// i.e. whether we assume the focus will get taken
bool acceptsFocus() const; // will this window accept focus (according to hints)

View file

@ -3727,7 +3727,7 @@ void FluxboxWindow::moveResizeClient(WinClient &client, int x, int y,
client.moveResize(x, y,
frame().clientArea().width(),
frame().clientArea().height());
client.updateRect(frame().x() + frame().clientArea().x(),
client.sendConfigureNotify(frame().x() + frame().clientArea().x(),
frame().y() + frame().clientArea().y(),
frame().clientArea().width(),
frame().clientArea().height());