aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Screen.c
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-10-10 17:58:57 +0200
committerReinhard Tartler <siretart@tauware.de>2011-10-10 17:58:57 +0200
commit25af86cd3aaa61dc4a3d69825aa523177c2229e1 (patch)
treeeae047412a07c76b65446f6f528cc5da53688569 /nx-X11/programs/Xserver/hw/nxagent/Screen.c
parente9132da09462b3d2607a97e2f580cbd3144819eb (diff)
downloadnx-libs-25af86cd3aaa61dc4a3d69825aa523177c2229e1.tar.gz
nx-libs-25af86cd3aaa61dc4a3d69825aa523177c2229e1.tar.bz2
nx-libs-25af86cd3aaa61dc4a3d69825aa523177c2229e1.zip
Imported nxagent-3.4.0-16.tar.gznxagent/3.4.0-16
Summary: Imported nxagent-3.4.0-16.tar.gz Keywords: Imported nxagent-3.4.0-16.tar.gz into Git repository
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Screen.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c195
1 files changed, 191 insertions, 4 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index 2db7df8fe..0a0d409eb 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -1,6 +1,6 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
@@ -160,6 +160,7 @@ void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port);
#endif
+Window nxagentIconWindow = None;
Window nxagentFullscreenWindow = None;
#ifdef VIEWPORT_FRAME
@@ -287,6 +288,166 @@ void nxagentSetPixmapFormats(ScreenInfo *screenInfo)
}
}
+void nxagentMinimizeFromFullScreen(ScreenPtr pScreen)
+{
+ XUnmapWindow(nxagentDisplay, nxagentFullscreenWindow);
+
+ if (nxagentIpaq)
+ {
+ XMapWindow(nxagentDisplay, nxagentIconWindow);
+ XIconifyWindow(nxagentDisplay, nxagentIconWindow,
+ DefaultScreen(nxagentDisplay));
+ }
+ else
+ {
+ XIconifyWindow(nxagentDisplay, nxagentIconWindow,
+ DefaultScreen(nxagentDisplay));
+ }
+}
+
+void nxagentMaximizeToFullScreen(ScreenPtr pScreen)
+{
+ if (nxagentIpaq)
+ {
+ XUnmapWindow(nxagentDisplay, nxagentIconWindow);
+
+ XMapWindow(nxagentDisplay, nxagentFullscreenWindow);
+ }
+ else
+ {
+/*
+ XUnmapWindow(nxagentDisplay, nxagentIconWindow);
+*/
+/*
+FIXME: We'll chech for ReparentNotify and LeaveNotify events after XReparentWindow()
+ in order to avoid the session window is iconified.
+ We could avoid the sesssion window is iconified when a LeaveNotify event is received,
+ so this check would be unnecessary.
+*/
+ struct timeval timeout;
+ int i;
+ XEvent e;
+
+ XReparentWindow(nxagentDisplay, nxagentFullscreenWindow,
+ RootWindow(nxagentDisplay, DefaultScreen(nxagentDisplay)), 0, 0);
+
+ for (i = 0; i < 100 && nxagentWMIsRunning; i++)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentMaximizeToFullscreen: WARNING! Going to wait for the ReparentNotify event.\n");
+ #endif
+
+ if (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, ReparentNotify, &e))
+ {
+ break;
+ }
+
+ XSync(nxagentDisplay, 0);
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 50 * 1000;
+
+ nxagentWaitEvents(nxagentDisplay, &timeout);
+ }
+
+ XMapRaised(nxagentDisplay, nxagentFullscreenWindow);
+
+ XIconifyWindow(nxagentDisplay, nxagentIconWindow,
+ DefaultScreen(nxagentDisplay));
+
+ while (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, LeaveNotify, &e));
+/*
+ XMapWindow(nxagentDisplay, nxagentIconWindow);
+*/
+ }
+}
+
+Window nxagentCreateIconWindow()
+{
+ XSetWindowAttributes attributes;
+ unsigned long valuemask;
+ char* window_name;
+ XTextProperty windowName;
+ XSizeHints sizeHints;
+ XWMHints wmHints;
+ Window w;
+ Mask mask;
+
+ /*
+ * Create icon window.
+ */
+
+ attributes.override_redirect = False;
+ attributes.colormap = DefaultColormap(nxagentDisplay, DefaultScreen(nxagentDisplay));
+ attributes.background_pixmap = nxagentScreenSaverPixmap;
+ valuemask = CWOverrideRedirect | CWBackPixmap | CWColormap;
+
+ #ifdef TEST
+ fprintf(stderr, "nxagentCreateIconWindow: Going to create new icon window.\n");
+ #endif
+
+ w = XCreateWindow(nxagentDisplay, DefaultRootWindow(nxagentDisplay),
+ 0, 0, 1, 1, 0,
+ DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)),
+ InputOutput,
+ DefaultVisual(nxagentDisplay, DefaultScreen(nxagentDisplay)),
+ valuemask, &attributes);
+
+ #ifdef TEST
+ fprintf(stderr, "nxagentCreateIconWindow: Created new icon window with id [%ld].\n",
+ nxagentIconWindow);
+ #endif
+
+ /*
+ * Set hints to the window manager for the icon window.
+ */
+
+ window_name = nxagentWindowName;
+ XStringListToTextProperty(&window_name, 1, &windowName);
+ sizeHints.flags = PMinSize | PMaxSize;
+ sizeHints.min_width = sizeHints.max_width = 1;
+ sizeHints.min_height = sizeHints.max_height = 1;
+ wmHints.flags = IconPixmapHint | IconMaskHint;
+ wmHints.initial_state = IconicState;
+ wmHints.icon_pixmap = nxagentIconPixmap;
+
+ if (useXpmIcon)
+ {
+ wmHints.icon_mask = nxagentIconShape;
+ wmHints.flags = IconPixmapHint | IconMaskHint;
+ }
+ else
+ {
+ wmHints.flags = StateHint | IconPixmapHint;
+ }
+
+ XSetWMProperties(nxagentDisplay, w,
+ &windowName, &windowName,
+ NULL , 0 , &sizeHints, &wmHints, NULL);
+
+ /*
+ * Enable events from the icon window.
+ */
+
+ nxagentGetDefaultEventMask(&mask);
+
+ XSelectInput(nxagentDisplay, w, (mask & ~(KeyPressMask |
+ KeyReleaseMask)) | StructureNotifyMask);
+
+ /*
+ * Notify to client if user closes icon window.
+ */
+
+ if (nxagentWMIsRunning && !nxagentOption(Rootless))
+ {
+ XlibAtom deleteWMAtom = nxagentAtoms[2]; /* WM_DELETE_WINDOW */
+
+ XSetWMProtocols(nxagentDisplay, w, &deleteWMAtom, 1);
+ }
+
+ return w;
+}
+
Bool nxagentMagicPixelZone(int x, int y)
{
return (x >= nxagentOption(Width) - 1 && y < 1);
@@ -816,6 +977,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
nxagentChangeOption(Fullscreen, False);
+ nxagentChangeOption(AllScreens, False);
+
nxagentFullscreenWindow = 0;
resetAgentPosition = True;
@@ -1221,6 +1384,11 @@ N/A
nxagentChangeOption(Height, gattributes.height);
}
+ if (nxagentOption(AllScreens))
+ {
+ attributes.override_redirect = True;
+ }
+
if (nxagentOption(Fullscreen))
{
/*
@@ -1448,7 +1616,8 @@ N/A
if (nxagentDoFullGeneration == 1 ||
nxagentReconnectTrap == 1)
{
- valuemask = CWBackPixel | CWEventMask | CWColormap;
+ valuemask = CWBackPixel | CWEventMask | CWColormap |
+ (nxagentOption(AllScreens) == 1 ? CWOverrideRedirect : 0);
attributes.background_pixel = nxagentBlackPixel;
@@ -1456,6 +1625,11 @@ N/A
attributes.colormap = nxagentDefaultVisualColormap(nxagentDefaultVisual(pScreen));
+ if (nxagentOption(AllScreens) == 1)
+ {
+ attributes.override_redirect = True;
+ }
+
if (nxagentOption(Fullscreen) == 1)
{
if (nxagentReconnectTrap)
@@ -1635,6 +1809,21 @@ N/A
XClearWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]);
+ if (nxagentOption(AllScreens))
+ {
+ if (nxagentReconnectTrap)
+ {
+ XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, True, GrabModeAsync,
+ GrabModeAsync, CurrentTime);
+ }
+
+ nxagentIconWindow = nxagentCreateIconWindow();
+ }
+ else
+ {
+ nxagentIconWindow = 0;
+ }
+
/*
* When we don't have window manager we grab keyboard
* to let nxagent get keyboard events.
@@ -1983,8 +2172,6 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
int oldMmWidth;
int oldMmHeight;
- RegionPtr pRootWinSize;
-
#ifdef TEST
nxagentPrintAgentGeometry("Before Resize Screen", "nxagentResizeScreen:");
#endif