mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Correctly set tray window sizes so tray app can draw icon(s) on correct place.
This commit is contained in:
parent
7d884242bd
commit
403f4be39d
@ -47,6 +47,9 @@ static int handle_xevent(int e) {
|
||||
XDestroyWindowEvent xev = fl_xevent->xdestroywindow;
|
||||
curr_tray->unembed_window(xev.window);
|
||||
return false;
|
||||
} else if(fl_xevent->type == ConfigureNotify) {
|
||||
curr_tray->configure_notify(fl_xevent->xconfigure.window);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -148,10 +151,13 @@ void Tray::embed_window(Window id) {
|
||||
add_to_tray(win);
|
||||
win->show();
|
||||
|
||||
/* do real magic */
|
||||
/* do real magic
|
||||
* Some apps require we explicitly resize tray window, but some ignores it. So after window was shown, ConfigureNotify
|
||||
* will be fired up and we will handle those windows who are not resized.
|
||||
*/
|
||||
XResizeWindow(fl_display, id, win->w(), win->h());
|
||||
XReparentWindow(fl_display, id, fl_xid(win), 0, 0);
|
||||
XMapWindow(fl_display, id);
|
||||
XMapRaised(fl_display, id);
|
||||
|
||||
/* need to know when child dies */
|
||||
XSelectInput(fl_display, fl_xid(win), SubstructureNotifyMask);
|
||||
@ -175,6 +181,23 @@ void Tray::unembed_window(Window id) {
|
||||
}
|
||||
}
|
||||
|
||||
void Tray::configure_notify(Window id) {
|
||||
WinListIt it = win_list.begin(), ite = win_list.end();
|
||||
|
||||
for(; it != ite; ++it) {
|
||||
if(it->id == id) {
|
||||
XWindowChanges c;
|
||||
c.width = TRAY_ICON_W;
|
||||
c.height = TRAY_ICON_H;
|
||||
c.x = 0;
|
||||
c.y = 0;
|
||||
|
||||
XConfigureWindow(fl_display, id, CWWidth | CWHeight | CWX | CWY, &c);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Tray::add_to_tray(Fl_Widget *win) {
|
||||
insert(*win, 0);
|
||||
w(w() + win->w() + TRAY_ICONS_SPACE);
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
Atom get_opcode(void) const { return opcode; }
|
||||
void embed_window(Window id);
|
||||
void unembed_window(Window id);
|
||||
void configure_notify(Window id);
|
||||
|
||||
void add_to_tray(Fl_Widget *w);
|
||||
void remove_from_tray(Fl_Widget *w);
|
||||
|
Loading…
Reference in New Issue
Block a user