mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 06:56:24 +08:00
Improved support for faulty X11 clients (STR #2385)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7866 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
CHANGES IN FLTK 1.3.0
|
CHANGES IN FLTK 1.3.0
|
||||||
|
|
||||||
|
- Improved support for faulty X11 clients (STR #2385)
|
||||||
- Fixed xclass support for Fl_Window (STR #2053)
|
- Fixed xclass support for Fl_Window (STR #2053)
|
||||||
- Fixed Caps Lock handling in X11/XIM (STR #2366)
|
- Fixed Caps Lock handling in X11/XIM (STR #2366)
|
||||||
- Fixed handling of missing fonts in Xft (STR #2355)
|
- Fixed handling of missing fonts in Xft (STR #2355)
|
||||||
|
|||||||
@@ -804,6 +804,27 @@ static Fl_Window* resize_bug_fix;
|
|||||||
static char unknown[] = "<unknown>";
|
static char unknown[] = "<unknown>";
|
||||||
const int unknown_len = 10;
|
const int unknown_len = 10;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
static int xerror = 0;
|
||||||
|
|
||||||
|
static int ignoreXEvents(Display *display, XErrorEvent *event) {
|
||||||
|
xerror = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static XErrorHandler catchXExceptions() {
|
||||||
|
xerror = 0;
|
||||||
|
return ignoreXEvents;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int wasXExceptionRaised() {
|
||||||
|
return xerror;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int fl_handle(const XEvent& thisevent)
|
int fl_handle(const XEvent& thisevent)
|
||||||
{
|
{
|
||||||
XEvent xevent = thisevent;
|
XEvent xevent = thisevent;
|
||||||
@@ -1360,16 +1381,22 @@ int fl_handle(const XEvent& thisevent)
|
|||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
Window junk;
|
Window junk;
|
||||||
|
|
||||||
|
// on some systems, the ReparentNotify event is not handled as we would expect.
|
||||||
|
XErrorHandler oldHandler = XSetErrorHandler(catchXExceptions());
|
||||||
|
|
||||||
//ReparentNotify gives the new position of the window relative to
|
//ReparentNotify gives the new position of the window relative to
|
||||||
//the new parent. FLTK cares about the position on the root window.
|
//the new parent. FLTK cares about the position on the root window.
|
||||||
XTranslateCoordinates(fl_display, xevent.xreparent.parent,
|
XTranslateCoordinates(fl_display, xevent.xreparent.parent,
|
||||||
XRootWindow(fl_display, fl_screen),
|
XRootWindow(fl_display, fl_screen),
|
||||||
xevent.xreparent.x, xevent.xreparent.y,
|
xevent.xreparent.x, xevent.xreparent.y,
|
||||||
&xpos, &ypos, &junk);
|
&xpos, &ypos, &junk);
|
||||||
|
XSetErrorHandler(oldHandler);
|
||||||
|
|
||||||
// tell Fl_Window about it and set flag to prevent echoing:
|
// tell Fl_Window about it and set flag to prevent echoing:
|
||||||
|
if ( !wasXExceptionRaised() ) {
|
||||||
resize_bug_fix = window;
|
resize_bug_fix = window;
|
||||||
window->position(xpos, ypos);
|
window->position(xpos, ypos);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user