summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-29 19:11:39 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-29 19:11:39 (GMT)
commite84a51445533a80a68358e86f1e7c1ccde38a433 (patch)
tree76a2fb5dc968b3fbf6fc82a32d91feb7dd1616f9
parentfb0ecf4500a7e434b90027bbc19f95c8a2d3fb6e (diff)
downloadtk-e84a51445533a80a68358e86f1e7c1ccde38a433.zip
tk-e84a51445533a80a68358e86f1e7c1ccde38a433.tar.gz
tk-e84a51445533a80a68358e86f1e7c1ccde38a433.tar.bz2
Make TkGenerateActivateEvents() available to Win32 and X11
-rw-r--r--generic/tkEvent.c41
-rw-r--r--generic/tkInt.decls46
-rw-r--r--generic/tkIntPlatDecls.h19
-rw-r--r--generic/tkPointer.c41
-rw-r--r--generic/tkStubInit.c6
5 files changed, 63 insertions, 90 deletions
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 3643a9f..0beb8b6 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -1630,6 +1630,47 @@ TkQueueEventForAllChildren(
/*
*----------------------------------------------------------------------
*
+ * TkGenerateActivateEvents --
+ *
+ * This function is called by the Mac and Windows window manager routines
+ * when a toplevel window is activated or deactivated.
+ * Activate/Deactivate events will be sent to every subwindow of the
+ * toplevel followed by a FocusIn/FocusOut message.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Generates X events.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkGenerateActivateEvents(
+ TkWindow *winPtr, /* Toplevel to activate. */
+ int active) /* Non-zero if the window is being activated,
+ * else 0.*/
+{
+ XEvent event;
+
+ /*
+ * Generate Activate and Deactivate events. This event is sent to every
+ * subwindow in a toplevel window.
+ */
+
+ event.xany.serial = NextRequest(winPtr->display);
+ event.xany.send_event = False;
+ event.xany.display = winPtr->display;
+ event.xany.window = winPtr->window;
+
+ event.xany.type = active ? ActivateNotify : DeactivateNotify;
+ TkQueueEventForAllChildren(winPtr, &event);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WindowEventProc --
*
* This function is called by Tcl_DoOneEvent when a window event reaches
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 40005ea..bb2057b 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -648,10 +648,9 @@ interface tkIntPlat
declare 0 x11 {
void TkCreateXEventSource(void)
}
-#
-# Slot 1 unused (WAS: TkFreeWindowId)
-# Slot 2 unused (WAS: TkInitXId)
-#
+declare 2 x11 {
+ void TkGenerateActivateEvents(TkWindow *winPtr, int active)
+}
declare 3 x11 {
int TkpCmapStressed(Tk_Window tkwin, Colormap colormap)
}
@@ -676,9 +675,6 @@ declare 9 x11 {
declare 10 x11 {
void TkSendCleanup(TkDisplay *dispPtr)
}
-#
-# Slot 11 unused (WAS: TkFreeXId)
-#
declare 12 x11 {
int TkpWmSetState(TkWindow *winPtr, int state)
}
@@ -880,16 +876,9 @@ declare 47 win {
declare 0 aqua {
void TkGenerateActivateEvents(TkWindow *winPtr, int active)
}
-
-# removed duplicates from tkInt table
-#declare 1 aqua {
-# Pixmap TkpCreateNativeBitmap(Display *display, const void *source)
-#}
-#
-#declare 2 aqua {
-# void TkpDefineNativeBitmaps(void)
-#}
-
+declare 2 aqua {
+ void TkGenerateActivateEvents_(TkWindow *winPtr, int active)
+}
declare 3 aqua {
void TkPointerDeadWindow(TkWindow *winPtr)
}
@@ -920,21 +909,9 @@ declare 11 aqua {
declare 12 aqua {
void TkMacOSXHandleTearoffMenu(void)
}
-
-# removed duplicate from tkPlat table(tk.decls)
-#declare 13 aqua {
-# void TkMacOSXInvalClipRgns(TkWindow *winPtr)
-#}
-
declare 14 aqua {
int TkMacOSXDoHLEvent(void *theEvent)
}
-
-# removed duplicate from tkPlat table(tk.decls)
-#declare 15 aqua {
-# void *TkMacOSXGetDrawablePort(Drawable drawable)
-#}
-
declare 16 aqua {
Window TkMacOSXGetXWindow(void *macWinPtr)
}
@@ -1012,9 +989,6 @@ declare 38 aqua {
declare 39 aqua {
void TkSetWMName(TkWindow *winPtr, Tk_Uid titleUid)
}
-#
-# Slot 40 unused (WAS: TkSuspendClipboard)
-#
declare 41 aqua {
int TkMacOSXZoomToplevel(void *whichWindow, short zoomPart)
}
@@ -1049,17 +1023,9 @@ declare 51 aqua {
declare 52 aqua {
void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag)
}
-
-# removed duplicate from tkPlat table (tk.decls)
-#declare 52 aqua {
-# void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
-# int width, int height, int flags)
-#}
-
declare 53 aqua {
unsigned long TkpGetMS(void)
}
-
# For Canvas3d, requested by Sean Woods
declare 54 aqua {
void *TkMacOSXDrawable(Drawable drawable)
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index 16c18a8..8221d7a 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -151,7 +151,9 @@ EXTERN Tk_Window TkpGetCapture(void);
EXTERN void TkGenerateActivateEvents(TkWindow *winPtr,
int active);
/* Slot 1 is reserved */
-/* Slot 2 is reserved */
+/* 2 */
+EXTERN void TkGenerateActivateEvents_(TkWindow *winPtr,
+ int active);
/* 3 */
EXTERN void TkPointerDeadWindow(TkWindow *winPtr);
/* 4 */
@@ -266,7 +268,9 @@ EXTERN int TkpScanWindowId(Tcl_Interp *interp,
/* 0 */
EXTERN void TkCreateXEventSource(void);
/* Slot 1 is reserved */
-/* Slot 2 is reserved */
+/* 2 */
+EXTERN void TkGenerateActivateEvents(TkWindow *winPtr,
+ int active);
/* 3 */
EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap);
/* 4 */
@@ -392,7 +396,7 @@ typedef struct TkIntPlatStubs {
#ifdef MAC_OSX_TK /* AQUA */
void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 0 */
void (*reserved1)(void);
- void (*reserved2)(void);
+ void (*tkGenerateActivateEvents_) (TkWindow *winPtr, int active); /* 2 */
void (*tkPointerDeadWindow) (TkWindow *winPtr); /* 3 */
void (*tkpSetCapture) (TkWindow *winPtr); /* 4 */
void (*tkpSetCursor) (TkpCursor cursor); /* 5 */
@@ -450,7 +454,7 @@ typedef struct TkIntPlatStubs {
#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */
void (*tkCreateXEventSource) (void); /* 0 */
void (*reserved1)(void);
- void (*reserved2)(void);
+ void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */
int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 3 */
void (*tkpSync) (Display *display); /* 4 */
Window (*tkUnixContainerId) (TkWindow *winPtr); /* 5 */
@@ -609,7 +613,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkGenerateActivateEvents \
(tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 0 */
/* Slot 1 is reserved */
-/* Slot 2 is reserved */
+#define TkGenerateActivateEvents_ \
+ (tkIntPlatStubsPtr->tkGenerateActivateEvents_) /* 2 */
#define TkPointerDeadWindow \
(tkIntPlatStubsPtr->tkPointerDeadWindow) /* 3 */
#define TkpSetCapture \
@@ -715,7 +720,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkCreateXEventSource \
(tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */
/* Slot 1 is reserved */
-/* Slot 2 is reserved */
+#define TkGenerateActivateEvents \
+ (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */
#define TkpCmapStressed \
(tkIntPlatStubsPtr->tkpCmapStressed) /* 3 */
#define TkpSync \
@@ -791,6 +797,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#undef TkWmCleanup_
#undef TkSendCleanup_
#undef TkpTestsendCmd_
+#undef TkGenerateActivateEvents_
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index f764904..06359a9 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -594,47 +594,6 @@ XDefineCursor(
}
/*
- *----------------------------------------------------------------------
- *
- * TkGenerateActivateEvents --
- *
- * This function is called by the Mac and Windows window manager routines
- * when a toplevel window is activated or deactivated.
- * Activate/Deactivate events will be sent to every subwindow of the
- * toplevel followed by a FocusIn/FocusOut message.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Generates X events.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkGenerateActivateEvents(
- TkWindow *winPtr, /* Toplevel to activate. */
- int active) /* Non-zero if the window is being activated,
- * else 0.*/
-{
- XEvent event;
-
- /*
- * Generate Activate and Deactivate events. This event is sent to every
- * subwindow in a toplevel window.
- */
-
- event.xany.serial = winPtr->display->request++;
- event.xany.send_event = False;
- event.xany.display = winPtr->display;
- event.xany.window = winPtr->window;
-
- event.xany.type = active ? ActivateNotify : DeactivateNotify;
- TkQueueEventForAllChildren(winPtr, &event);
-}
-
-/*
* Local Variables:
* mode: c
* c-basic-offset: 4
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 57f64b3..61c698a 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -61,6 +61,7 @@ MODULE_SCOPE const TkStubs tkStubs;
#define TkMacOSXInitMenus_ TkMacOSXInitMenus
#define TkMacOSXInitAppleEvents_ TkMacOSXInitAppleEvents
#define TkGenWMConfigureEvent_ TkGenWMConfigureEvent
+#define TkGenerateActivateEvents_ TkGenerateActivateEvents
#ifdef _WIN32
@@ -199,7 +200,6 @@ int TkSubtractRegion (TkRegion a, TkRegion b, TkRegion c)
# define Tk_PointerEvent 0
# define Tk_TranslateWinEvent 0
# define TkAlignImageData 0
-# define TkGenerateActivateEvents 0
# define TkpGetMS 0
# define TkpGetCapture 0
# define TkPointerDeadWindow 0
@@ -543,7 +543,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
#ifdef MAC_OSX_TK /* AQUA */
TkGenerateActivateEvents, /* 0 */
0, /* 1 */
- 0, /* 2 */
+ TkGenerateActivateEvents_, /* 2 */
TkPointerDeadWindow, /* 3 */
TkpSetCapture, /* 4 */
TkpSetCursor, /* 5 */
@@ -601,7 +601,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
#if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */
TkCreateXEventSource, /* 0 */
0, /* 1 */
- 0, /* 2 */
+ TkGenerateActivateEvents, /* 2 */
TkpCmapStressed, /* 3 */
TkpSync, /* 4 */
TkUnixContainerId, /* 5 */