aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-10-10 17:58:59 +0200
committerReinhard Tartler <siretart@tauware.de>2011-10-10 17:58:59 +0200
commitb7494f082ad56049c24927afdf89abc852fe06bb (patch)
tree332640e859cbc9711ed183fe1e86895d1d945ca5 /nx-X11/programs
parentc078024019d334eb96fbfaf922c64297c9a0c6e0 (diff)
downloadnx-libs-b7494f082ad56049c24927afdf89abc852fe06bb.tar.gz
nx-libs-b7494f082ad56049c24927afdf89abc852fe06bb.tar.bz2
nx-libs-b7494f082ad56049c24927afdf89abc852fe06bb.zip
Imported nxagent-3.4.0-8.tar.gznxagent/3.4.0-8
Summary: Imported nxagent-3.4.0-8.tar.gz Keywords: Imported nxagent-3.4.0-8.tar.gz into Git repository
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.c28
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/CHANGELOG56
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c553
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.h1
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Imakefile3
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keystroke.c12
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Pixels.h18
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Pointer.c34
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Pointer.h9
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Render.c281
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Render.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Rootless.c43
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c234
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.h3
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c269
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c47
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c.NX.original47
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c58
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c.NX.original58
21 files changed, 1179 insertions, 583 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
index 7f12406f5..171df95a9 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
@@ -66,19 +66,21 @@ Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
{
- "NX_IDENTITY", /* 0 */
- "WM_PROTOCOLS", /* 1 */
- "WM_DELETE_WINDOW", /* 2 */
- "WM_NX_READY", /* 3 */
- "MCOPGLOBALS", /* 4 */
- "NX_CUT_BUFFER_SERVER", /* 5 */
- "TARGETS", /* 6 */
- "TEXT", /* 7 */
- "NX_AGENT_SIGNATURE", /* 8 */
- "NXDARWIN", /* 9 */
- "CLIPBOARD", /* 10 */
- "TIMESTAMP", /* 11 */
- "UTF8_STRING", /* 12 */
+ "NX_IDENTITY", /* 0 */
+ "WM_PROTOCOLS", /* 1 */
+ "WM_DELETE_WINDOW", /* 2 */
+ "WM_NX_READY", /* 3 */
+ "MCOPGLOBALS", /* 4 */
+ "NX_CUT_BUFFER_SERVER", /* 5 */
+ "TARGETS", /* 6 */
+ "TEXT", /* 7 */
+ "NX_AGENT_SIGNATURE", /* 8 */
+ "NXDARWIN", /* 9 */
+ "CLIPBOARD", /* 10 */
+ "TIMESTAMP", /* 11 */
+ "UTF8_STRING", /* 12 */
+ "_NET_WM_STATE", /* 13 */
+ "_NET_WM_STATE_FULLSCREEN", /* 14 */
NULL,
NULL
};
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
index d8acb9442..f49f2751e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
@@ -22,7 +22,7 @@
#include "../../include/window.h"
#include "screenint.h"
-#define NXAGENT_NUMBER_OF_ATOMS 14
+#define NXAGENT_NUMBER_OF_ATOMS 16
extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
diff --git a/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG b/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG
index 1a82e9abf..9e067d407 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG
+++ b/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG
@@ -1,5 +1,61 @@
ChangeLog:
+nxagent-3.4.0-8
+
+- Grab the keyboard in fullscreen mode on EnterNotify only if mode is
+ 'NotifyNormal'.
+
+- Yield control in the dispatch loop in case we stop the smart sche-
+ duler timer while waiting for a reply from the remote display.
+
+nxagent-3.4.0-7
+
+- Fixed TR08D01478. The communication with the compiz window manager
+ by means of the _NET_WM_PING property was not handled properly.
+
+- Fixed a type mismatch in XKB events on 64 bit platforms.
+
+- Moved grab/ungrab keyboard from focus in/out event to enter/leave
+ notify event.
+
+- Removed nxagentIconWindow because it's not longer used.
+
+nxagent-3.4.0-6
+
+- Fixed TR09F02102. Problem was with pointer buttons map.
+
+- Fixed TR02H02327. Some KeyRelease events was discarded.
+
+- Fixed up Num and Caps locks.
+
+- Fixed TR03H02335. Emulated right mouse button for Mac clients.
+
+- Added utilities to print info about internal and remote windows.
+
+- Fixed TR01F01995. Solved a picture resource leak by destroying remo-
+ te pictures only when their reference counter returns to zero.
+
+- Fixed TR04H02337. Errors occurred because pictures with no drawable
+ were handled badly.
+
+- Implemented handling nxagent's private for gradient pictures and so-
+ lid fill picture.
+
+- Fixed BadMatch condition check in function ProcRenderComposite.
+
+- Fixed nxagentComposite() to handle situations with source picture
+ drawable pointing to NULL.
+
+- Implemented render acceleration for requests: CreateSolidFill,
+ CreateLinearGradient, CreateRadialGradient, CreateConicalGradient.
+
+- Fixed TR03G02196. Dialogs are shown to the fore when the NX session
+ is in fullscreen mode.
+
+- Changed mechanism to switch to fullscreen mode. Now the override
+ redirect attribute is no longer used and _NET_WM_STATE_FULLSCREEN
+ hint is sent to the WM.
+
nxagent-3.4.0-5
- Updated copyright to year 2010.
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index ca21423aa..33eafa55b 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -76,7 +76,9 @@
#include "input.h"
#endif
+#define Time XlibXID
#include "XKBlib.h"
+#undef Time
#define GC XlibGC
#define Font XlibFont
@@ -203,6 +205,8 @@ CARD32 nxagentLastEventTime = 0;
CARD32 nxagentLastKeyPressTime = 0;
Time nxagentLastServerTime = 0;
+int nxagentPointerAndKeyboardGrabbed = 0;
+
/*
* Used for storing windows that need to
* receive expose events from the agent.
@@ -219,6 +223,16 @@ static void nxagentForwardRemoteExpose(void);
static int nxagentClipAndSendExpose(WindowPtr pWin, pointer ptr);
/*
+ * This is from NXproperty.c.
+ */
+
+int GetWindowProperty(WindowPtr pWin, Atom property, long longOffset,
+ long longLength, Bool delete, Atom type,
+ Atom *actualType, int *format, unsigned
+ long *nItems, unsigned long *bytesAfter,
+ unsigned char **propData);
+
+/*
* Associate a resource to a drawable and
* store the region affected by the split
* operation.
@@ -274,6 +288,280 @@ void ProcessInputEvents()
mieqProcessInputEvents();
}
+#ifdef DEBUG_TREE
+
+/*
+ * Print ID and name of window.
+ */
+
+void nxagentRemoteWindowID(Window window, Bool newline)
+{
+#ifdef NO_I18N
+ char *winName;
+#else
+ XTextProperty tp;
+#endif
+
+ fprintf(stderr, "0x%lx", window);
+
+ if (!window)
+ {
+ fprintf(stderr, " (none) ");
+ }
+ else
+ {
+ if (window == DefaultRootWindow(nxagentDisplay))
+ {
+ fprintf(stderr, " (the root window) ");
+ }
+
+#ifdef NO_I18N
+
+ if (!XFetchName(nxagentDisplay, window, &winName))
+ {
+ fprintf(stderr, " (has no name) ");
+ }
+ else if (winName)
+ {
+ fprintf(stderr, " \"%s\" ", winName);
+ XFree(winName);
+ }
+
+#else
+
+ if (XGetWMName(nxagentDisplay, window, &tp) != 0)
+ {
+ fprintf(stderr, " (has no name) ");
+ }
+ else if (tp.nitems > 0)
+ {
+ int count = 0;
+ int i, ret;
+ char **list = NULL;
+
+ fprintf(stderr, " \"");
+
+ ret = XmbTextPropertyToTextList(nxagentDisplay, &tp, &list, &count);
+
+ if ((ret == Success || ret > 0) && list != NULL)
+ {
+ for (i = 0; i < count; i++)
+ {
+ fprintf(stderr, "%s", list[i]);
+ }
+
+ XFreeStringList(list);
+ }
+ else
+ {
+ fprintf(stderr, "%s", tp.value);
+ }
+
+ fprintf(stderr, "\" ");
+ }
+
+#endif
+
+ else
+ {
+ fprintf(stderr, " (has no name) ");
+ }
+ }
+
+ if (newline == TRUE)
+ {
+ fprintf(stderr, "\n");
+ }
+
+ return;
+}
+
+/*
+ * Print info about remote window.
+ */
+
+void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine)
+{
+ XWindowAttributes attributes;
+ int i;
+
+ if (XGetWindowAttributes(nxagentDisplay, win, &attributes) == 0)
+ {
+ return;
+ }
+
+ for (i = 0; i < indent; i++)
+ {
+ fprintf(stderr, " ");
+ }
+
+ fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s "
+ "override_redirect=%s\n", attributes.x, attributes.y,
+ attributes.width, attributes.height, (attributes.class == 0) ?
+ "InputOutput" : "InputOnly", (attributes.map_state == 0) ?
+ "IsUnmapped" : (attributes.map_state == 1 ?
+ "IsUnviewable" : "IsViewable"),
+ (attributes.override_redirect == 0) ?
+ "No" : "Yes" );
+
+ if (newLine == TRUE)
+ {
+ fprintf(stderr, "\n");
+ }
+}
+
+/*
+ * Walk remote windows tree.
+ */
+
+void nxagentRemoteWindowsTree(Window window, int level)
+{
+ int i, j;
+ Window rootWin, parentWin;
+ unsigned int numChildren;
+ Window *childList;
+
+ if (!XQueryTree(nxagentDisplay, window, &rootWin, &parentWin, &childList,
+ &numChildren))
+ {
+ fprintf(stderr, "nxagentRemoteWindowsTree - XQueryTree failed.\n");
+
+ return;
+ }
+
+ if (level == 0)
+ {
+ fprintf(stderr, "\n");
+
+ fprintf(stderr, " Root Window ID: ");
+ nxagentRemoteWindowID(rootWin, TRUE);
+
+ fprintf(stderr, " Parent window ID: ");
+ nxagentRemoteWindowID(parentWin, TRUE);
+ }
+
+ if (level == 0 || numChildren > 0)
+ {
+ fprintf(stderr, " ");
+
+ for (j = 0; j < level; j++)
+ {
+ fprintf(stderr, " ");
+ }
+
+ fprintf(stderr, "%d child%s%s\n", numChildren, (numChildren == 1) ? "" :
+ "ren", (numChildren == 1) ? ":" : ".");
+ }
+
+ for (i = (int) numChildren - 1; i >= 0; i--)
+ {
+ fprintf(stderr, " ");
+
+ for (j = 0; j < level; j++)
+ {
+ fprintf(stderr, " ");
+ }
+
+ nxagentRemoteWindowID(childList[i], TRUE);
+
+ nxagentRemoteWindowInfo(childList[i], (level * 5) + 6, TRUE);
+
+ nxagentRemoteWindowsTree(childList[i], level + 1);
+ }
+
+ if (childList)
+ {
+ XFree((char *) childList);
+ }
+}
+
+/*
+ * Print info about internal window.
+ */
+
+void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
+{
+ int i;
+ int result;
+ unsigned long ulReturnItems;
+ unsigned long ulReturnBytesLeft;
+ Atom atomReturnType;
+ int iReturnFormat;
+ unsigned char *pszReturnData = NULL;
+
+ fprintf(stderr, "Window ID=[0x%lx] Remote ID=[0x%lx] ", pWin -> drawable.id,
+ nxagentWindow(pWin));
+
+ result = GetWindowProperty(pWin, MakeAtom("WM_NAME", 7, False) , 0,
+ sizeof(CARD32), False, AnyPropertyType,
+ &atomReturnType, &iReturnFormat,
+ &ulReturnItems, &ulReturnBytesLeft,
+ &pszReturnData);
+
+ fprintf(stderr, "Name: ");
+
+ if (result == Success && pszReturnData != NULL)
+ {
+ pszReturnData[ulReturnItems] = '\0';
+
+ fprintf(stderr, "\"%s\"\n", (char *) pszReturnData);
+ }
+ else
+ {
+ fprintf(stderr, "%s\n", "( has no name )");
+ }
+
+ for (i = 0; i < indent; i++)
+ {
+ fprintf(stderr, " ");
+ }
+
+ fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s "
+ "override_redirect=%s", pWin -> drawable.x, pWin -> drawable.y,
+ pWin -> drawable.width, pWin -> drawable.height,
+ (pWin -> drawable.class == 0) ? "InputOutput" :
+ "InputOnly", (pWin -> mapped == 0) ?
+ "IsUnmapped" : (pWin -> mapped == 1 ?
+ "IsUnviewable" : "IsViewable"),
+ (pWin -> overrideRedirect == 0) ?
+ "No" : "Yes");
+
+ if (newLine == TRUE)
+ {
+ fprintf(stderr, "\n");
+ }
+}
+
+/*
+ * Walk internal windows tree.
+ */
+
+void nxagentInternalWindowsTree(WindowPtr pWin, int indent)
+{
+ WindowPtr pChild;
+ int i;
+
+ while (pWin)
+ {
+ pChild = pWin -> firstChild;
+
+ for (i = 0; i < indent; i++)
+ {
+ fprintf(stderr, " ");
+ }
+
+ nxagentInternalWindowInfo(pWin, indent, TRUE);
+
+ fprintf(stderr, "\n");
+
+ nxagentInternalWindowsTree(pChild, indent + 4);
+
+ pWin = pWin -> nextSib;
+ }
+}
+
+#endif /* DEBUG_TREE */
+
void nxagentSwitchResizeMode(ScreenPtr pScreen)
{
XSizeHints sizeHints;
@@ -290,8 +578,11 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
nxagentLaunchDialog(DIALOG_DISABLE_DESKTOP_RESIZE_MODE);
- sizeHints.max_width = nxagentOption(RootWidth);
- sizeHints.max_height = nxagentOption(RootHeight);
+ if (nxagentOption(Fullscreen) == 0)
+ {
+ sizeHints.max_width = nxagentOption(RootWidth);
+ sizeHints.max_height = nxagentOption(RootHeight);
+ }
}
else
{
@@ -299,8 +590,6 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
nxagentLaunchDialog(DIALOG_ENABLE_DESKTOP_RESIZE_MODE);
- nxagentRRSetScreenConfig(pScreen, nxagentOption(Width), nxagentOption(Height));
-
if (nxagentOption(ClientOs) == ClientOsWinnt)
{
NXSetExposeParameters(nxagentDisplay, 0, 0, 0);
@@ -655,6 +944,22 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
{
break;
}
+
+ #ifdef DEBUG_TREE
+
+ case doDebugTree:
+ {
+ fprintf(stderr, "\n ========== nxagentRemoteWindowsTree ==========\n");
+ nxagentRemoteWindowsTree(nxagentWindow(WindowTable[0]), 0);
+
+ fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n");
+ nxagentInternalWindowsTree(WindowTable[0], 0);
+
+ break;
+ }
+
+ #endif /* DEBUG_TREE */
+
case doCloseSession:
{
closeSession = TRUE;
@@ -797,7 +1102,8 @@ FIXME: Don't enqueue the KeyRelease event if the key was
enqueued and to remove the KeyPress afterwards.
*/
- if (inputInfo.keyboard -> key -> down[X.xkey.keycode >> 3] & (1 << (X.xkey.keycode & 7)))
+ if (BitIsOn(inputInfo.keyboard -> key -> down,
+ nxagentConvertKeycode(X.xkey.keycode)))
{
sendKey = 1;
}
@@ -871,6 +1177,23 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentInputEvent = 1;
+ if (nxagentOption(ClientOs) == ClientOsMac && (X.xbutton.state & ControlMask) == ControlMask)
+ {
+ x.u.u.type = ButtonPress;
+ x.u.u.detail = inputInfo.pointer -> button -> map[3];
+ x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
+
+ mieqEnqueue(&x);
+
+ x.u.u.type = ButtonRelease;
+ x.u.u.detail = inputInfo.pointer -> button -> map[3];
+ x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
+
+ mieqEnqueue(&x);
+
+ break;
+ }
+
if (nxagentOption(Fullscreen))
{
if (nxagentMagicPixelZone(X.xbutton.x, X.xbutton.y))
@@ -917,7 +1240,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
X.xbutton.subwindow == None))
{
x.u.u.type = ButtonPress;
- x.u.u.detail = X.xbutton.button;
+ x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button - 1]];
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
if (nxagentOption(Rootless))
@@ -974,6 +1297,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentInputEvent = 1;
+ if (nxagentOption(ClientOs) == ClientOsMac && (X.xbutton.state & ControlMask) == ControlMask)
+ {
+ break;
+ }
+
if (viewportCursor)
{
/*
@@ -990,7 +1318,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (minimize != True)
{
x.u.u.type = ButtonRelease;
- x.u.u.detail = X.xbutton.button;
+ x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button - 1]];
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
if (nxagentOption(Rootless))
@@ -1344,10 +1672,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentScreenTrap = 0;
}
- if (nxagentOption(Fullscreen))
+ if (nxagentOption(Fullscreen) == 1)
{
- if (X.xcrossing.window == nxagentFullscreenWindow &&
- X.xcrossing.detail != NotifyInferior)
+ if (X.xcrossing.window == nxagentDefaultWindows[0] &&
+ X.xcrossing.detail != NotifyInferior &&
+ X.xcrossing.mode == NotifyNormal)
{
nxagentGrabPointerAndKeyboard(&X);
}
@@ -1399,9 +1728,9 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentLastEnteredWindow = NULL;
}
- if (nxagentOption(Fullscreen))
+ if (nxagentPointerAndKeyboardGrabbed == 1)
{
- if (X.xcrossing.window == nxagentFullscreenWindow &&
+ if (X.xcrossing.window == nxagentDefaultWindows[0] &&
X.xcrossing.detail != NotifyInferior &&
X.xcrossing.mode == NotifyNormal)
{
@@ -1660,7 +1989,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
if (nxagentUseNXTrans == 1 && nxagentOption(Rootless) == 0 &&
- nxagentOption(Nested) == 0 && X.xmap.window != nxagentIconWindow)
+ nxagentOption(Nested) == 0)
{
nxagentVisibility = VisibilityFullyObscured;
}
@@ -1701,12 +2030,6 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (nxagentOption(Fullscreen) == 1)
{
- if (X.xmap.window == nxagentIconWindow)
- {
- pScreen = nxagentScreen(X.xmap.window);
- nxagentMaximizeToFullScreen(pScreen);
- }
-
nxagentVisibility = VisibilityUnobscured;
nxagentVisibilityStop = False;
nxagentVisibilityTimeout = GetTimeInMillis() + 2000;
@@ -1716,10 +2039,17 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
case MappingNotify:
{
+ XMappingEvent *mappingEvent = (XMappingEvent *) &X;
+
#ifdef DEBUG
fprintf(stderr, "nxagentDispatchEvents: WARNING! Going to handle new MappingNotify event.\n");
#endif
+ if (mappingEvent -> request == MappingPointer)
+ {
+ nxagentInitPointerMap();
+ }
+
break;
}
default:
@@ -1959,8 +2289,16 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
return 1;
}
- nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis();
+ if (X -> xkey.keycode == 66)
+ {
+ nxagentXkbState.Caps = (~nxagentXkbState.Caps & 1);
+ }
+ else if (X -> xkey.keycode == 77)
+ {
+ nxagentXkbState.Num = (~nxagentXkbState.Num & 1);
+ }
+ nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis();
x.u.u.type = KeyPress;
x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode);
@@ -2270,7 +2608,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X)
int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
{
- ScreenPtr pScreen;
WindowPtr pWin;
xEvent x;
@@ -2386,19 +2723,8 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
fprintf(stderr, "Events: WM_DELETE_WINDOW arrived Atom = %ld.\n", wmAtom);
#endif
- if (X -> xclient.window == nxagentIconWindow)
- {
- pScreen = nxagentScreen(X -> xmap.window);
-
- XMapRaised(nxagentDisplay, nxagentFullscreenWindow);
-
- XIconifyWindow(nxagentDisplay, nxagentIconWindow,
- DefaultScreen(nxagentDisplay));
-
- }
-
- if (X -> xclient.window == (nxagentOption(Fullscreen) ?
- nxagentIconWindow : nxagentDefaultWindows[0]))
+ if (X -> xclient.window == nxagentDefaultWindows[0] ||
+ nxagentWMIsRunning == 0)
{
*result = doCloseSession;
}
@@ -2995,85 +3321,110 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (X -> xconfigure.window == nxagentDefaultWindows[pScreen -> myNum])
{
- if (nxagentOption(Fullscreen) == 0)
+ if (nxagentOption(DesktopResize) == 1)
{
- if (nxagentOption(DesktopResize) == 1)
+ if (nxagentOption(Width) != X -> xconfigure.width ||
+ nxagentOption(Height) != X -> xconfigure.height)
{
- if (nxagentOption(Width) != X -> xconfigure.width ||
- nxagentOption(Height) != X -> xconfigure.height)
- {
- Bool newEvents = False;
+ Bool newEvents = False;
- doRandR = True;
+ doRandR = True;
- NXFlushDisplay(nxagentDisplay, NXFlushLink);
+ NXFlushDisplay(nxagentDisplay, NXFlushLink);
- do
- {
- newEvents = False;
+ do
+ {
+ newEvents = False;
- timeout.tv_sec = 0;
- timeout.tv_usec = 500 * 1000;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 500 * 1000;
- nxagentWaitEvents(nxagentDisplay, &timeout);
+ nxagentWaitEvents(nxagentDisplay, &timeout);
- /*
- * This should also flush
- * the NX link for us.
- */
+ /*
+ * This should also flush
+ * the NX link for us.
+ */
- XSync(nxagentDisplay, 0);
+ XSync(nxagentDisplay, 0);
- while (XCheckTypedWindowEvent(nxagentDisplay, nxagentDefaultWindows[pScreen -> myNum],
- ConfigureNotify, X))
- {
- newEvents = True;
- }
+ while (XCheckTypedWindowEvent(nxagentDisplay, nxagentDefaultWindows[pScreen -> myNum],
+ ConfigureNotify, X))
+ {
+ newEvents = True;
+ }
- } while (newEvents);
- }
+ } while (newEvents);
}
+ }
- if (nxagentWMIsRunning == 0 || X -> xconfigure.send_event)
- {
- nxagentChangeOption(X, X -> xconfigure.x);
- nxagentChangeOption(Y, X -> xconfigure.y);
- }
+ if (nxagentWMIsRunning == 0 || X -> xconfigure.send_event)
+ {
+ nxagentChangeOption(X, X -> xconfigure.x);
+ nxagentChangeOption(Y, X -> xconfigure.y);
+ }
- if (nxagentOption(Shadow) == 1 && nxagentOption(DesktopResize) == 1 &&
- (nxagentOption(Width) != X -> xconfigure.width ||
- nxagentOption(Height) != X -> xconfigure.height))
- {
- nxagentShadowResize = 1;
- }
+ if (nxagentOption(Shadow) == 1 && nxagentOption(DesktopResize) == 1 &&
+ (nxagentOption(Width) != X -> xconfigure.width ||
+ nxagentOption(Height) != X -> xconfigure.height))
+ {
+ nxagentShadowResize = 1;
+ }
- nxagentChangeOption(Width, X -> xconfigure.width);
- nxagentChangeOption(Height, X -> xconfigure.height);
+ nxagentChangeOption(Width, X -> xconfigure.width);
+ nxagentChangeOption(Height, X -> xconfigure.height);
- nxagentChangeOption(ViewportXSpan, (int) X -> xconfigure.width -
- (int) nxagentOption(RootWidth));
- nxagentChangeOption(ViewportYSpan, (int) X -> xconfigure.height -
- (int) nxagentOption(RootHeight));
+ nxagentChangeOption(ViewportXSpan, (int) X -> xconfigure.width -
+ (int) nxagentOption(RootWidth));
+ nxagentChangeOption(ViewportYSpan, (int) X -> xconfigure.height -
+ (int) nxagentOption(RootHeight));
- nxagentMoveViewport(pScreen, 0, 0);
+ nxagentMoveViewport(pScreen, 0, 0);
- if (nxagentOption(Shadow) == 1 ||
- (nxagentOption(Width) == nxagentOption(RootWidth) &&
- nxagentOption(Height) == nxagentOption(RootHeight)))
- {
- doRandR = 0;
- }
+ if (nxagentOption(Shadow) == 1 ||
+ (nxagentOption(Width) == nxagentOption(RootWidth) &&
+ nxagentOption(Height) == nxagentOption(RootHeight)))
+ {
+ doRandR = 0;
+ }
- if (doRandR)
- {
- #ifdef TEST
- fprintf(stderr,"nxagentHandleConfigureNotify: Width %d Height %d.\n",
- nxagentOption(Width), nxagentOption(Height));
- #endif
+ nxagentChangeOption(Width, X -> xconfigure.width);
+ nxagentChangeOption(Height, X -> xconfigure.height);
- nxagentRRSetScreenConfig(screenInfo.screens[DefaultScreen(nxagentDisplay)],
- nxagentOption(Width), nxagentOption(Height));
- }
+ XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0,
+ X -> xconfigure.width, X -> xconfigure.height);
+
+ if (nxagentOption(Fullscreen) == 0)
+ {
+ nxagentMoveViewport(pScreen, 0, 0);
+ }
+ else
+ {
+ nxagentChangeOption(RootX, (nxagentOption(Width) -
+ nxagentOption(RootWidth)) / 2);
+ nxagentChangeOption(RootY, (nxagentOption(Height) -
+ nxagentOption(RootHeight)) / 2);
+ nxagentChangeOption(ViewportXSpan, nxagentOption(Width) -
+ nxagentOption(RootWidth));
+ nxagentChangeOption(ViewportYSpan, nxagentOption(Height) -
+ nxagentOption(RootHeight));
+
+ nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth),
+ nxagentOption(RootHeight));
+
+ XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]),
+ nxagentOption(RootX), nxagentOption(RootY));
+ }
+
+ if (doRandR)
+ {
+ #ifdef TEST
+ fprintf(stderr,"nxagentHandleConfigureNotify: Width %d Height %d.\n",
+ nxagentOption(Width), nxagentOption(Height));
+ #endif
+
+ nxagentRRSetScreenConfig(screenInfo.screens[DefaultScreen(nxagentDisplay)],
+ nxagentOption(Width), nxagentOption(Height));
}
return 1;
@@ -3085,8 +3436,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
int nxagentHandleReparentNotify(XEvent* X)
{
- ScreenPtr pScreen = nxagentScreen(X -> xreparent.window);
-
#ifdef TEST
fprintf(stderr, "nxagentHandleReparentNotify: Going to handle a new reparent event.\n");
#endif
@@ -3203,7 +3552,6 @@ int nxagentHandleReparentNotify(XEvent* X)
XlibWindow *childrenReturn = NULL;
unsigned int nchildrenReturn = 0;
Status result;
- XSizeHints hints;
XWindowAttributes attributes;
int x, y;
int xParent, yParent;
@@ -3464,6 +3812,15 @@ void nxagentGrabPointerAndKeyboard(XEvent *X)
XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow,
True, GrabModeAsync, GrabModeAsync, now);
+ /*
+ * The smart scheduler could be stopped while
+ * waiting for the reply. In this case we need
+ * to yield explicitly to avoid to be stuck in
+ * the dispatch loop forever.
+ */
+
+ isItTimeToYield = 1;
+
#ifdef TEST
fprintf(stderr, "nxagentGrabPointerAndKeyboard: Going to grab the pointer in context [B2].\n");
#endif
@@ -3491,6 +3848,8 @@ void nxagentGrabPointerAndKeyboard(XEvent *X)
XSetInputFocus(nxagentDisplay, nxagentFullscreenWindow,
RevertToParent, now);
}
+
+ nxagentPointerAndKeyboardGrabbed = 1;
}
void nxagentUngrabPointerAndKeyboard(XEvent *X)
@@ -3522,6 +3881,8 @@ void nxagentUngrabPointerAndKeyboard(XEvent *X)
#endif
XUngrabPointer(nxagentDisplay, now);
+
+ nxagentPointerAndKeyboardGrabbed = 0;
}
void nxagentDeactivatePointerGrab()
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h
index 238a229f9..109475c16 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.h
@@ -29,6 +29,7 @@ enum HandleEventResult
{
doNothing = 0,
doMinimize,
+ doDebugTree,
doCloseSession,
doStartKbd,
doSwitchFullscreen,
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
index 633e17a22..51173e410 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile
+++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
@@ -206,7 +206,8 @@ DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) \
-DNXAGENT_SPLASH \
-DNXAGENT_ARTSD \
-UNX_DEBUG_INPUT \
- -UPANORAMIX
+ -UPANORAMIX \
+ -UDEBUG_TREE
all:: $(OBJS)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
index a2e4fb06f..de1da8654 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
@@ -92,6 +92,18 @@ int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
{
switch (sym)
{
+ #ifdef DEBUG_TREE
+
+ case XK_q:
+ case XK_Q:
+ {
+ *result = doDebugTree;
+
+ break;
+ }
+
+ #endif /* DEBUG_TREE */
+
case XK_t:
case XK_T:
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixels.h b/nx-X11/programs/Xserver/hw/nxagent/Pixels.h
index e046771cc..ea7c375ee 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Pixels.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Pixels.h
@@ -108,6 +108,12 @@ FIXME: The condition checking for the render
avoid problems with the render composi-
te on XFree86 remote server.
*/
+/*
+FIXME: Changed macro: NXAGENT_SHOULD_DEFER_COMPOSITE
+ to handle situation, when pSrc -> pDrawable
+ is NULL. This case happens with gradients
+ and solid fill.
+
#define NXAGENT_SHOULD_DEFER_COMPOSITE(pSrc, pMask, pDst) \
((nxagentRenderVersionMajor == 0 && \
nxagentRenderVersionMinor == 8 && \
@@ -118,6 +124,18 @@ FIXME: The condition checking for the render
nxagentOption(DeferLevel) == 1) || \
(nxagentOption(DeferLevel) >= 2 && \
nxagentOption(LinkType) < LINK_TYPE_ADSL))
+*/
+#define NXAGENT_SHOULD_DEFER_COMPOSITE(pSrc, pMask, pDst) \
+ ((nxagentRenderVersionMajor == 0 && \
+ nxagentRenderVersionMinor == 8 && \
+ (pDst) -> pDrawable -> type == DRAWABLE_PIXMAP) || \
+ (nxagentOption(DeferLevel) >= 2 && \
+ nxagentOption(LinkType) < LINK_TYPE_ADSL) || \
+ (nxagentOption(DeferLevel) == 1 && \
+ (pDst) -> pDrawable -> type == DRAWABLE_PIXMAP && \
+ (((pSrc) -> pDrawable && nxagentDrawableStatus((pSrc) -> pDrawable) == NotSynchronized) || \
+ ((pMask) && nxagentDrawableStatus((pMask) -> pDrawable) == NotSynchronized))))
+
#define NXAGENT_SHOULD_DEFER_PUTIMAGE(pDrawable) \
(nxagentSplitTrap == 0 && \
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pointer.c b/nx-X11/programs/Xserver/hw/nxagent/Pointer.c
index 34012d3d5..9c1bfaace 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Pointer.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Pointer.c
@@ -57,6 +57,13 @@ is" without express or implied warranty.
#undef TEST
#undef DEBUG
+/*
+ * The nxagentReversePointerMap array is used to
+ * memorize remote display pointer map.
+ */
+
+unsigned char nxagentReversePointerMap[MAXBUTTONS];
+
void nxagentChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
{
/*
@@ -125,6 +132,8 @@ int nxagentPointerProc(DeviceIntPtr pDev, int onoff)
return Success;
}
+ nxagentInitPointerMap();
+
nxagentEnablePointerEvents();
break;
@@ -155,3 +164,28 @@ int nxagentPointerProc(DeviceIntPtr pDev, int onoff)
return Success;
}
+
+void nxagentInitPointerMap(void)
+{
+ int numButtons;
+
+ int i;
+
+ unsigned char pointerMap[MAXBUTTONS];
+
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentInitPointerMap: Going to retrieve the "
+ "pointer map from remote display.\n");
+ #endif
+
+ numButtons = XGetPointerMapping(nxagentDisplay, pointerMap, MAXBUTTONS);
+
+ /*
+ * Computing revers pointer map.
+ */
+
+ for (i = 1; i <= numButtons; i++)
+ {
+ nxagentReversePointerMap[pointerMap[i - 1] - 1] = i;
+ }
+}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pointer.h b/nx-X11/programs/Xserver/hw/nxagent/Pointer.h
index 0807b08ae..b0bb3f99c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Pointer.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Pointer.h
@@ -38,8 +38,17 @@ is" without express or implied warranty.
(ButtonPressMask | ButtonReleaseMask | PointerMotionMask | \
EnterWindowMask | LeaveWindowMask)
+/*
+ * The nxagentReversePointerMap array is used to
+ * memorize remote display pointer map.
+ */
+
+extern unsigned char nxagentReversePointerMap[MAXBUTTONS];
+
void nxagentChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl);
int nxagentPointerProc(DeviceIntPtr pDev, int onoff);
+void nxagentInitPointerMap(void);
+
#endif /* __Pointer_H__ */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index 598ffc188..e63b481b2 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -81,6 +81,8 @@ extern Bool nxagentUninstallFontServerPath(void);
extern void nxagentRemoveXConnection(void);
+extern void nxagentInitPointerMap(void);
+
static char *nxagentGetReconnectError(void);
void nxagentInitializeRecLossyLevel(void);
@@ -584,6 +586,8 @@ Bool nxagentReconnectSession(void)
nxagentOldKeyboard = NULL;
}
+ nxagentInitPointerMap();
+
nxagentDeactivatePointerGrab();
nxagentWakeupByReconnect();
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c
index 6bc54c86e..4f0f76474 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Render.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c
@@ -147,8 +147,6 @@ void nxagentCursorPostSaveRenderInfo(CursorPtr pCursor, ScreenPtr pScreen,
int nxagentCreatePicture(PicturePtr pPicture, Mask mask);
-void nxagentDestroyPicture(PicturePtr pPicture);
-
int nxagentChangePictureClip(PicturePtr pPicture, int clipType, int nRects,
xRectangle *rects, int xOrigin, int yOrigin);
@@ -1010,12 +1008,15 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
#ifdef DEBUG
- fprintf(stderr, "nxagentComposite: Source Picture [%lu][%p] with drawable [%s%s][%p].\n",
- nxagentPicturePriv(pSrc) -> picture, (void *) pSrc,
- (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP &&
- nxagentIsShmPixmap((PixmapPtr) pSrc -> pDrawable)) ? "Shared " : "",
- pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window",
- (void *) pSrc -> pDrawable);
+ if (pSrc -> pDrawable != NULL)
+ {
+ fprintf(stderr, "nxagentComposite: Source Picture [%lu][%p] with drawable [%s%s][%p].\n",
+ nxagentPicturePriv(pSrc) -> picture, (void *) pSrc,
+ (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP &&
+ nxagentIsShmPixmap((PixmapPtr) pSrc -> pDrawable)) ? "Shared " : "",
+ pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window",
+ (void *) pSrc -> pDrawable);
+ }
fprintf(stderr, "nxagentComposite: Destination Picture [%lu][%p] with drawable [%s%s][%p].\n",
nxagentPicturePriv(pDst) -> picture, (void *) pDst,
@@ -1064,16 +1065,19 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
* the wrong data.
*/
- nxagentSynchronizeShmPixmap(pSrc -> pDrawable, xSrc, ySrc, width, height);
-
- if (nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized)
+ if (pSrc -> pDrawable != NULL)
{
- #ifdef TEST
- fprintf(stderr, "nxagentComposite: Synchronizing the source drawable [%p].\n",
- (void *) pSrc -> pDrawable);
- #endif
+ nxagentSynchronizeShmPixmap(pSrc -> pDrawable, xSrc, ySrc, width, height);
- nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
+ if (nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentComposite: Synchronizing the source drawable [%p].\n",
+ (void *) pSrc -> pDrawable);
+ #endif
+
+ nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
+ }
}
if (pDst -> pDrawable != pSrc -> pDrawable)
@@ -2811,3 +2815,248 @@ Bool nxagentDisconnectAllPicture()
return True;
}
+void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color)
+{
+ Picture id;
+
+ if (nxagentRenderEnable == False)
+ {
+ return;
+ }
+
+ #ifdef DEBUG
+
+ fprintf(stderr, "nxagentRenderCreateSolidFill: Got called.\n");
+
+ if (pPicture == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateSolidFill: WARNING! pPicture pointer is NULL.\n");
+ }
+
+ if (color == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateSolidFill: WARNING! color pointer is NULL.\n");
+ }
+
+ #endif /* #ifdef DEBUG */
+
+ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0,
+ sizeof(XRenderPictureAttributes_));
+
+ id = XRenderCreateSolidFill(nxagentDisplay, (XRenderColor *) color);
+
+ #ifdef DEBUG
+ XSync(nxagentDisplay, 0);
+ #endif
+
+ #ifdef TEST
+ fprintf(stderr, "nxagentRenderCreateSolidFill: Created solid fill xid [%lu].\n", id);
+ #endif
+
+ nxagentPicturePriv(pPicture) -> picture = id;
+}
+
+void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1,
+ xPointFixed *p2, int nStops,
+ xFixed *stops,
+ xRenderColor *colors)
+{
+ Picture id;
+
+ XLinearGradient linearGradient;
+
+ if (nxagentRenderEnable == False)
+ {
+ return;
+ }
+
+ #ifdef DEBUG
+
+ fprintf(stderr, "nxagentRenderCreateLinearGradient: Got called.\n");
+
+ if (pPicture == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! pPicture pointer is NULL.\n");
+ }
+
+ if (p1 == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! p1 pointer is NULL.\n");
+ }
+
+ if (p2 == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! p2 pointer is NULL.\n");
+ }
+
+ if (stops == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! stops pointer is NULL.\n");
+ }
+
+ if (colors == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! colors pointer is NULL.\n");
+ }
+
+ #endif /* #ifdef DEBUG */
+
+ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0,
+ sizeof(XRenderPictureAttributes_));
+
+ linearGradient.p1.x = (XFixed) p1 -> x;
+ linearGradient.p1.y = (XFixed) p1 -> y;
+ linearGradient.p2.x = (XFixed) p2 -> x;
+ linearGradient.p2.y = (XFixed) p2 -> y;
+
+ id = XRenderCreateLinearGradient(nxagentDisplay, &linearGradient,
+ (XFixed *) stops,
+ (XRenderColor *) colors, nStops);
+
+ #ifdef DEBUG
+ XSync(nxagentDisplay, 0);
+ #endif
+
+ #ifdef TEST
+ fprintf(stderr, "nxagentRenderCreateLinearGradient: Created linear gradient xid [%lu].\n", id);
+ #endif
+
+ nxagentPicturePriv(pPicture) -> picture = id;
+}
+
+void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner,
+ xPointFixed *outer,
+ xFixed innerRadius,
+ xFixed outerRadius,
+ int nStops,
+ xFixed *stops,
+ xRenderColor *colors)
+{
+ Picture id;
+
+ XRadialGradient radialGradient;
+
+ if (nxagentRenderEnable == False)
+ {
+ return;
+ }
+
+ #ifdef DEBUG
+
+ fprintf(stderr, "nxagentRenderCreateRadialGradient: Got called.\n");
+
+ if (pPicture == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! pPicture pointer is NULL.\n");
+ }
+
+ if (inner == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! inner pointer is NULL.\n");
+ }
+
+ if (outer == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! outer pointer is NULL.\n");
+ }
+
+ if (stops == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! stops pointer is NULL.\n");
+ }
+
+ if (colors == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! colors pointer is NULL.\n");
+ }
+
+ #endif /* #ifdef DEBUG */
+
+ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0,
+ sizeof(XRenderPictureAttributes_));
+
+ radialGradient.inner.x = (XFixed) inner -> x;
+ radialGradient.inner.y = (XFixed) inner -> y;
+ radialGradient.inner.radius = (XFixed) innerRadius;
+ radialGradient.outer.x = (XFixed) outer -> x;
+ radialGradient.outer.y = (XFixed) outer -> y;
+ radialGradient.outer.radius = (XFixed) outerRadius;
+
+ id = XRenderCreateRadialGradient(nxagentDisplay, &radialGradient,
+ (XFixed *) stops,
+ (XRenderColor *) colors, nStops);
+
+ #ifdef DEBUG
+ XSync(nxagentDisplay, 0);
+ #endif
+
+ #ifdef TEST
+ fprintf(stderr, "nxagentRenderCreateRadialGradient: Created radial gradient xid [%lu].\n", id);
+ #endif
+
+ nxagentPicturePriv(pPicture) -> picture = id;
+}
+
+void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
+ xPointFixed *center,
+ xFixed angle, int nStops,
+ xFixed *stops,
+ xRenderColor *colors)
+{
+ Picture id;
+
+ XConicalGradient conicalGradient;
+
+ if (nxagentRenderEnable == False)
+ {
+ return;
+ }
+
+ #ifdef DEBUG
+
+ fprintf(stderr, "nxagentRenderCreateConicalGradient: Got called.\n");
+
+ if (pPicture == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! pPicture pointer is NULL.\n");
+ }
+
+ if (center == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! center pointer is NULL.\n");
+ }
+
+ if (stops == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! stops pointer is NULL.\n");
+ }
+
+ if (colors == NULL)
+ {
+ fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! colors pointer is NULL.\n");
+ }
+
+ #endif /* #ifdef DEBUG */
+
+ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0,
+ sizeof(XRenderPictureAttributes_));
+
+ conicalGradient.center.x = (XFixed) center -> x;
+ conicalGradient.center.y = (XFixed) center -> y;
+ conicalGradient.angle = (XFixed) angle;
+
+ id = XRenderCreateConicalGradient(nxagentDisplay, &conicalGradient,
+ (XFixed *) stops,
+ (XRenderColor *) colors, nStops);
+
+ #ifdef DEBUG
+ XSync(nxagentDisplay, 0);
+ #endif
+
+ #ifdef TEST
+ fprintf(stderr, "nxagentRenderCreateConicalGradient: Created conical gradient xid [%lu].\n", id);
+ #endif
+
+ nxagentPicturePriv(pPicture) -> picture = id;
+}
+
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.h b/nx-X11/programs/Xserver/hw/nxagent/Render.h
index 81ba3369d..4346a4e1e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Render.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Render.h
@@ -105,4 +105,6 @@ void nxagentDisconnectPicture(pointer p0, XID x1, void* p2);
void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2);
+void nxagentDestroyPicture(PicturePtr pPicture);
+
#endif /* __Render_H__ */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
index a8ce4c7cd..612e71cf7 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
@@ -626,6 +626,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
XlibAtom *atoms = malloc(nUnits * sizeof(*atoms));
Atom *input = value;
int i;
+ int j = 0;
freeMem = True;
export = True;
@@ -633,16 +634,40 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
for (i = 0; i < nUnits; i++)
{
- atoms[i] = nxagentLocalToRemoteAtom(input[i]);
-
- if (atoms[i] == None)
- {
- #ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! Failed to convert local atom %ld [%s].\n",
- (long int) input[i], validateString(NameForAtom(input[i])));
- #endif
- }
+ /*
+ * Exporting the _NET_WM_PING property could
+ * result in rootless windows being grayed out
+ * when the compiz window manager is running.
+ *
+ * Better solution would probably be to handle
+ * the communication with the window manager
+ * instead of just getting rid of the property.
+ */
+
+ if (strcmp(NameForAtom(input[i]), "_NET_WM_PING") != 0)
+ {
+ atoms[j] = nxagentLocalToRemoteAtom(input[i]);
+
+ if (atoms[j] == None)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentExportProperty: WARNING! Failed to convert local atom %ld [%s].\n",
+ (long int) input[i], validateString(NameForAtom(input[i])));
+ #endif
+ }
+
+ j++;
+ }
+ #ifdef TEST
+ else
+ {
+ fprintf(stderr, "nxagentExportProperty: WARNING! "
+ "Not exporting the _NET_WM_PING property.\n");
+ }
+ #endif
}
+
+ nUnits = j;
}
else if (strcmp(typeS, "WINDOW") == 0)
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index bdd30afee..3522d7e2e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -160,7 +160,6 @@ void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port);
#endif
-Window nxagentIconWindow = None;
Window nxagentFullscreenWindow = None;
#ifdef VIEWPORT_FRAME
@@ -291,34 +290,17 @@ 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,
@@ -352,100 +334,8 @@ FIXME: We'll chech for ReparentNotify and LeaveNotify events after XReparentWind
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)
@@ -977,6 +867,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen,
nxagentChangeOption(Fullscreen, False);
+ nxagentFullscreenWindow = 0;
+
resetAgentPosition = True;
}
@@ -1382,8 +1274,6 @@ N/A
if (nxagentOption(Fullscreen))
{
- attributes.override_redirect = True;
-
/*
* We need to disable the host's screensaver or
* it will otherwise grab the screen even if it
@@ -1609,8 +1499,7 @@ N/A
if (nxagentDoFullGeneration == 1 ||
nxagentReconnectTrap == 1)
{
- valuemask = CWBackPixel | CWEventMask | CWColormap |
- (nxagentOption(Fullscreen) == 1 ? CWOverrideRedirect : 0);
+ valuemask = CWBackPixel | CWEventMask | CWColormap;
attributes.background_pixel = nxagentBlackPixel;
@@ -1620,8 +1509,6 @@ N/A
if (nxagentOption(Fullscreen) == 1)
{
- attributes.override_redirect = True;
-
if (nxagentReconnectTrap)
{
/*
@@ -1754,7 +1641,7 @@ N/A
sizeHints.width = nxagentOption(RootWidth);
sizeHints.height = nxagentOption(RootHeight);
- if (nxagentOption(DesktopResize) == 1)
+ if (nxagentOption(DesktopResize) == 1 || nxagentOption(Fullscreen) == 1)
{
sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
@@ -1799,37 +1686,6 @@ N/A
XClearWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]);
- if (nxagentOption(Fullscreen))
- {
- valuemask = CWBackPixmap | CWColormap | CWOverrideRedirect;
- }
- else
- {
- valuemask = CWBackPixmap | CWColormap;
- }
-
- attributes.background_pixmap = nxagentScreenSaverPixmap;
- attributes.colormap = DefaultColormap(nxagentDisplay, DefaultScreen(nxagentDisplay));
-
- if (nxagentOption(Fullscreen))
- {
- attributes.override_redirect = False;
- if (nxagentReconnectTrap)
- {
- XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, True, GrabModeAsync,
- GrabModeAsync, CurrentTime);
- }
- }
-
- if (nxagentOption(Fullscreen))
- {
- nxagentIconWindow = nxagentCreateIconWindow();
- }
- else
- {
- nxagentIconWindow = 0;
- }
-
/*
* When we don't have window manager we grab keyboard
* to let nxagent get keyboard events.
@@ -1880,13 +1736,6 @@ N/A
*/
XSetWMProtocols(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &deleteWMatom, 1);
-
- /*
- if (nxagentOption(Fullscreen))
- {
- XSetWMProtocols(nxagentDisplay, nxagentIconWindow, &deleteWMatom, 1);
- }
- */
}
else
{
@@ -2266,13 +2115,10 @@ FIXME: We should try to restore the previously
if (nxagentOption(Fullscreen))
{
- nxagentChangeOption(Width, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
- nxagentChangeOption(Height, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
-
- nxagentChangeOption(RootX, (WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))
- - nxagentOption(RootWidth)) / 2);
- nxagentChangeOption(RootY, (HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))
- - nxagentOption(RootHeight)) / 2);
+ nxagentChangeOption(RootX, (nxagentOption(Width) -
+ nxagentOption(RootWidth)) / 2);
+ nxagentChangeOption(RootY, (nxagentOption(Height) -
+ nxagentOption(RootHeight)) / 2);
}
else
{
@@ -2284,62 +2130,6 @@ FIXME: We should try to restore the previously
nxagentChangeOption(ViewportYSpan, nxagentOption(Height) - nxagentOption(RootHeight));
/*
- * Change agent window size and size hints.
- */
-
- sizeHints.flags = PPosition | PMinSize | PMaxSize;
- sizeHints.x = nxagentOption(X);
- sizeHints.y = nxagentOption(Y);
-
- sizeHints.min_width = MIN_NXAGENT_WIDTH;
- sizeHints.min_height = MIN_NXAGENT_HEIGHT;
- sizeHints.width = width;
- sizeHints.height = height;
-
- if (nxagentOption(DesktopResize) == 1)
- {
- sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
- sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
- }
- else
- {
- sizeHints.max_width = nxagentOption(RootWidth);
- sizeHints.max_height = nxagentOption(RootHeight);
- }
-
- if (nxagentUserGeometry.flag & XValue || nxagentUserGeometry.flag & YValue)
- {
- sizeHints.flags |= USPosition;
- }
-
- if (nxagentUserGeometry.flag & WidthValue || nxagentUserGeometry.flag & HeightValue)
- {
- sizeHints.flags |= USSize;
- }
-
- XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &sizeHints);
-
- if (nxagentOption(Fullscreen))
- {
- XResizeWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum],
- WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)),
- HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
-
- XResizeWindow(nxagentDisplay, nxagentInputWindows[pScreen -> myNum],
- WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)),
- HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
- }
- else
- {
- XResizeWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], width, height);
-
- if (nxagentOption(Rootless) == 0)
- {
- XResizeWindow(nxagentDisplay, nxagentInputWindows[pScreen -> myNum], width, height);
- }
- }
-
- /*
* Set properties for the agent root window.
*/
@@ -2360,8 +2150,6 @@ FIXME: We should try to restore the previously
(*pScreen -> PositionWindow)(WindowTable[pScreen -> myNum], 0, 0);
- pRootWinSize = &WindowTable[pScreen -> myNum] -> winSize;
-
nxagentSetRootClip(pScreen, 1);
XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[0]),
@@ -2369,6 +2157,12 @@ FIXME: We should try to restore the previously
nxagentMoveViewport(pScreen, 0, 0);
+ /*
+ * Update pointer bounds.
+ */
+
+ ScreenRestructured(pScreen);
+
#ifdef TEST
nxagentPrintAgentGeometry("After Resize Screen", "nxagentResizeScreen:");
#endif
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h
index 6ffebe0ea..3bf66b2f5 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h
@@ -47,7 +47,6 @@ extern ScreenPtr nxagentDefaultScreen;
extern Pixmap nxagentPixmapLogo;
-extern Window nxagentIconWindow;
extern Window nxagentFullscreenWindow;
extern RegionRec nxagentShadowUpdateRegion;
@@ -89,8 +88,6 @@ void nxagentSetScreenSaverTime(void);
void nxagentMinimizeFromFullScreen(ScreenPtr pScreen);
void nxagentMaximizeToFullScreen(ScreenPtr pScreen);
-Window nxagentCreateIconWindow(void);
-
Bool nxagentMagicPixelZone(int x, int y);
Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index 449458ade..2403390b8 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -692,235 +692,87 @@ void nxagentRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib)
void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn)
{
- Window w;
- XSetWindowAttributes attributes;
- unsigned long valuemask;
+ XEvent e;
+ XSizeHints sizeHints;
- if (nxagentOption(Rootless))
+ if (nxagentOption(Rootless) == 1)
{
return;
}
- if (!switchOn)
+ if (switchOn == 0)
{
nxagentWMDetect();
- if (!nxagentWMIsRunning)
- {
- #ifdef WARNING
- fprintf(stderr, "Warning: Can't switch to window mode, no window manager has been detected.\n");
- #endif
-
- return;
- }
- }
-
- w = nxagentDefaultWindows[pScreen -> myNum];
- attributes.override_redirect = switchOn;
- valuemask = CWOverrideRedirect;
- XUnmapWindow(nxagentDisplay, w);
- XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes);
-
- if (switchOn)
- {
- /*
- * Change to fullscreen mode.
- */
-
- struct timeval timeout;
- int i;
- XEvent e;
-
/*
- * Wait for window manager reparenting the default window.
+ * The smart scheduler could be stopped while
+ * waiting for the reply. In this case we need
+ * to yield explicitly to avoid to be stuck in
+ * the dispatch loop forever.
*/
- for (i = 0; i < 100 && nxagentWMIsRunning; i++)
- {
- #ifdef TEST
- fprintf(stderr, "nxagentSwitchFullscreen: WARNING! Going to wait for the ReparentNotify event.\n");
- #endif
-
- if (XCheckTypedWindowEvent(nxagentDisplay, w, ReparentNotify, &e))
- {
- break;
- }
-
- /*
- * This should also flush
- * the NX link for us.
- */
-
- XSync(nxagentDisplay, 0);
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 50 * 1000;
-
- nxagentWaitEvents(nxagentDisplay, &timeout);
- }
-
- if (i < 100)
- {
- /*
- * The window manager has done with the reparent
- * operation. We can resize and map the window.
- */
-
- nxagentChangeOption(Fullscreen, True);
-
- /*
- * Save the window-mode configuration.
- */
-
- nxagentChangeOption(SavedX, nxagentOption(X));
- nxagentChangeOption(SavedY, nxagentOption(Y));
- nxagentChangeOption(SavedWidth, nxagentOption(Width));
- nxagentChangeOption(SavedHeight, nxagentOption(Height));
- nxagentChangeOption(SavedRootWidth, nxagentOption(RootWidth));
- nxagentChangeOption(SavedRootHeight, nxagentOption(RootHeight));
-
- /*
- * Reconf the Default window.
- */
-
- nxagentChangeOption(X, 0);
- nxagentChangeOption(Y, 0);
- nxagentChangeOption(Width, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
- nxagentChangeOption(Height, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
-
- /*
- * Move the root window.
- */
-
- nxagentChangeOption(RootX, (nxagentOption(Width) - nxagentOption(RootWidth)) / 2);
- nxagentChangeOption(RootY, (nxagentOption(Height) - nxagentOption(RootHeight)) / 2);
- nxagentChangeOption(ViewportXSpan, nxagentOption(Width) - nxagentOption(RootWidth));
- nxagentChangeOption(ViewportYSpan, nxagentOption(Height) - nxagentOption(RootHeight));
-
- XMoveResizeWindow(nxagentDisplay, w, nxagentOption(X), nxagentOption(Y),
- nxagentOption(Width), nxagentOption(Height));
-
- nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentOption(RootHeight));
-
- XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]),
- nxagentOption(RootX), nxagentOption(RootY));
-
- /*
- * We disable the screensaver when changing
- * mode to fullscreen. Is it really needed?
- */
-
- XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking);
+ isItTimeToYield = 1;
- if (nxagentIconWindow == None)
- {
- nxagentIconWindow = nxagentCreateIconWindow();
-
- XMapWindow(nxagentDisplay, nxagentIconWindow);
- }
-
- XMapRaised(nxagentDisplay, w);
- XSetInputFocus(nxagentDisplay, w, RevertToParent, CurrentTime);
- XCheckTypedWindowEvent(nxagentDisplay, w, LeaveNotify, &e);
- nxagentFullscreenWindow = w;
-
- if (nxagentOption(DesktopResize) == 1)
- {
- if (nxagentOption(Shadow) == 0)
- {
- nxagentRRSetScreenConfig(pScreen, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)),
- HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
- }
- else
- {
- nxagentShadowAdaptToRatio();
- }
- }
- }
- else
+ if (nxagentWMIsRunning == 0)
{
- /*
- * We have waited for a reparent event unsuccessfully.
- * Something happened to the window manager.
- */
-
#ifdef WARNING
- fprintf(stderr, "nxagentSwitchFullscreen: WARNING! Expected ReparentNotify event missing.\n");
+ fprintf(stderr, "Warning: Can't switch to window mode, no window manager "
+ "has been detected.\n");
#endif
- nxagentWMIsRunning = False;
- attributes.override_redirect = False;
- XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes);
- XMapWindow(nxagentDisplay, w);
+ return;
}
}
- else
- {
- /*
- * FIXME:
- * It could be necessary:
- * - To restore screensaver.
- * - To set or reset nxagentForceBackingStore flag.
- * - To grab keyboard.
- * - To propagate device settings to the X server if no WM is running.
- */
-
- /*
- * Change to windowed mode.
- */
- nxagentChangeOption(Fullscreen, False);
- XDestroyWindow(nxagentDisplay, nxagentIconWindow);
- nxagentIconWindow = nxagentFullscreenWindow = None;
+ #ifdef TEST
+ fprintf(stderr, "nxagentSwitchFullscreen: Switching to %s mode.\n",
+ switchOn ? "fullscreen" : "windowed");
+ #endif
- if (nxagentOption(DesktopResize) == 1)
- {
- nxagentChangeOption(RootWidth, nxagentOption(SavedRootWidth));
- nxagentChangeOption(RootHeight, nxagentOption(SavedRootHeight));
+ nxagentChangeOption(Fullscreen, switchOn);
- if (nxagentOption(Shadow) == 0)
- {
- nxagentRRSetScreenConfig(pScreen, nxagentOption(RootWidth), nxagentOption(RootHeight));
- }
- }
+ if (nxagentOption(DesktopResize) == 1)
+ {
+ sizeHints.flags = PSize;
- if (nxagentOption(WMBorderWidth) > 0 && nxagentOption(WMTitleHeight) > 0)
+ if (switchOn == 1)
{
- nxagentChangeOption(X, nxagentOption(SavedX) -
- nxagentOption(WMBorderWidth));
- nxagentChangeOption(Y, nxagentOption(SavedY) -
- nxagentOption(WMTitleHeight));
+ sizeHints.width =
+ WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
+ sizeHints.height =
+ HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
}
else
{
- nxagentChangeOption(X, nxagentOption(SavedX));
- nxagentChangeOption(Y, nxagentOption(SavedY));
+ sizeHints.width = nxagentOption(RootWidth);
+ sizeHints.height = nxagentOption(RootHeight);
}
- nxagentChangeOption(Width, nxagentOption(SavedWidth));
- nxagentChangeOption(Height, nxagentOption(SavedHeight));
-
- if (nxagentOption(Shadow) == 1 && nxagentOption(DesktopResize) == 1)
- {
- nxagentShadowAdaptToRatio();
- }
+ XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen -> myNum],
+ &sizeHints);
+ }
- XMoveResizeWindow(nxagentDisplay, w, nxagentOption(X), nxagentOption(Y),
- nxagentOption(Width), nxagentOption(Height));
+ memset(&e, 0, sizeof(e));
- nxagentUpdateViewportFrame(0, 0, nxagentOption(Width), nxagentOption(Height));
+ e.xclient.type = ClientMessage;
+ e.xclient.message_type = nxagentAtoms[13]; /* _NET_WM_STATE */
+ e.xclient.display = nxagentDisplay;
+ e.xclient.window = nxagentDefaultWindows[pScreen -> myNum];
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = nxagentOption(Fullscreen) ? 1 : 0;
+ e.xclient.data.l[1] = nxagentAtoms[14]; /* _NET_WM_STATE_FULLSCREEN */
- XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), 0, 0);
- XMapWindow(nxagentDisplay, w);
+ XSendEvent(nxagentDisplay, DefaultRootWindow(nxagentDisplay), False,
+ SubstructureRedirectMask, &e);
- nxagentChangeOption(RootX, 0);
- nxagentChangeOption(RootY, 0);
+ if (switchOn == 1)
+ {
+ nxagentFullscreenWindow = nxagentDefaultWindows[pScreen -> myNum];
}
-
- XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0,
- nxagentOption(Width), nxagentOption(Height));
-
- nxagentSetPrintGeometry(pScreen -> myNum);
+ else
+ {
+ nxagentFullscreenWindow = None;
+ }
}
#ifdef VIEWPORT_FRAME
@@ -2422,6 +2274,11 @@ void nxagentMapDefaultWindows()
#endif
XMapWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]);
+
+ if (nxagentOption(Fullscreen) == 1 && nxagentWMIsRunning == 1)
+ {
+ nxagentSwitchFullscreen(pScreen, 1);
+ }
}
/*
@@ -2452,26 +2309,6 @@ void nxagentMapDefaultWindows()
}
/*
- * Map the icon window.
- */
-
- if (nxagentIconWindow != 0)
- {
- #ifdef TEST
- fprintf(stderr, "nxagentMapDefaultWindows: Mapping icon window id [%ld].\n",
- nxagentIconWindow);
- #endif
-
- XMapWindow(nxagentDisplay, nxagentIconWindow);
-
- if (nxagentIpaq != 0)
- {
- XIconifyWindow(nxagentDisplay, nxagentIconWindow,
- DefaultScreen(nxagentDisplay));
- }
- }
-
- /*
* Ensure that the fullscreen window gets the focus.
*/
diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c
index 18697a576..be961c400 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c
@@ -62,6 +62,7 @@
#include "Screen.h"
#include "Pixmaps.h"
#include "Drawable.h"
+#include "Render.h"
#define PANIC
#define WARNING
@@ -1063,7 +1064,47 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
static PicturePtr createSourcePicture(void)
{
PicturePtr pPicture;
- pPicture = (PicturePtr) xalloc(sizeof(PictureRec));
+
+ extern int nxagentPicturePrivateIndex;
+
+ unsigned int totalPictureSize;
+
+ DevUnion *ppriv;
+
+ char *privPictureRecAddr;
+
+ int i;
+
+ /*
+ * Compute size of entire PictureRect, plus privates.
+ */
+
+ totalPictureSize = sizeof(PictureRec) +
+ picturePrivateCount * sizeof(DevUnion) +
+ sizeof(nxagentPrivPictureRec);
+
+ pPicture = (PicturePtr) xalloc(totalPictureSize);
+
+ if (pPicture != NULL)
+ {
+ ppriv = (DevUnion *) (pPicture + 1);
+
+ for (i = 0; i < picturePrivateCount; ++i)
+ {
+ /*
+ * Other privates are inaccessible.
+ */
+
+ ppriv[i].ptr = NULL;
+ }
+
+ privPictureRecAddr = (char *) &ppriv[picturePrivateCount];
+
+ ppriv[nxagentPicturePrivateIndex].ptr = (pointer) privPictureRecAddr;
+
+ pPicture -> devPrivates = ppriv;
+ }
+
pPicture->pDrawable = 0;
pPicture->pFormat = 0;
pPicture->pNext = 0;
@@ -1697,6 +1738,10 @@ FreePicture (pointer value,
if (--pPicture->refcnt == 0)
{
+#ifdef NXAGENT_SERVER
+ nxagentDestroyPicture(pPicture);
+#endif
+
if (pPicture->transform)
xfree (pPicture->transform);
if (!pPicture->pDrawable) {
diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c.NX.original b/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c.NX.original
index 18697a576..be961c400 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c.NX.original
+++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c.NX.original
@@ -62,6 +62,7 @@
#include "Screen.h"
#include "Pixmaps.h"
#include "Drawable.h"
+#include "Render.h"
#define PANIC
#define WARNING
@@ -1063,7 +1064,47 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
static PicturePtr createSourcePicture(void)
{
PicturePtr pPicture;
- pPicture = (PicturePtr) xalloc(sizeof(PictureRec));
+
+ extern int nxagentPicturePrivateIndex;
+
+ unsigned int totalPictureSize;
+
+ DevUnion *ppriv;
+
+ char *privPictureRecAddr;
+
+ int i;
+
+ /*
+ * Compute size of entire PictureRect, plus privates.
+ */
+
+ totalPictureSize = sizeof(PictureRec) +
+ picturePrivateCount * sizeof(DevUnion) +
+ sizeof(nxagentPrivPictureRec);
+
+ pPicture = (PicturePtr) xalloc(totalPictureSize);
+
+ if (pPicture != NULL)
+ {
+ ppriv = (DevUnion *) (pPicture + 1);
+
+ for (i = 0; i < picturePrivateCount; ++i)
+ {
+ /*
+ * Other privates are inaccessible.
+ */
+
+ ppriv[i].ptr = NULL;
+ }
+
+ privPictureRecAddr = (char *) &ppriv[picturePrivateCount];
+
+ ppriv[nxagentPicturePrivateIndex].ptr = (pointer) privPictureRecAddr;
+
+ pPicture -> devPrivates = ppriv;
+ }
+
pPicture->pDrawable = 0;
pPicture->pFormat = 0;
pPicture->pNext = 0;
@@ -1697,6 +1738,10 @@ FreePicture (pointer value,
if (--pPicture->refcnt == 0)
{
+#ifdef NXAGENT_SERVER
+ nxagentDestroyPicture(pPicture);
+#endif
+
if (pPicture->transform)
xfree (pPicture->transform);
if (!pPicture->pDrawable) {
diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c
index ffc199704..562cd2c66 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c
@@ -116,7 +116,6 @@ int nxagentCursorSaveRenderInfo(ScreenPtr, CursorPtr);
void nxagentCursorPostSaveRenderInfo(CursorPtr, ScreenPtr, PicturePtr, int, int);
int nxagentRenderRealizeCursor(ScreenPtr, CursorPtr);
int nxagentCreatePicture(PicturePtr, Mask);
-void nxagentDestroyPicture(PicturePtr pPicture);
void nxagentChangePicture(PicturePtr, Mask);
int nxagentChangePictureClip(PicturePtr, int, int, xRectangle *, int, int);
void nxagentComposite(CARD8, PicturePtr, PicturePtr, PicturePtr, INT16, INT16,
@@ -132,6 +131,28 @@ void nxagentSetPictureFilter(PicturePtr pPicture, char *filter, int name_size,
void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps);
+void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color);
+
+void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1,
+ xPointFixed *p2, int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner,
+ xPointFixed *outer,
+ xFixed innerRadius,
+ xFixed outerRadius,
+ int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
+ xPointFixed *center,
+ xFixed angle, int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+
/*
* The void pointer is actually a XGlyphElt8.
*/
@@ -823,8 +844,6 @@ ProcRenderFreePicture (ClientPtr client)
VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityDestroyAccess,
RenderErrBase + BadPicture);
- nxagentDestroyPicture(pPicture);
-
FreeResource (stuff->picture, RT_NONE);
return(client->noClientException);
}
@@ -926,9 +945,16 @@ ProcRenderComposite (ClientPtr client)
RenderErrBase + BadPicture);
VERIFY_ALPHA (pMask, stuff->mask, client, SecurityReadAccess,
RenderErrBase + BadPicture);
+/*
+FIXME: Imported change from newest version of Xorg. Changed pSrc to pDst.
+
if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
(pMask && pMask->pDrawable && pSrc->pDrawable->pScreen != pMask->pDrawable->pScreen))
return BadMatch;
+*/
+ if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
+ (pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen))
+ return BadMatch;
ValidatePicture (pSrc);
if (pMask)
@@ -2336,6 +2362,11 @@ static int ProcRenderCreateSolidFill(ClientPtr client)
pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateSolidFill(pPicture, &stuff -> color);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -2367,6 +2398,12 @@ static int ProcRenderCreateLinearGradient (ClientPtr client)
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateLinearGradient(pPicture, &stuff->p1, &stuff->p2,
+ stuff->nStops, stops, colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -2397,6 +2434,14 @@ static int ProcRenderCreateRadialGradient (ClientPtr client)
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateRadialGradient(pPicture, &stuff->inner, &stuff->outer,
+ stuff->inner_radius,
+ stuff->outer_radius,
+ stuff->nStops, stops, colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -2426,6 +2471,13 @@ static int ProcRenderCreateConicalGradient (ClientPtr client)
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateConicalGradient(pPicture, &stuff->center,
+ stuff->angle, stuff->nStops, stops,
+ colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c.NX.original b/nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c.NX.original
index ffc199704..562cd2c66 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c.NX.original
+++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c.NX.original
@@ -116,7 +116,6 @@ int nxagentCursorSaveRenderInfo(ScreenPtr, CursorPtr);
void nxagentCursorPostSaveRenderInfo(CursorPtr, ScreenPtr, PicturePtr, int, int);
int nxagentRenderRealizeCursor(ScreenPtr, CursorPtr);
int nxagentCreatePicture(PicturePtr, Mask);
-void nxagentDestroyPicture(PicturePtr pPicture);
void nxagentChangePicture(PicturePtr, Mask);
int nxagentChangePictureClip(PicturePtr, int, int, xRectangle *, int, int);
void nxagentComposite(CARD8, PicturePtr, PicturePtr, PicturePtr, INT16, INT16,
@@ -132,6 +131,28 @@ void nxagentSetPictureFilter(PicturePtr pPicture, char *filter, int name_size,
void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps);
+void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color);
+
+void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1,
+ xPointFixed *p2, int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner,
+ xPointFixed *outer,
+ xFixed innerRadius,
+ xFixed outerRadius,
+ int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
+ xPointFixed *center,
+ xFixed angle, int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+
/*
* The void pointer is actually a XGlyphElt8.
*/
@@ -823,8 +844,6 @@ ProcRenderFreePicture (ClientPtr client)
VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityDestroyAccess,
RenderErrBase + BadPicture);
- nxagentDestroyPicture(pPicture);
-
FreeResource (stuff->picture, RT_NONE);
return(client->noClientException);
}
@@ -926,9 +945,16 @@ ProcRenderComposite (ClientPtr client)
RenderErrBase + BadPicture);
VERIFY_ALPHA (pMask, stuff->mask, client, SecurityReadAccess,
RenderErrBase + BadPicture);
+/*
+FIXME: Imported change from newest version of Xorg. Changed pSrc to pDst.
+
if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
(pMask && pMask->pDrawable && pSrc->pDrawable->pScreen != pMask->pDrawable->pScreen))
return BadMatch;
+*/
+ if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
+ (pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen))
+ return BadMatch;
ValidatePicture (pSrc);
if (pMask)
@@ -2336,6 +2362,11 @@ static int ProcRenderCreateSolidFill(ClientPtr client)
pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateSolidFill(pPicture, &stuff -> color);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -2367,6 +2398,12 @@ static int ProcRenderCreateLinearGradient (ClientPtr client)
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateLinearGradient(pPicture, &stuff->p1, &stuff->p2,
+ stuff->nStops, stops, colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -2397,6 +2434,14 @@ static int ProcRenderCreateRadialGradient (ClientPtr client)
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateRadialGradient(pPicture, &stuff->inner, &stuff->outer,
+ stuff->inner_radius,
+ stuff->outer_radius,
+ stuff->nStops, stops, colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -2426,6 +2471,13 @@ static int ProcRenderCreateConicalGradient (ClientPtr client)
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateConicalGradient(pPicture, &stuff->center,
+ stuff->angle, stuff->nStops, stops,
+ colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;