mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Using error handler to block XGetImage errors caused in FLTK. Seems how these errors can cause
panel to stop event processing
This commit is contained in:
parent
ee4dbe0109
commit
28de0f8e96
@ -93,7 +93,7 @@ static int xevent_handler(int e) {
|
|||||||
if(fl_xevent->type == PropertyNotify) {
|
if(fl_xevent->type == PropertyNotify) {
|
||||||
int action = -1;
|
int action = -1;
|
||||||
|
|
||||||
E_DEBUG("==> %s\n", XGetAtomName(fl_display, fl_xevent->xproperty.atom));
|
/* E_DEBUG("==> %s\n", XGetAtomName(fl_display, fl_xevent->xproperty.atom)); */
|
||||||
|
|
||||||
if(fl_xevent->xproperty.atom == _XA_NET_NUMBER_OF_DESKTOPS)
|
if(fl_xevent->xproperty.atom == _XA_NET_NUMBER_OF_DESKTOPS)
|
||||||
action = NETWM_CHANGED_WORKSPACE_COUNT;
|
action = NETWM_CHANGED_WORKSPACE_COUNT;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
#include <stdio.h>
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include <FL/x.H>
|
#include <FL/x.H>
|
||||||
|
#include <X11/Xproto.h>
|
||||||
|
|
||||||
#include <edelib/Debug.h>
|
#include <edelib/Debug.h>
|
||||||
#include <edelib/List.h>
|
#include <edelib/List.h>
|
||||||
@ -34,6 +36,33 @@ EDELIB_NS_USING(build_filename)
|
|||||||
typedef list<Fl_Widget*> WidgetList;
|
typedef list<Fl_Widget*> WidgetList;
|
||||||
typedef list<Fl_Widget*>::iterator WidgetListIt;
|
typedef list<Fl_Widget*>::iterator WidgetListIt;
|
||||||
|
|
||||||
|
static int xerror_handler(Display *d, XErrorEvent *e) {
|
||||||
|
if(e->request_code == X_GetImage)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
char buf[128];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* construct the similar message format like X11 is using by default, but again, little
|
||||||
|
* bit different so we knows it comes from here
|
||||||
|
*/
|
||||||
|
|
||||||
|
sprintf(buf, "%d", e->request_code);
|
||||||
|
|
||||||
|
XGetErrorDatabaseText(d, "XRequest", buf, "%d", buf, sizeof(buf));
|
||||||
|
fprintf(stderr, "%s: ", buf);
|
||||||
|
|
||||||
|
XGetErrorText(d, e->error_code, buf, sizeof(buf));
|
||||||
|
fprintf(stderr, "%s\n", buf);
|
||||||
|
|
||||||
|
XGetErrorDatabaseText(d, "XlibMessage", "ResourceID", "%d", buf, sizeof(buf));
|
||||||
|
fprintf(stderr, " ");
|
||||||
|
fprintf(stderr, buf, e->resourceid);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool intersects(Fl_Widget *o1, Fl_Widget *o2) {
|
inline bool intersects(Fl_Widget *o1, Fl_Widget *o2) {
|
||||||
return (MAX(o1->x(), o2->x()) <= MIN(o1->x() + o1->w(), o2->x() + o2->w()) &&
|
return (MAX(o1->x(), o2->x()) <= MIN(o1->x() + o1->w(), o2->x() + o2->w()) &&
|
||||||
MAX(o1->y(), o2->y()) <= MIN(o1->y() + o1->h(), o2->y() + o2->h()));
|
MAX(o1->y(), o2->y()) <= MIN(o1->y() + o1->h(), o2->y() + o2->h()));
|
||||||
@ -240,6 +269,12 @@ void Panel::show(void) {
|
|||||||
|
|
||||||
fl_open_display();
|
fl_open_display();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* hush known FLTK bug with XGetImage; a lot of errors will be print when menu icons goes
|
||||||
|
* outside screen; this also make ede-panel, at some point, unresponsible
|
||||||
|
*/
|
||||||
|
XSetErrorHandler((XErrorHandler) xerror_handler);
|
||||||
|
|
||||||
/* position it */
|
/* position it */
|
||||||
if(!netwm_get_workarea(X, Y, W, H))
|
if(!netwm_get_workarea(X, Y, W, H))
|
||||||
Fl::screen_xywh(X, Y, W, H);
|
Fl::screen_xywh(X, Y, W, H);
|
||||||
|
@ -82,7 +82,6 @@ void Taskbar::create_task_buttons(void) {
|
|||||||
for(int i = 0; i < nwins; i++) {
|
for(int i = 0; i < nwins; i++) {
|
||||||
if(!netwm_manageable_window(wins[i]))
|
if(!netwm_manageable_window(wins[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* show window per workspace
|
* show window per workspace
|
||||||
* TODO: allow showing all windows in each workspace
|
* TODO: allow showing all windows in each workspace
|
||||||
|
Loading…
Reference in New Issue
Block a user