|
|
3fde6d4 |
Index: pymol-open-source-2.3.0/layer5/main.cpp
|
|
|
3536015 |
===================================================================
|
|
|
3fde6d4 |
--- pymol-open-source-2.3.0.orig/layer5/main.cpp (revision 4149)
|
|
|
3fde6d4 |
+++ pymol-open-source-2.3.0/layer5/main.cpp (working copy)
|
|
|
3536015 |
@@ -34,6 +34,11 @@
|
|
|
3536015 |
#include <dlfcn.h>
|
|
|
3536015 |
#endif
|
|
|
3536015 |
|
|
|
3536015 |
+/* Used for WM_CLASS hack */
|
|
|
3536015 |
+#include <GL/glx.h>
|
|
|
3536015 |
+#include <X11/Xutil.h>
|
|
|
3536015 |
+#include <X11/Xlib.h>
|
|
|
3536015 |
+
|
|
|
3536015 |
#include "PyMOLGlobals.h"
|
|
|
3536015 |
#include "PyMOL.h"
|
|
|
3536015 |
#include "PyMOLOptions.h"
|
|
|
3536015 |
@@ -1025,7 +1030,52 @@
|
|
|
3536015 |
|
|
|
3536015 |
}
|
|
|
3536015 |
|
|
|
3536015 |
+/*========================================================================*/
|
|
|
3536015 |
|
|
|
3536015 |
+static int IgnoreError(Display *display, XErrorEvent *theEvent)
|
|
|
3536015 |
+{
|
|
|
3536015 |
+ return 0;
|
|
|
3536015 |
+}
|
|
|
3536015 |
+
|
|
|
3536015 |
+static int MainCreateWindow(const char *title)
|
|
|
3536015 |
+{
|
|
|
3536015 |
+ int window;
|
|
|
3536015 |
+ Display *display;
|
|
|
3536015 |
+ GLXDrawable xwin;
|
|
|
3536015 |
+ XClassHint *hint;
|
|
|
3536015 |
+ XErrorHandler oldErrorHandler;
|
|
|
3536015 |
+
|
|
|
3536015 |
+ window = p_glutCreateWindow(title);
|
|
|
3536015 |
+
|
|
|
3536015 |
+ /* Hack to set WM_CLASS hint
|
|
|
3536015 |
+ * This assumes the current drawable is the window we just created which is
|
|
|
3536015 |
+ * a detail of the GLUT implementation. There is no way of getting the XID of
|
|
|
3536015 |
+ * a window using GLUT alone. */
|
|
|
3536015 |
+
|
|
|
3536015 |
+ /* Disable the error handler so in case the assumption fails the program still
|
|
|
3536015 |
+ * works */
|
|
|
3536015 |
+ oldErrorHandler = XSetErrorHandler(IgnoreError);
|
|
|
3536015 |
+
|
|
|
3536015 |
+ display = glXGetCurrentDisplay();
|
|
|
3536015 |
+ if (display) {
|
|
|
3536015 |
+ hint = XAllocClassHint();
|
|
|
3536015 |
+ if (hint) {
|
|
|
3536015 |
+ hint->res_name = "pymol";
|
|
|
3536015 |
+ hint->res_class = "Pymol";
|
|
|
3536015 |
+ xwin = glXGetCurrentDrawable();
|
|
|
3536015 |
+ XSetClassHint(display, xwin, hint);
|
|
|
3536015 |
+ XFree(hint);
|
|
|
3536015 |
+ }
|
|
|
3536015 |
+ /* Make sure all errors are handled before restoring the old error handler */
|
|
|
3536015 |
+ XFlush(display);
|
|
|
3536015 |
+ XSync(display, False);
|
|
|
3536015 |
+ }
|
|
|
3536015 |
+
|
|
|
3536015 |
+ XSetErrorHandler(oldErrorHandler);
|
|
|
3536015 |
+
|
|
|
3536015 |
+ return window;
|
|
|
3536015 |
+}
|
|
|
3536015 |
+
|
|
|
3536015 |
/*========================================================================*/
|
|
|
3536015 |
static void MainInit(PyMOLGlobals * G)
|
|
|
3536015 |
{
|
|
|
3536015 |
@@ -1104,7 +1154,7 @@
|
|
|
3536015 |
p_glutInitWindowSize(640, 480);
|
|
|
3536015 |
p_glutInitDisplayMode(P_GLUT_RGBA | P_GLUT_DEPTH | P_GLUT_DOUBLE);
|
|
|
3536015 |
if(p_glutGet(P_GLUT_DISPLAY_MODE_POSSIBLE)) {
|
|
|
3536015 |
- theWindow = p_glutCreateWindow("PyMOL Viewer");
|
|
|
3536015 |
+ theWindow = MainCreateWindow("PyMOL Viewer");
|
|
|
3536015 |
p_glutFullScreen();
|
|
|
3536015 |
p_glutDestroyWindow(theWindow);
|
|
|
3536015 |
}
|
|
|
3536015 |
@@ -1604,7 +1654,7 @@
|
|
|
3536015 |
|
|
|
3536015 |
p_glutInitWindowSize(G->Option->winX, G->Option->winY);
|
|
|
3536015 |
|
|
|
3536015 |
- theWindow = p_glutCreateWindow("PyMOL Viewer");
|
|
|
3536015 |
+ theWindow = MainCreateWindow("PyMOL Viewer");
|
|
|
3536015 |
|
|
|
3536015 |
if(G->Option->full_screen) {
|
|
|
3536015 |
p_glutFullScreen();
|