diff options
-rw-r--r-- | xorg-server/composite/compalloc.c | 2 | ||||
-rw-r--r-- | xorg-server/hw/xwin/makefile | 9 | ||||
-rw-r--r-- | xorg-server/hw/xwin/win.h | 8 | ||||
-rw-r--r-- | xorg-server/hw/xwin/wincursor.c | 13 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winkeybd.c | 2 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmouse.c | 85 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwndproc.c | 34 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwin32rootlesswndproc.c | 27 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwndproc.c | 51 | ||||
-rw-r--r-- | xorg-server/include/servermd.h | 6 | ||||
-rw-r--r-- | xorg-server/mi/misprite.c | 13 | ||||
-rw-r--r-- | xorg-server/os/utils.c | 23 |
12 files changed, 162 insertions, 111 deletions
diff --git a/xorg-server/composite/compalloc.c b/xorg-server/composite/compalloc.c index a2f3f140a..5a399bf3b 100644 --- a/xorg-server/composite/compalloc.c +++ b/xorg-server/composite/compalloc.c @@ -108,7 +108,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update) */ if (!cw) { - cw = xalloc (sizeof (CompWindowRec)); + cw = xcalloc (1,sizeof (CompWindowRec)); if (!cw) { xfree (ccw); diff --git a/xorg-server/hw/xwin/makefile b/xorg-server/hw/xwin/makefile index 7fc052457..74dcfaeed 100644 --- a/xorg-server/hw/xwin/makefile +++ b/xorg-server/hw/xwin/makefile @@ -19,6 +19,13 @@ SRCS_MULTIWINDOW = \ DEFINES += XWIN_MULTIWINDOW +#SRCS_MULTIWINDOWEXTWM = \ +# winwin32rootless.c \ +# winwin32rootlesswindow.c \ +# winwin32rootlesswndproc.c \ +# winwindowswm.c +#DEFINES += XWIN_MULTIWINDOWEXTWM + SRCS_RANDR = \ winrandr.c DEFINES += XWIN_RANDR RELOCATE_PROJECTROOT @@ -56,7 +63,7 @@ CSRCS = InitInput.c \ winwindow.c \ winprefslex.c \ winprefsyacc.c \ - winwndproc.c $(SRCS_RANDR) $(SRCS_MULTIWINDOW) $(SRCS_CLIPBOARD) + winwndproc.c $(SRCS_RANDR) $(SRCS_MULTIWINDOW) $(SRCS_MULTIWINDOWEXTWM) $(SRCS_CLIPBOARD) DEFINES += YY_NO_UNISTD_H diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 9d54c76bf..416bd27d9 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -1006,15 +1006,17 @@ int winMouseProc (DeviceIntPtr pDeviceInt, int iState); int -winMouseWheel (ScreenPtr pScreen, int iDeltaZ); +winMouseWheel (ScreenPtr pScreen, int iDeltaZ, int x, int y); void -winMouseButtonsSendEvent (int iEventType, int iButton); +winMouseButtonsSendEvent (int iEventType, int iButton, int x, int y); + +void winGetPtMouse(HWND hwnd, LPARAM lParam, POINT *ptMouse); int winMouseButtonsHandle (ScreenPtr pScreen, int iEventType, int iButton, - WPARAM wParam); + WPARAM wParam, HWND hwnd, LPARAM lParam); void winEnqueueMotion(int x, int y); diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c index 75a1adf5b..4fa7c0929 100644 --- a/xorg-server/hw/xwin/wincursor.c +++ b/xorg-server/hw/xwin/wincursor.c @@ -553,12 +553,23 @@ winMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { } +static Bool +winDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) +{ + return TRUE; +} +static void +winDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) +{ +} static miPointerSpriteFuncRec winSpriteFuncsRec = { winRealizeCursor, winUnrealizeCursor, winSetCursor, - winMoveCursor + winMoveCursor, + winDeviceInitialize, + winDeviceCleanup }; diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index 5ac558d98..84b7d8d85 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -619,7 +619,7 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); - xCurrentEvent.u.u.type = fDown ? KeyPress : KeyRelease; + xCurrentEvent.u.u.type = fDown ? DeviceKeyPress : DeviceKeyRelease; xCurrentEvent.u.keyButtonPointer.time = g_c32LastInputEventTime = GetTickCount (); xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE; diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c index 47dcf1063..e06a8ef69 100644 --- a/xorg-server/hw/xwin/winmouse.c +++ b/xorg-server/hw/xwin/winmouse.c @@ -36,6 +36,13 @@ #endif #include "win.h" +#ifdef XKB +#ifndef XKB_IN_SERVER +#define XKB_IN_SERVER +#endif +#include <xkbsrv.h> +#endif + #if 1 #include "inputstr.h" @@ -43,6 +50,7 @@ static CARD8 const *g_winMouseButtonMap = NULL; #endif +#include <X11/extensions/XIproto.h> /* * Local prototypes @@ -100,7 +108,6 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) InitPointerDeviceStruct (pDevice, map, lngMouseButtons + lngWheelEvents, - GetMotionHistory, winMouseCtrl, GetMotionHistorySize(), 2); @@ -129,7 +136,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) /* Handle the mouse wheel */ int -winMouseWheel (ScreenPtr pScreen, int iDeltaZ) +winMouseWheel (ScreenPtr pScreen, int iDeltaZ, int x, int y) { winScreenPriv(pScreen); int button; /* Button4 or Button5 */ @@ -204,10 +211,10 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ) while (iDeltaZ--) { /* Push the wheel button */ - winMouseButtonsSendEvent (ButtonPress, button); + winMouseButtonsSendEvent (DeviceButtonPress, button,x,y); /* Release the wheel button */ - winMouseButtonsSendEvent (ButtonRelease, button); + winMouseButtonsSendEvent (DeviceButtonRelease, button,x,y); } return 0; @@ -219,33 +226,46 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ) */ void -winMouseButtonsSendEvent (int iEventType, int iButton) +winMouseButtonsSendEvent (int iEventType, int iButton, int x, int y) { DeviceIntPtr pDev; - xEvent xCurrentEvent; + deviceKeyButtonPointer xCurrentEvent; + deviceKeyButtonPointer *kbp = &xCurrentEvent; /* Load an xEvent and enqueue the event */ - xCurrentEvent.u.u.type = iEventType; + kbp->type=iEventType; #if 1 if (g_winMouseButtonMap) - xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton]; + kbp->detail = g_winMouseButtonMap[iButton]; else #endif - xCurrentEvent.u.u.detail = iButton; - xCurrentEvent.u.keyButtonPointer.time - = g_c32LastInputEventTime = GetTickCount (); + kbp->detail = iButton; + kbp->time = g_c32LastInputEventTime = GetTickCount (); + + kbp->root_x = x; + kbp->root_y = y; -#if CYGDEBUG - ErrorF("winMouseButtonsSendEvent: xCurrentEvent.u.u.type: %d, xCurrentEvent.u.u.detail: %d\n", - xCurrentEvent.u.u.type, xCurrentEvent.u.u.detail); -#endif for (pDev = inputInfo.devices; pDev; pDev = pDev->next) if ((pDev->coreEvents && pDev != inputInfo.pointer) && pDev->button) { - mieqEnqueue (pDev, &xCurrentEvent); + kbp->deviceid = pDev->id; + mieqEnqueue (pDev, (xEventPtr)kbp); } } +void winGetPtMouse(HWND hwnd, LPARAM lParam, POINT *ptMouse) +{ + /* Unpack the client area mouse coordinates */ + ptMouse->x = GET_X_LPARAM(lParam); + ptMouse->y = GET_Y_LPARAM(lParam); + +// /* Translate the client area mouse coordinates to screen coordinates */ +// ClientToScreen (hwnd, ptMouse); + + /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */ +// ptMouse->x -= GetSystemMetrics (SM_XVIRTUALSCREEN); +// ptMouse->y -= GetSystemMetrics (SM_YVIRTUALSCREEN); +} /* * Decide what to do with a Windows mouse message @@ -254,21 +274,23 @@ winMouseButtonsSendEvent (int iEventType, int iButton) int winMouseButtonsHandle (ScreenPtr pScreen, int iEventType, int iButton, - WPARAM wParam) + WPARAM wParam, HWND hwnd, LPARAM lParam) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + POINT ptMouse; + winGetPtMouse(hwnd,lParam,&ptMouse); /* Send button events right away if emulate 3 buttons is off */ if (pScreenInfo->iE3BTimeout == WIN_E3B_OFF) { /* Emulate 3 buttons is off, send the button event */ - winMouseButtonsSendEvent (iEventType, iButton); + winMouseButtonsSendEvent (iEventType, iButton, ptMouse.x, ptMouse.y); return 0; } /* Emulate 3 buttons is on, let the fun begin */ - if (iEventType == ButtonPress + if (iEventType == DeviceButtonPress && pScreenPriv->iE3BCachedPress == 0 && !pScreenPriv->fE3BFakeButton2Sent) { @@ -289,7 +311,7 @@ winMouseButtonsHandle (ScreenPtr pScreen, pScreenInfo->iE3BTimeout, NULL); } - else if (iEventType == ButtonPress + else if (iEventType == DeviceButtonPress && pScreenPriv->iE3BCachedPress != 0 && pScreenPriv->iE3BCachedPress != iButton && !pScreenPriv->fE3BFakeButton2Sent) @@ -304,12 +326,12 @@ winMouseButtonsHandle (ScreenPtr pScreen, pScreenPriv->iE3BCachedPress = 0; /* Send fake middle button */ - winMouseButtonsSendEvent (ButtonPress, Button2); + winMouseButtonsSendEvent (DeviceButtonPress, Button2, ptMouse.x, ptMouse.y); /* Indicate that a fake middle button event was sent */ pScreenPriv->fE3BFakeButton2Sent = TRUE; } - else if (iEventType == ButtonRelease + else if (iEventType == DeviceButtonRelease && pScreenPriv->iE3BCachedPress == iButton) { /* @@ -320,10 +342,10 @@ winMouseButtonsHandle (ScreenPtr pScreen, pScreenPriv->iE3BCachedPress = 0; /* Send cached press, then send release */ - winMouseButtonsSendEvent (ButtonPress, iButton); - winMouseButtonsSendEvent (ButtonRelease, iButton); + winMouseButtonsSendEvent (DeviceButtonPress, iButton, ptMouse.x, ptMouse.y); + winMouseButtonsSendEvent (DeviceButtonRelease, iButton, ptMouse.x, ptMouse.y); } - else if (iEventType == ButtonRelease + else if (iEventType == DeviceButtonRelease && pScreenPriv->fE3BFakeButton2Sent && !(wParam & MK_LBUTTON) && !(wParam & MK_RBUTTON)) @@ -334,9 +356,9 @@ winMouseButtonsHandle (ScreenPtr pScreen, pScreenPriv->fE3BFakeButton2Sent = FALSE; /* Send middle mouse button release */ - winMouseButtonsSendEvent (ButtonRelease, Button2); + winMouseButtonsSendEvent (DeviceButtonRelease, Button2, ptMouse.x, ptMouse.y); } - else if (iEventType == ButtonRelease + else if (iEventType == DeviceButtonRelease && pScreenPriv->iE3BCachedPress == 0 && !pScreenPriv->fE3BFakeButton2Sent) { @@ -344,7 +366,7 @@ winMouseButtonsHandle (ScreenPtr pScreen, * Button was release, no button is cached, * and there is no fake button 2 release is pending. */ - winMouseButtonsSendEvent (ButtonRelease, iButton); + winMouseButtonsSendEvent (DeviceButtonRelease, iButton, ptMouse.x, ptMouse.y); } return 0; @@ -357,8 +379,9 @@ void winEnqueueMotion(int x, int y) { int i, nevents; int valuators[2]; + int MaxN=GetMaximumEventsNum(); - xEvent *events = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum()); + EventListPtr events = InitEventList(MaxN); valuators[0] = x; valuators[1] = y; @@ -366,8 +389,8 @@ void winEnqueueMotion(int x, int y) POINTER_ABSOLUTE, 0, 2, valuators); for (i = 0; i < nevents; i++) - mieqEnqueue(inputInfo.pointer, events + i); + mieqEnqueue(inputInfo.pointer, events[i].event); - xfree(events); + FreeEventList(events,MaxN); } // XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer) diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c index bfb74a092..436930c6e 100644 --- a/xorg-server/hw/xwin/winmultiwindowwndproc.c +++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c @@ -42,6 +42,13 @@ #include "winmsg.h" #include "inputstr.h" +#ifdef XKB +#ifndef XKB_IN_SERVER +#define XKB_IN_SERVER +#endif +#include <xkbsrv.h> +#endif + /* * External global variables */ @@ -511,16 +518,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message, return 0; case WM_MOUSEMOVE: - /* Unpack the client area mouse coordinates */ - ptMouse.x = GET_X_LPARAM(lParam); - ptMouse.y = GET_Y_LPARAM(lParam); - - /* Translate the client area mouse coordinates to screen coordinates */ - ClientToScreen (hwnd, &ptMouse); - - /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */ - ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN); - ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); + winGetPtMouse(hwnd, lParam, &ptMouse); /* We can't do anything without privates */ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) @@ -620,7 +618,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message, break; g_fButton[0] = TRUE; SetCapture(hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, Button1, wParam, hwnd, lParam); case WM_LBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) @@ -628,7 +626,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message, g_fButton[0] = FALSE; ReleaseCapture(); winStartMousePolling(s_pScreenPriv); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button1, wParam, hwnd, lParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: @@ -636,7 +634,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message, break; g_fButton[1] = TRUE; SetCapture(hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, Button2, wParam, hwnd, lParam); case WM_MBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) @@ -644,7 +642,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message, g_fButton[1] = FALSE; ReleaseCapture(); winStartMousePolling(s_pScreenPriv); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button2, wParam, hwnd, lParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: @@ -652,7 +650,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message, break; g_fButton[2] = TRUE; SetCapture(hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam, hwnd, lParam); case WM_RBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) @@ -660,21 +658,21 @@ winTopLevelWindowProc (HWND hwnd, UINT message, g_fButton[2] = FALSE; ReleaseCapture(); winStartMousePolling(s_pScreenPriv); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button3, wParam, hwnd, lParam); case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; SetCapture(hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, HIWORD(wParam) + 5, wParam, hwnd, lParam); case WM_XBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; ReleaseCapture(); winStartMousePolling(s_pScreenPriv); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, HIWORD(wParam) + 5, wParam, hwnd, lParam); case WM_MOUSEWHEEL: if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT) diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c index e624ded36..a5315096c 100644 --- a/xorg-server/hw/xwin/winwin32rootlesswndproc.c +++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c @@ -522,16 +522,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, #if CYGMULTIWINDOW_DEBUG && 0 winDebug ("winMWExtWMWindowProc - WM_MOUSEMOVE\n"); #endif - /* Unpack the client area mouse coordinates */ - ptMouse.x = GET_X_LPARAM(lParam); - ptMouse.y = GET_Y_LPARAM(lParam); - - /* Translate the client area mouse coordinates to screen coordinates */ - ClientToScreen (hwnd, &ptMouse); - - /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */ - ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN); - ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); + winGetPtMouse(hwnd,lParam,&ptMouse); /* We can't do anything without privates */ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) @@ -631,7 +622,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; SetCapture (hwnd); - return winMouseButtonsHandle (pScreen, ButtonPress, Button1, wParam); + return winMouseButtonsHandle (pScreen, DeviceeButtonPress, Button1, wParam, hwnd, lParam); case WM_LBUTTONUP: #if CYGMULTIWINDOW_DEBUG @@ -640,7 +631,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; ReleaseCapture (); - return winMouseButtonsHandle (pScreen, ButtonRelease, Button1, wParam); + return winMouseButtonsHandle (pScreen, DeviceButtonRelease, Button1, wParam, hwnd, lParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: @@ -650,7 +641,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; SetCapture (hwnd); - return winMouseButtonsHandle (pScreen, ButtonPress, Button2, wParam); + return winMouseButtonsHandle (pScreen, DeviceButtonPress, Button2, wParam, hwnd, lParam); case WM_MBUTTONUP: #if CYGMULTIWINDOW_DEBUG @@ -659,7 +650,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; ReleaseCapture (); - return winMouseButtonsHandle (pScreen, ButtonRelease, Button2, wParam); + return winMouseButtonsHandle (pScreen, DeviceButtonRelease, Button2, wParam, hwnd, lParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: @@ -669,7 +660,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; SetCapture (hwnd); - return winMouseButtonsHandle (pScreen, ButtonPress, Button3, wParam); + return winMouseButtonsHandle (pScreen, DeviceButtonPress, Button3, wParam, hwnd, lParam); case WM_RBUTTONUP: #if CYGMULTIWINDOW_DEBUG @@ -678,19 +669,19 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; ReleaseCapture (); - return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam); + return winMouseButtonsHandle (pScreen, DeviceButtonRelease, Button3, wParam, hwnd, lParam); case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; SetCapture (hwnd); - return winMouseButtonsHandle (pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + return winMouseButtonsHandle (pScreen, DeviceButtonPress, HIWORD(wParam) + 5, wParam, hwnd, lParam); case WM_XBUTTONUP: if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) break; ReleaseCapture (); - return winMouseButtonsHandle (pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); + return winMouseButtonsHandle (pScreen, DeviceButtonRelease, HIWORD(wParam) + 5, wParam, hwnd, lParam); case WM_MOUSEWHEEL: #if CYGMULTIWINDOW_DEBUG diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c index c553634f9..da0f4f4e6 100644 --- a/xorg-server/hw/xwin/winwndproc.c +++ b/xorg-server/hw/xwin/winwndproc.c @@ -44,6 +44,10 @@ #ifdef XKB extern BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam); +#ifndef XKB_IN_SERVER +#define XKB_IN_SERVER +#endif +#include <xkbsrv.h> #endif extern void winFixShiftKeys (int iScanCode); @@ -815,7 +819,7 @@ winWindowProc (HWND hwnd, UINT message, #endif ) SetCapture (hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, Button1, wParam, hwnd, lParam); case WM_LBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) @@ -826,7 +830,7 @@ winWindowProc (HWND hwnd, UINT message, #endif ) ReleaseCapture (); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button1, wParam, hwnd, lParam); case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: @@ -838,7 +842,7 @@ winWindowProc (HWND hwnd, UINT message, #endif ) SetCapture (hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, Button2, wParam, hwnd, lParam); case WM_MBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) @@ -849,7 +853,7 @@ winWindowProc (HWND hwnd, UINT message, #endif ) ReleaseCapture (); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button2, wParam, hwnd, lParam); case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: @@ -861,7 +865,7 @@ winWindowProc (HWND hwnd, UINT message, #endif ) SetCapture (hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, Button3, wParam, hwnd, lParam); case WM_RBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) @@ -872,7 +876,7 @@ winWindowProc (HWND hwnd, UINT message, #endif ) ReleaseCapture (); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, Button3, wParam, hwnd, lParam); case WM_XBUTTONDBLCLK: case WM_XBUTTONDOWN: @@ -884,7 +888,7 @@ winWindowProc (HWND hwnd, UINT message, #endif ) SetCapture (hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonPress, HIWORD(wParam) + 5, wParam, hwnd, lParam); case WM_XBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; @@ -894,7 +898,7 @@ winWindowProc (HWND hwnd, UINT message, #endif ) ReleaseCapture (); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); + return winMouseButtonsHandle (s_pScreen, DeviceButtonRelease, HIWORD(wParam) + 5, wParam, hwnd, lParam); case WM_TIMER: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) @@ -904,15 +908,20 @@ winWindowProc (HWND hwnd, UINT message, switch (wParam) { case WIN_E3B_TIMER_ID: - /* Send delayed button press */ - winMouseButtonsSendEvent (ButtonPress, - s_pScreenPriv->iE3BCachedPress); - - /* Kill this timer */ - KillTimer (s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); - - /* Clear screen privates flags */ - s_pScreenPriv->iE3BCachedPress = 0; + { + POINT Pos; + GetCursorPos(&Pos); + ScreenToClient(hwnd,&Pos); + /* Send delayed button press */ + winMouseButtonsSendEvent (DeviceButtonPress, + s_pScreenPriv->iE3BCachedPress,Pos.x,Pos.y); + + /* Kill this timer */ + KillTimer (s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); + + /* Clear screen privates flags */ + s_pScreenPriv->iE3BCachedPress = 0; + } break; case WIN_POLLING_MOUSE_TIMER_ID: @@ -923,10 +932,11 @@ winWindowProc (HWND hwnd, UINT message, /* Get the current position of the mouse cursor */ GetCursorPos (&point); + ScreenToClient(hwnd,&point); /* Map from screen (-X, -Y) to root (0, 0) */ - point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN); - point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); + //point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN); + //point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); /* Deliver absolute cursor position to X Server */ winEnqueueMotion(point.x , point.y); @@ -938,6 +948,7 @@ winWindowProc (HWND hwnd, UINT message, wR = (GetKeyState (VK_RBUTTON) & 0x8000)?MK_RBUTTON:0; wShift = (GetKeyState (VK_SHIFT) & 0x8000)?MK_SHIFT:0; wCtrl = (GetKeyState (VK_CONTROL) & 0x8000)?MK_CONTROL:0; + ScreenToClient(hwnd,&point); lPos = MAKELPARAM(point.x, point.y); if (g_fButton[0] & !wL) PostMessage (hwnd, WM_LBUTTONUP, wCtrl|wM|wR|wShift, lPos); @@ -960,7 +971,7 @@ winWindowProc (HWND hwnd, UINT message, #if CYGDEBUG winDebug ("winWindowProc - WM_MOUSEWHEEL\n"); #endif - winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam)); + winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam),GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam)); break; case WM_SETFOCUS: diff --git a/xorg-server/include/servermd.h b/xorg-server/include/servermd.h index dec9f3b9e..8cc20f000 100644 --- a/xorg-server/include/servermd.h +++ b/xorg-server/include/servermd.h @@ -269,6 +269,12 @@ SOFTWARE. #define GLYPHPADBYTES 4 #endif /* linux/s390 */ +#ifdef WIN32 +#define IMAGE_BYTE_ORDER LSBFirst +#define BITMAP_BIT_ORDER LSBFirst +#define GLYPHPADBYTES 4 +#endif + /* size of buffer to use with GetImage, measured in bytes. There's obviously * a trade-off between the amount of heap used and the number of times the * ddx routine has to be called. diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c index 0b83abdb4..6c4318f37 100644 --- a/xorg-server/mi/misprite.c +++ b/xorg-server/mi/misprite.c @@ -430,7 +430,7 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width, if (DevHasCursor(pDev)) { pCursorInfo = MISPRITE(pDev); - if (pDrawable->type == DRAWABLE_WINDOW && pCursorInfo->isUp && + if (pCursorInfo && pDrawable->type == DRAWABLE_WINDOW && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y, x, y, width, height)) @@ -468,7 +468,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) /* * Damage will take care of destination check */ - if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && + if (pCursorInfo && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && RECT_IN_REGION (pScreen, prgnSrc, &pCursorInfo->saved) != rgnOUT) { SPRITE_DEBUG (("CopyWindow remove\n")); @@ -553,9 +553,12 @@ miSpriteInstallColormap (ColormapPtr pMap) if (DevHasCursor(pDev)) { pCursorInfo = MISPRITE(pDev); - pCursorInfo->checkPixels = TRUE; - if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) - miSpriteRemoveCursor(pDev, pScreen); + if (pCursorInfo) + { + pCursorInfo->checkPixels = TRUE; + if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) + miSpriteRemoveCursor(pDev, pScreen); + } } } diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index 1f37b4d9b..2d73a0c2d 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -240,11 +240,7 @@ OsSignal(sig, handler) * server at a time. This keeps the servers from stomping on each other * if the user forgets to give them different display numbers. */ -#ifdef _MSC_VER -#define LOCK_DIR getenv("TEMP") -#else #define LOCK_DIR "/tmp" -#endif #define LOCK_TMP_PREFIX "/.tX" #define LOCK_PREFIX "/.X" #define LOCK_SUFFIX "-lock" @@ -260,12 +256,6 @@ OsSignal(sig, handler) #endif #endif -#ifdef _MSC_VER -#define kill(pid, exitcode) TerminateProcess(OpenProcess(PROCESS_TERMINATE ,FALSE,pid),exitcode) -#define link rename -#endif - - static Bool StillLocking = FALSE; static char szLockFile[PATH_MAX]; static Bool nolock = FALSE; @@ -279,19 +269,27 @@ static Bool nolock = FALSE; void LockServer(void) { +#if defined(WIN32) && !defined(__CYGWIN__) + char MutexName[100]; + sprintf(MutexName, "Global\\VcXsrv_Mutex_%d\n", getpid()); + if (!CreateMutex(NULL,TRUE,MutexName) || GetLastError()== ERROR_ALREADY_EXISTS) + { + FatalError("Server is already active for display %d\n", atoi(display)); + } +#else + char port[20]; char tmp[PATH_MAX], pid_str[12]; int lfd, i, haslock, l_pid, t; char *tmppath = NULL; int len; - char port[20]; if (nolock) return; /* * Path names */ tmppath = LOCK_DIR; - sprintf(port, "%d", atoi(display)); + len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) : strlen(LOCK_TMP_PREFIX); len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1; @@ -396,6 +394,7 @@ LockServer(void) if (!haslock) FatalError("Could not create server lock file: %s\n", szLockFile); StillLocking = FALSE; +#endif } /* |