mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Speed up removal items from group (FLTK 1.3 added faster method). Also fixing strange issue with desktop switch during minimize.
Added AppletWidget class, an experimental code for widgets that wants to accept custom methods. Needs completion though
This commit is contained in:
parent
22f4e094cf
commit
7431373b29
@ -26,6 +26,9 @@ class Fl_Widget;
|
|||||||
/* stored version in each applet shared library in case interface get changed */
|
/* stored version in each applet shared library in case interface get changed */
|
||||||
#define EDE_PANEL_APPLET_INTERFACE_VERSION 0x01
|
#define EDE_PANEL_APPLET_INTERFACE_VERSION 0x01
|
||||||
|
|
||||||
|
/* random number (must be less than FL_WINDOW) so panel could know it is AppletWidget<> */
|
||||||
|
#define EDE_PANEL_APPLET_TYPE 0x27
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Options assigned to each applet: how it will be resizable (horizontally or vertically)
|
* Options assigned to each applet: how it will be resizable (horizontally or vertically)
|
||||||
* and how it will be aligned. Each applet is by default aligned left without resizing ability.
|
* and how it will be aligned. Each applet is by default aligned left without resizing ability.
|
||||||
@ -46,6 +49,19 @@ struct AppletInfo {
|
|||||||
unsigned long options;
|
unsigned long options;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* each applet want to inherit this class if would like to exchange data with panel
|
||||||
|
* NOTE: new things could be added in future, but that will be reflected through EDE_PANEL_APPLET_INTERFACE_VERSION
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
class AppletWidget : public T {
|
||||||
|
public:
|
||||||
|
AppletWidget(int X, int Y, int W, int H, const char *l = 0) : T(X, Y, W, H, l) {
|
||||||
|
T::type(EDE_PANEL_APPLET_TYPE);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* module stuff */
|
||||||
typedef Fl_Widget* (*applet_create_t)(void);
|
typedef Fl_Widget* (*applet_create_t)(void);
|
||||||
typedef void (*applet_destroy_t)(Fl_Widget *);
|
typedef void (*applet_destroy_t)(Fl_Widget *);
|
||||||
|
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Sanel Zukan
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "Applet.h"
|
#include "Applet.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -97,9 +97,6 @@ Taskbar::Taskbar() : Fl_Group(0, 0, 40, 25), curr_active(NULL), prev_active(NULL
|
|||||||
end();
|
end();
|
||||||
fixed_layout = false;
|
fixed_layout = false;
|
||||||
|
|
||||||
//box(FL_FLAT_BOX);
|
|
||||||
//color(FL_RED);
|
|
||||||
|
|
||||||
update_task_buttons();
|
update_task_buttons();
|
||||||
netwm_callback_add(net_event_cb, this);
|
netwm_callback_add(net_event_cb, this);
|
||||||
}
|
}
|
||||||
@ -121,32 +118,32 @@ void Taskbar::update_task_buttons(void) {
|
|||||||
int curr_workspace = netwm_workspace_get_current();
|
int curr_workspace = netwm_workspace_get_current();
|
||||||
bool need_full_redraw = false;
|
bool need_full_redraw = false;
|
||||||
|
|
||||||
/*
|
|
||||||
* first remove windows not available in list received by wm
|
|
||||||
*
|
|
||||||
* TODO: FLTK 1.3.x got new function remove(int index) which will make
|
|
||||||
* faster removal, comparing to remove(Fl_Widget*)
|
|
||||||
*/
|
|
||||||
for(int i = 0, found; i < children(); i++) {
|
for(int i = 0, found; i < children(); i++) {
|
||||||
found = 0;
|
found = 0;
|
||||||
b = (TaskButton*)child(i);
|
b = (TaskButton*)child(i);
|
||||||
|
|
||||||
for(int j = 0; j < nwins; j++) {
|
for(int j = 0; j < nwins; j++) {
|
||||||
if(b->get_window_xid() == wins[j]) {
|
if(b->get_window_xid() == wins[j]) {
|
||||||
|
/* assure this window is on current workspace */
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found) {
|
if(!found) {
|
||||||
|
/* FLTK since 1.3 optimized Fl_Group::remove() */
|
||||||
|
#if (FL_MAJOR_VERSION >= 1) && (FL_MINOR_VERSION >= 3)
|
||||||
|
remove(i);
|
||||||
|
#else
|
||||||
remove(b);
|
remove(b);
|
||||||
|
#endif
|
||||||
/* Fl_Group does not call delete on remove() */
|
/* Fl_Group does not call delete on remove() */
|
||||||
delete b;
|
delete b;
|
||||||
need_full_redraw = true;
|
need_full_redraw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now see which one needs to create */
|
/* now see which one needs to be created */
|
||||||
for(int i = 0, found; i < nwins; i++) {
|
for(int i = 0, found; i < nwins; i++) {
|
||||||
found = 0;
|
found = 0;
|
||||||
|
|
||||||
@ -284,11 +281,13 @@ void Taskbar::update_active_button(bool do_redraw, int xid) {
|
|||||||
o = (TaskButton*)child(i);
|
o = (TaskButton*)child(i);
|
||||||
if(!o->visible()) continue;
|
if(!o->visible()) continue;
|
||||||
|
|
||||||
if(o->get_window_xid() == (Window)xid)
|
if(o->get_window_xid() == (Window)xid) {
|
||||||
o->box(FL_DOWN_BOX);
|
o->box(FL_DOWN_BOX);
|
||||||
else
|
curr_active = o;
|
||||||
|
} else {
|
||||||
o->box(FL_UP_BOX);
|
o->box(FL_UP_BOX);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(do_redraw) redraw();
|
if(do_redraw) redraw();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user