better support for avoiding window overlap with the Mac dock
svn: r3070
This commit is contained in:
parent
fd59ecc0be
commit
67b5c30218
|
@ -31,14 +31,21 @@
|
||||||
(wx:display-size xb yb (if full-screen? 1 0))
|
(wx:display-size xb yb (if full-screen? 1 0))
|
||||||
(values (unbox xb) (unbox yb)))))
|
(values (unbox xb) (unbox yb)))))
|
||||||
|
|
||||||
(define (get-display-left-top-inset)
|
(define get-display-left-top-inset
|
||||||
(let ([xb (box 0)]
|
(opt-lambda ([advisory? #f])
|
||||||
[yb (box 0)])
|
(let ([xb (box 0)]
|
||||||
(wx:display-origin xb yb)
|
[yb (box 0)])
|
||||||
(values (unbox xb) (unbox yb))))
|
(wx:display-origin xb yb advisory?)
|
||||||
|
(values (unbox xb) (unbox yb)))))
|
||||||
|
|
||||||
(define top-x 1)
|
(define-values (init-top-x init-top-y)
|
||||||
(define top-y 1)
|
(let-values ([(x y) (get-display-left-top-inset #f)]
|
||||||
|
[(x2 y2) (get-display-left-top-inset #t)])
|
||||||
|
(values (+ 1 (- x2 x))
|
||||||
|
(+ 1 (- y2 y)))))
|
||||||
|
|
||||||
|
(define top-x init-top-x)
|
||||||
|
(define top-y init-top-y)
|
||||||
(define top-level-windows (make-hash-table 'weak))
|
(define top-level-windows (make-hash-table 'weak))
|
||||||
|
|
||||||
;; make-top-container%: adds the necessary functionality to wx:frame% and
|
;; make-top-container%: adds the necessary functionality to wx:frame% and
|
||||||
|
@ -340,8 +347,8 @@
|
||||||
(values top-y #f)
|
(values top-y #f)
|
||||||
(values (max 0 (- sh h 20)) #t))])
|
(values (max 0 (- sh h 20)) #t))])
|
||||||
(move x y)
|
(move x y)
|
||||||
(set! top-x (if x-reset? 0 (+ top-x 10)))
|
(set! top-x (if x-reset? init-top-x (+ top-x 10)))
|
||||||
(set! top-y (if y-reset? 0 (+ top-y 20)))))
|
(set! top-y (if y-reset? init-top-y (+ top-y 20)))))
|
||||||
(if on?
|
(if on?
|
||||||
(hash-table-put! top-level-windows this #t)
|
(hash-table-put! top-level-windows this #t)
|
||||||
(hash-table-remove! top-level-windows this))
|
(hash-table-remove! top-level-windows this))
|
||||||
|
|
|
@ -59,6 +59,15 @@ static void wxCancelQuit()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wxsDisplayOrigin(int *x, int *y, Bool flags = FALSE)
|
||||||
|
{
|
||||||
|
#ifdef wx_mac
|
||||||
|
wxDisplayOrigin(x, y, flags);
|
||||||
|
#else
|
||||||
|
wxDisplayOrigin(x, y);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef wxGETDIR
|
#ifndef wxGETDIR
|
||||||
# define wxGETDIR 0
|
# define wxGETDIR 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -480,7 +489,7 @@ static Scheme_Object *wxsGlobalwxStripMenuCodes_Scheme(int n, Scheme_Object *p[
|
||||||
return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r));
|
return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Scheme_Object *wxsGlobalwxDisplayOrigin(int n, Scheme_Object *p[])
|
static Scheme_Object *wxsGlobalwxsDisplayOrigin(int n, Scheme_Object *p[])
|
||||||
{
|
{
|
||||||
WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
|
WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
|
||||||
REMEMBER_VAR_STACK();
|
REMEMBER_VAR_STACK();
|
||||||
|
@ -488,6 +497,7 @@ static Scheme_Object *wxsGlobalwxDisplayOrigin(int n, Scheme_Object *p[])
|
||||||
int* x0 = &_x0;
|
int* x0 = &_x0;
|
||||||
int _x1;
|
int _x1;
|
||||||
int* x1 = &_x1;
|
int* x1 = &_x1;
|
||||||
|
Bool x2;
|
||||||
Scheme_Object *sbox_tmp;
|
Scheme_Object *sbox_tmp;
|
||||||
|
|
||||||
SETUP_VAR_STACK_REMEMBERED(1);
|
SETUP_VAR_STACK_REMEMBERED(1);
|
||||||
|
@ -496,9 +506,13 @@ static Scheme_Object *wxsGlobalwxDisplayOrigin(int n, Scheme_Object *p[])
|
||||||
|
|
||||||
*x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+0], "display-origin")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "display-origin"", extracting boxed argument")));
|
*x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+0], "display-origin")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "display-origin"", extracting boxed argument")));
|
||||||
*x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+1], "display-origin")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "display-origin"", extracting boxed argument")));
|
*x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+1], "display-origin")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "display-origin"", extracting boxed argument")));
|
||||||
|
if (n > (0+2)) {
|
||||||
|
x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[0+2], "display-origin"));
|
||||||
|
} else
|
||||||
|
x2 = FALSE;
|
||||||
|
|
||||||
|
|
||||||
WITH_VAR_STACK(wxDisplayOrigin(x0, x1));
|
WITH_VAR_STACK(wxsDisplayOrigin(x0, x1, x2));
|
||||||
|
|
||||||
|
|
||||||
if (n > (0+0))
|
if (n > (0+0))
|
||||||
|
@ -762,7 +776,7 @@ void objscheme_setup_wxsGlobal(Scheme_Env *env)
|
||||||
WITH_VAR_STACK(scheme_install_xc_global("get-resource", functmp, env));
|
WITH_VAR_STACK(scheme_install_xc_global("get-resource", functmp, env));
|
||||||
functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxStripMenuCodes_Scheme, "label->plain-label", 1, 1));
|
functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxStripMenuCodes_Scheme, "label->plain-label", 1, 1));
|
||||||
WITH_VAR_STACK(scheme_install_xc_global("label->plain-label", functmp, env));
|
WITH_VAR_STACK(scheme_install_xc_global("label->plain-label", functmp, env));
|
||||||
functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxDisplayOrigin, "display-origin", 2, 2));
|
functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxsDisplayOrigin, "display-origin", 2, 3));
|
||||||
WITH_VAR_STACK(scheme_install_xc_global("display-origin", functmp, env));
|
WITH_VAR_STACK(scheme_install_xc_global("display-origin", functmp, env));
|
||||||
functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxDisplaySize, "display-size", 3, 3));
|
functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxDisplaySize, "display-size", 3, 3));
|
||||||
WITH_VAR_STACK(scheme_install_xc_global("display-size", functmp, env));
|
WITH_VAR_STACK(scheme_install_xc_global("display-size", functmp, env));
|
||||||
|
|
|
@ -33,6 +33,15 @@ static void wxCancelQuit()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wxsDisplayOrigin(int *x, int *y, Bool flags = FALSE)
|
||||||
|
{
|
||||||
|
#ifdef wx_mac
|
||||||
|
wxDisplayOrigin(x, y, flags);
|
||||||
|
#else
|
||||||
|
wxDisplayOrigin(x, y);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef wxGETDIR
|
#ifndef wxGETDIR
|
||||||
# define wxGETDIR 0
|
# define wxGETDIR 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,7 +121,7 @@ extern class wxDialogBox *objscheme_unbundle_wxDialogBox(Scheme_Object *obj, con
|
||||||
@ "hide-cursor" : void wxHideCursor()
|
@ "hide-cursor" : void wxHideCursor()
|
||||||
@ "bell" : void wxBell();
|
@ "bell" : void wxBell();
|
||||||
@ "display-size" : void wxDisplaySize(int*,int*,int);
|
@ "display-size" : void wxDisplaySize(int*,int*,int);
|
||||||
@ "display-origin" : void wxDisplayOrigin(int*,int*);
|
@ "display-origin" : void wxsDisplayOrigin(int*,int*,bool=FALSE);
|
||||||
|
|
||||||
@ "label->plain-label" : string wxStripMenuCodes_Scheme(string);
|
@ "label->plain-label" : string wxStripMenuCodes_Scheme(string);
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ extern Bool wxColourDisplay(void);
|
||||||
extern int wxDisplayDepth(void);
|
extern int wxDisplayDepth(void);
|
||||||
|
|
||||||
extern void wxDisplaySize(int *width, int *height, int flags = 0);
|
extern void wxDisplaySize(int *width, int *height, int flags = 0);
|
||||||
extern void wxDisplayOrigin(int *x, int *y);
|
extern void wxDisplayOrigin(int *x, int *y, int flags = 0);
|
||||||
|
|
||||||
extern void wxSetCursor(wxCursor *cursor);
|
extern void wxSetCursor(wxCursor *cursor);
|
||||||
|
|
||||||
|
|
|
@ -874,21 +874,27 @@ void wxDisplaySize(int *width, int *height, int flags)
|
||||||
BitMap screenBits;
|
BitMap screenBits;
|
||||||
int mbh;
|
int mbh;
|
||||||
|
|
||||||
GetQDGlobalsScreenBits(&screenBits);
|
if (!flags) {
|
||||||
*width = screenBits.bounds.right - screenBits.bounds.left;
|
Rect r;
|
||||||
if (flags)
|
GetAvailableWindowPositioningBounds(NULL, &r);
|
||||||
mbh = 0;
|
*width = (r.right - r.left);
|
||||||
else
|
*height = (r.bottom - wxMenuBarHeight);
|
||||||
mbh = wxMenuBarHeight;
|
} else {
|
||||||
*height = screenBits.bounds.bottom - screenBits.bounds.top - mbh;
|
GetQDGlobalsScreenBits(&screenBits);
|
||||||
|
*width = screenBits.bounds.right - screenBits.bounds.left;
|
||||||
|
*height = screenBits.bounds.bottom - screenBits.bounds.top;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDisplayOrigin(int *x, int *y)
|
void wxDisplayOrigin(int *x, int *y, int flags)
|
||||||
{
|
{
|
||||||
int mbh;
|
if (flags) {
|
||||||
*x = 0;
|
Rect r;
|
||||||
mbh = wxMenuBarHeight;
|
GetAvailableWindowPositioningBounds(NULL, &r);
|
||||||
*y = mbh;
|
*x = r.left;
|
||||||
|
} else
|
||||||
|
*x = 0;
|
||||||
|
*y = wxMenuBarHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FreeGWorld(GWorldPtr x_pixmap)
|
static void FreeGWorld(GWorldPtr x_pixmap)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user