summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWm.c
diff options
context:
space:
mode:
authordas <das>2006-05-16 06:55:05 (GMT)
committerdas <das>2006-05-16 06:55:05 (GMT)
commitf79ac60ef10788b761ef42fd0051273cc9fe67ef (patch)
tree48c437185bb45133c5f9ba233f5fa30e82fbe1c7 /macosx/tkMacOSXWm.c
parentb55e0a8664c543af11269e9b382f6fafc12240ef (diff)
downloadtk-f79ac60ef10788b761ef42fd0051273cc9fe67ef.zip
tk-f79ac60ef10788b761ef42fd0051273cc9fe67ef.tar.gz
tk-f79ac60ef10788b761ef42fd0051273cc9fe67ef.tar.bz2
* macosx/tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): don't send
focus events to windows of class help or to overrideredirect windows. [Bug 1472624] * macosx/tkMacOSXWm.c: set overrideredirect windows to not become activated by the window manager and to not receive OS activate events (should make them behave more like on other platforms); use modern window class API for overrideredirect and transient windows; set the default class of overrideredirect windows to 'simple' rather than 'plain' (i.e. no window frame); add missing Panther and Tiger window attributes to [::tk::unsupported::MacWindowStyle].
Diffstat (limited to 'macosx/tkMacOSXWm.c')
-rw-r--r--macosx/tkMacOSXWm.c69
1 files changed, 55 insertions, 14 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 5f6a057..4236540 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXWm.c,v 1.33 2006/04/28 06:02:49 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.34 2006/05/16 06:55:06 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -2250,12 +2250,22 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
* FIX: We need an UpdateWrapper equivalent to make this 100% correct
*/
if (boolean) {
- wmPtr->style = plainDBox;
+ if (wmPtr->macClass == kDocumentWindowClass || (wmPtr->master != None &&
+ wmPtr->macClass == kFloatingWindowClass)) {
+ wmPtr->macClass = kSimpleWindowClass;
+ wmPtr->attributes = kWindowNoAttributes;
+ }
+ wmPtr->attributes |= kWindowNoActivatesAttribute;
} else {
- if (wmPtr->master != None) {
- wmPtr->style = floatZoomGrowProc; // override && transient
- } else {
- wmPtr->style = documentProc;
+ wmPtr->attributes &= ~kWindowNoActivatesAttribute;
+ if (wmPtr->macClass == kSimpleWindowClass) {
+ if (wmPtr->master != None) {
+ wmPtr->macClass = kFloatingWindowClass; // override && transient
+ wmPtr->attributes = kWindowStandardFloatingAttributes;
+ } else {
+ wmPtr->macClass = kDocumentWindowClass;
+ wmPtr->attributes = kWindowStandardDocumentAttributes;
+ }
}
}
return TCL_OK;
@@ -2892,9 +2902,11 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->masterWindowName = NULL;
/* XXX UpdateWrapper */
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- wmPtr->style = plainDBox;
+ wmPtr->macClass = kSimpleWindowClass;
+ wmPtr->attributes = kWindowNoActivatesAttribute;
} else {
- wmPtr->style = documentProc;
+ wmPtr->macClass = kDocumentWindowClass;
+ wmPtr->attributes = kWindowStandardDocumentAttributes;
}
} else {
if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) {
@@ -2935,9 +2947,11 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
strcpy(wmPtr->masterWindowName, argv3);
/* XXX UpdateWrapper */
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- wmPtr->style = plainDBox;
+ wmPtr->macClass = kSimpleWindowClass;
+ wmPtr->attributes = kWindowNoActivatesAttribute;
} else {
- wmPtr->style = floatZoomGrowProc;
+ wmPtr->macClass = kFloatingWindowClass;
+ wmPtr->attributes = kWindowStandardFloatingAttributes;
}
}
return TCL_OK;
@@ -4923,6 +4937,16 @@ TkMacOSXWinStyle(
char *strValue;
int intValue;
};
+#if !defined(MAC_OS_X_VERSION_10_3) || \
+ (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3)
+ #define kSimpleWindowClass 18
+ #define kWindowDoesNotCycleAttribute (1L << 15)
+#endif
+#if !defined(MAC_OS_X_VERSION_10_4) || \
+ (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4)
+ #define kWindowNoTitleBarAttribute (1L << 9)
+ #define kWindowMetalNoContentSeparatorAttribute (1L << 11)
+#endif
static CONST struct StrIntMap styleMap[] = {
{ "documentProc", documentProc },
{ "noGrowDocProc", documentProc },
@@ -4957,6 +4981,7 @@ TkMacOSXWinStyle(
{ "overlay", kOverlayWindowClass },
{ "sheetAlert", kSheetAlertWindowClass },
{ "altPlain", kAltPlainWindowClass },
+ { "simple", kSimpleWindowClass },
{ "drawer", kDrawerWindowClass },
{ NULL, 0 }
};
@@ -4968,16 +4993,20 @@ TkMacOSXWinStyle(
};
static CONST struct StrIntMap attrMap[] = {
{ "closeBox", kWindowCloseBoxAttribute },
- { "fullZoom", kWindowHorizontalZoomAttribute | kWindowVerticalZoomAttribute },
{ "horizontalZoom", kWindowHorizontalZoomAttribute },
{ "verticalZoom", kWindowVerticalZoomAttribute },
+ { "fullZoom", kWindowFullZoomAttribute },
{ "collapseBox", kWindowCollapseBoxAttribute },
{ "resizable", kWindowResizableAttribute },
{ "sideTitlebar", kWindowSideTitlebarAttribute },
{ "toolbarButton", kWindowToolbarButtonAttribute },
{ "metal", kWindowMetalAttribute },
- { "noActivates", kWindowNoActivatesAttribute },
+ { "noTitleBar", kWindowNoTitleBarAttribute },
+ { "metalNoContentSeparator", kWindowMetalNoContentSeparatorAttribute },
+ { "doesNotCycle", kWindowDoesNotCycleAttribute },
{ "noUpdates", kWindowNoUpdatesAttribute },
+ { "noActivates", kWindowNoActivatesAttribute },
+ { "opaqueForEvents", kWindowOpaqueForEventsAttribute },
{ "compositing", kWindowCompositingAttribute },
{ "noShadow", kWindowNoShadowAttribute },
{ "hideOnSuspend", kWindowHideOnSuspendAttribute },
@@ -4985,6 +5014,7 @@ TkMacOSXWinStyle(
{ "hideOnFullScreen", kWindowHideOnFullScreenAttribute },
{ "inWindowMenu", kWindowInWindowMenuAttribute },
{ "ignoreClicks", kWindowIgnoreClicksAttribute },
+ { "noConstrain", kWindowNoConstrainAttribute },
{ "standardDocument", kWindowStandardDocumentAttributes },
{ "standardFloating", kWindowStandardFloatingAttributes },
{ NULL, 0 }
@@ -5108,9 +5138,11 @@ TkpMakeMenuWindow(
* floating menu. */
{
if (transient) {
- ((TkWindow *) tkwin)->wmInfoPtr->style = plainDBox;
+ ((TkWindow *) tkwin)->wmInfoPtr->macClass = kSimpleWindowClass;
+ ((TkWindow *) tkwin)->wmInfoPtr->attributes = kWindowNoActivatesAttribute;
} else {
- ((TkWindow *) tkwin)->wmInfoPtr->style = floatProc;
+ ((TkWindow *) tkwin)->wmInfoPtr->macClass = kFloatingWindowClass;
+ ((TkWindow *) tkwin)->wmInfoPtr->attributes = kWindowStandardFloatingAttributes;
((TkWindow *) tkwin)->wmInfoPtr->flags |= WM_WIDTH_NOT_RESIZABLE;
((TkWindow *) tkwin)->wmInfoPtr->flags |= WM_HEIGHT_NOT_RESIZABLE;
}
@@ -5228,6 +5260,15 @@ TkMacOSXMakeRealWindowExist(
MoveWindowStructure(newWindow, geometry.left, geometry.top);
SetPort(GetWindowPort(newWindow));
+ /*
+ * overrideredirect windows are not activated by the window server and
+ * don't receive activate events.
+ */
+ if (winPtr->atts.override_redirect) {
+ SetWindowActivationScope(newWindow, kWindowActivationScopeNone);
+ ChangeWindowAttributes(newWindow, kWindowNoActivatesAttribute, 0);
+ }
+
if ((wmPtr->master != None) && winPtr->atts.override_redirect) {
/*
* If we are transient and overrideredirect, use the utility class