Revision: 75314
http://sourceforge.net/p/brlcad/code/75314
Author: starseeker
Date: 2020-04-09 01:40:35 +0000 (Thu, 09 Apr 2020)
Log Message:
-----------
rough in logic for eventhandlers
Modified Paths:
--------------
brlcad/trunk/include/dm.h
brlcad/trunk/src/libdm/dm-wgl.c
brlcad/trunk/src/libtclcad/dm_tcl.c
Modified: brlcad/trunk/include/dm.h
===================================================================
--- brlcad/trunk/include/dm.h 2020-04-08 23:17:26 UTC (rev 75313)
+++ brlcad/trunk/include/dm.h 2020-04-09 01:40:35 UTC (rev 75314)
@@ -269,6 +269,10 @@
void (*dm_window_set_bg)(dm *, dm_win, unsigned long);
/* Tk_Screen */
dm_screen (*dm_get_screen)(dm *, dm_win);
+ /* Tk_CreateEventHandler */
+ void (*dm_eventhandler_create)(dm *, dm_win);
+ /* Tk_DeleteEventHandler */
+ void (*dm_eventhandler_delete)(dm *, dm_win);
};
__BEGIN_DECLS
Modified: brlcad/trunk/src/libdm/dm-wgl.c
===================================================================
--- brlcad/trunk/src/libdm/dm-wgl.c 2020-04-08 23:17:26 UTC (rev 75313)
+++ brlcad/trunk/src/libdm/dm-wgl.c 2020-04-09 01:40:35 UTC (rev 75314)
@@ -191,17 +191,6 @@
return BRLCAD_OK;
}
-HIDDEN void
-WGLEventProc(ClientData clientData, XEvent *UNUSED(eventPtr))
-{
- dm *dmp = (dm *)clientData;
- /* Need to make things visible after a Window minimization, but don't
- want the out-of-date visual - for now, do two swaps. If there's some
- way to trigger a Window re-draw without doing buffer swaps, that would
- be preferable... */
- SwapBuffers(((struct dm_xvars *)dmp->dm_vars.pub_vars)->hdc);
- SwapBuffers(((struct dm_xvars *)dmp->dm_vars.pub_vars)->hdc);
-}
/*
* Fire up the display manager, and the display processor.
*
@@ -481,8 +470,7 @@
(*context->dm_window_map)(dmp, pubvars->xtkwin);
- Tk_CreateEventHandler(pubvars->xtkwin, VisibilityChangeMask, WGLEventProc,
(ClientData)dmp);
-
+ (*context->dm_eventhandler_create)(dmp, pubvars->xtkwin);
return dmp;
}
@@ -665,7 +653,7 @@
XFreeColormap(pub_vars->dpy, pub_vars->cmap);
if (pub_vars->xtkwin) {
- Tk_DeleteEventHandler(pubvars->xtkwin, VisibilityChangeMask,
WGLEventProc, (ClientData)dmp);
+ (*context->dm_eventhandler_delete)(dmp, pubvars->xtkwin);
(*context->dm_window_destroy)(dmp, pubvars->xtkwin);
}
}
Modified: brlcad/trunk/src/libtclcad/dm_tcl.c
===================================================================
--- brlcad/trunk/src/libtclcad/dm_tcl.c 2020-04-08 23:17:26 UTC (rev 75313)
+++ brlcad/trunk/src/libtclcad/dm_tcl.c 2020-04-09 01:40:35 UTC (rev 75314)
@@ -2773,7 +2773,7 @@
Tk_SetWindowBackground((Tk_Window)win, bg);
}
-/* TK_Screen */
+/* Tk_Screen */
static dm_screen
tk_get_screen(dm *UNUSED(dmp), dm_win win)
{
@@ -2780,7 +2780,36 @@
return (dm_screen)Tk_Screen((Tk_Window)win);
}
+static void
+WGLEventProc(ClientData clientData, XEvent *UNUSED(eventPtr))
+{
+ dm *dmp = (dm *)clientData;
+ if (!dmp) return;
+#ifdef _WIN32
+ /* Need to make things visible after a Window minimization, but don't
+ want the out-of-date visual - for now, do two swaps. If there's some
+ way to trigger a Window re-draw without doing buffer swaps, that would
+ be preferable... */
+ SwapBuffers(((struct dm_xvars *)dmp->dm_vars.pub_vars)->hdc);
+ SwapBuffers(((struct dm_xvars *)dmp->dm_vars.pub_vars)->hdc);
+#endif
+}
+/* Tk_CreateEventHandler */
+static void
+tk_eventhandler_create(dm *dmp, dm_win win)
+{
+ Tk_CreateEventHandler((Tk_Window)win, VisibilityChangeMask, WGLEventProc,
(ClientData)dmp);
+}
+
+/* Tk_DeleteEventHandler */
+static void
+tk_eventhandler_delete(dm *dmp, dm_win win)
+{
+ Tk_DeleteEventHandler((Tk_Window)win, VisibilityChangeMask, WGLEventProc,
(ClientData)dmp);
+}
+
+
struct dm_context dm_tk_context = {
/* Tk_MainWindow -> dm_window_main */
&tk_window_main,
@@ -2831,7 +2860,13 @@
&tk_window_set_bg,
/* dm_screen -> Tk_Screen */
- &tk_get_screen
+ &tk_get_screen,
+
+ /* dm_eventhandler_create -> Tk_CreateEventHandler */
+ &tk_eventhandler_create,
+
+ /* dm_eventhandler_delete -> Tk_DeleteEventHandler */
+ &tk_eventhandler_delete
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits