Author: spitzak
Date: 2007-06-12 16:43:43 -0400 (Tue, 12 Jun 2007)
New Revision: 5903
Log:
OS/X does not generate LEAVE events when the mouse moves out of the
window, this code has a temporary fix for when the applications is
switched, but a real fix is needed.
Non-modal child windows now act like the Linux/Windows ones, they stay
on the screen when you change to other applications.
Modified:
trunk/src/osx/run.cxx
Modified: trunk/src/osx/run.cxx
===================================================================
--- trunk/src/osx/run.cxx 2007-06-12 19:17:38 UTC (rev 5902)
+++ trunk/src/osx/run.cxx 2007-06-12 20:43:43 UTC (rev 5903)
@@ -602,6 +602,7 @@
ret = eventNotHandledErr; // without this it blocks until mouse moves?
break;
case kEventWindowDeactivated:
+ handle(LEAVE, 0); // temporary fix until we get real enter/leave events
if ( window == xfocus ) fix_xfocus(0);
ret = eventNotHandledErr;
break;
@@ -1354,7 +1355,7 @@
(outside.right-outside.left)-(inside.right-inside.left),
(outside.bottom-outside.top)-(inside.bottom-inside.top));
} else if (child_of() && !contains(modal())) {
- r->set(0,-16,0,16);
+ r->set(0,-22,0,22);
} else {
r->set(0,-22,0,22);
}
@@ -1397,6 +1398,17 @@
//+++ verify port to FLTK2
void Window::create()
{
+ static WindowGroupRef floatingWindowGroup;
+ static WindowGroupRef mainWindowGroup;
+
+ if ( !floatingWindowGroup ) {
+ CreateWindowGroup( 0, &floatingWindowGroup );
+ CreateWindowGroup( 0, &mainWindowGroup );
+ SetWindowGroupParent( floatingWindowGroup, GetWindowGroupOfClass(
kDocumentWindowClass ) );
+ SetWindowGroupParent( mainWindowGroup, floatingWindowGroup );
+ ChangeWindowGroupAttributes( floatingWindowGroup,
kWindowGroupAttrSelectAsLayer | kWindowGroupAttrSharedActivation, 0);
+ }
+
// Create structure to hold the rectangle, initialize the parts that
// are the same for outer and child windows:
CreatedWindow* x = new CreatedWindow;
@@ -1433,6 +1445,7 @@
} else {
// create a desktop window
int winclass, winattr, where;
+ WindowGroupRef winGroup = NULL;
if (!border() || override()) {
winclass = kHelpWindowClass;
if (contains(modal()) || override()) {
@@ -1450,18 +1463,17 @@
kWindowCloseBoxAttribute;
where = kWindowAlertPositionOnParentWindowScreen;
} else if (child_of()) {
- // Major kludge: this is to have the regular look, but stay
- // above the document windows
- //SetWindowClass(x->xid, kFloatingWindowClass );
- winclass = kFloatingWindowClass;
+ winclass = kDocumentWindowClass;
winattr = kWindowStandardHandlerAttribute |
- kWindowCloseBoxAttribute;
+ kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute;
where = kWindowCenterOnParentWindowScreen;
+ winGroup = floatingWindowGroup;
} else {
winclass = kDocumentWindowClass;
winattr = kWindowStandardHandlerAttribute |
kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute;
where = kWindowCascadeOnParentWindowScreen;
+ winGroup = mainWindowGroup;
}
if (minw != maxw || minh != maxh)
winattr |= kWindowFullZoomAttribute |
@@ -1488,6 +1500,8 @@
if (child_of() && !contains(modal())) {
SetWindowActivationScope(x->xid, kWindowActivationScopeAll);
}
+ if ( winGroup )
+ SetWindowGroup( x->xid, winGroup );
label(label(), iconlabel());
@@ -1499,8 +1513,7 @@
this->resize(r.left, r.top, r.right-r.left, r.bottom-r.top);
} else if (border() && !override()) {
// stop it from putting title bar under the menubar:
- Rect r; GetWindowBounds(x->xid, kWindowStructureRgn, &r);
- if (r.top < 22) {y(y()+22-r.top); MoveWindow(x->xid, 0, y(), true);}
+ ConstrainWindowToScreen( x->xid, kWindowStructureRgn,
kWindowConstrainAllowPartial, NULL, NULL );
}
x->wait_for_expose = false;//true;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit