Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
151170c4
Commit
151170c4
authored
Dec 26, 1998
by
Patrik Stridvall
Committed by
Alexandre Julliard
Dec 26, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved more things to the X11 driver.
parent
815d3207
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
346 additions
and
338 deletions
+346
-338
dbg.y
debugger/dbg.y
+2
-0
ddraw.c
graphics/ddraw.c
+3
-2
bitblt.c
graphics/x11drv/bitblt.c
+3
-2
brush.c
graphics/x11drv/brush.c
+2
-0
clipping.c
graphics/x11drv/clipping.c
+2
-0
init.c
graphics/x11drv/init.c
+2
-0
clipboard.h
include/clipboard.h
+1
-1
ddraw.h
include/ddraw.h
+7
-3
display.h
include/display.h
+5
-0
ttydrv.h
include/ttydrv.h
+1
-1
win.h
include/win.h
+9
-0
x11drv.h
include/x11drv.h
+25
-7
palette.c
objects/palette.c
+0
-2
dce.c
windows/dce.c
+3
-54
dinput.c
windows/dinput.c
+0
-2
display.c
windows/display.c
+12
-196
input.c
windows/input.c
+5
-5
message.c
windows/message.c
+0
-2
scroll.c
windows/scroll.c
+1
-24
clipboard.c
windows/ttydrv/clipboard.c
+1
-1
event.c
windows/ttydrv/event.c
+2
-0
init.c
windows/ttydrv/init.c
+2
-0
win.c
windows/win.c
+10
-5
winpos.c
windows/winpos.c
+9
-7
clipboard.c
windows/x11drv/clipboard.c
+21
-10
event.c
windows/x11drv/event.c
+6
-5
init.c
windows/x11drv/init.c
+8
-7
mouse.c
windows/x11drv/mouse.c
+204
-2
wnd.c
windows/x11drv/wnd.c
+0
-0
No files found.
debugger/dbg.y
View file @
151170c4
...
...
@@ -6,6 +6,8 @@
* Copyright 1995 Morten Welinder
*/
#include "ts_xlib.h"
#include <stdio.h>
#include <signal.h>
#include <sys/stat.h>
...
...
graphics/ddraw.c
View file @
151170c4
...
...
@@ -17,6 +17,7 @@
#include <unistd.h>
#include <assert.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include <sys/signal.h>
#include <fcntl.h>
#include <string.h>
...
...
@@ -2249,10 +2250,10 @@ static HRESULT WINAPI Xlib_IDirectDraw_SetDisplayMode(
_common_IDirectDraw_SetDisplayMode
(
this
);
this
->
e
.
xlib
.
paintable
=
1
;
this
->
e
.
xlib
.
drawable
=
WIN_FindWndPtr
(
this
->
d
.
window
)
->
window
;
this
->
e
.
xlib
.
drawable
=
((
X11DRV_WND_DATA
*
)
WIN_FindWndPtr
(
this
->
d
.
window
)
->
pDriverData
)
->
window
;
/* We don't have a context for this window. Host off the desktop */
if
(
!
this
->
e
.
xlib
.
drawable
)
this
->
e
.
xlib
.
drawable
=
WIN_GetDesktop
(
)
->
window
;
this
->
e
.
xlib
.
drawable
=
((
X11DRV_WND_DATA
*
)
WIN_GetDesktop
()
->
pDriverData
)
->
window
;
return
DD_OK
;
}
...
...
graphics/x11drv/bitblt.c
View file @
151170c4
...
...
@@ -4,11 +4,12 @@
* Copyright 1993, 1994 Alexandre Julliard
*/
#include "ts_xlib.h"
#include <X11/Intrinsic.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include "bitmap.h"
#include "callback.h"
#include "color.h"
...
...
graphics/x11drv/brush.c
View file @
151170c4
...
...
@@ -4,6 +4,8 @@
* Copyright 1993, 1994 Alexandre Julliard
*/
#include "ts_xlib.h"
#include <stdlib.h>
#include "brush.h"
#include "bitmap.h"
...
...
graphics/x11drv/clipping.c
View file @
151170c4
...
...
@@ -4,6 +4,8 @@
* Copyright 1998 Huw Davies
*/
#include "ts_xlib.h"
#include <stdio.h>
#include "dc.h"
#include "x11drv.h"
...
...
graphics/x11drv/init.c
View file @
151170c4
...
...
@@ -4,6 +4,8 @@
* Copyright 1996 Alexandre Julliard
*/
#include "ts_xlib.h"
#include <string.h>
#include "x11drv.h"
#include "color.h"
...
...
include/clipboard.h
View file @
151170c4
...
...
@@ -21,7 +21,7 @@ typedef struct _CLIPBOARD_DRIVER
void
(
*
pEmptyClipboard
)();
void
(
*
pSetClipboardData
)(
UINT32
);
BOOL32
(
*
pRequestSelection
)();
void
(
*
pResetOwner
)(
WND
*
);
void
(
*
pResetOwner
)(
WND
*
,
BOOL32
);
}
CLIPBOARD_DRIVER
;
CLIPBOARD_DRIVER
*
CLIPBOARD_GetDriver
();
...
...
include/ddraw.h
View file @
151170c4
#ifndef __WINE_DDRAW_H
#define __WINE_DDRAW_H
#include "ts_xlib.h"
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Xlib.h>
#ifdef HAVE_LIBXXSHM
#include "ts_xshm.h"
#endif
#include <X11/extensions/XShm.h>
#endif
/* defined(HAVE_LIBXXSHM) */
#endif
/* !defined(X_DISPLAY_MISSING) */
#ifndef DIRECTDRAW_VERSION
#define DIRECTDRAW_VERSION 0x0500
...
...
include/display.h
View file @
151170c4
...
...
@@ -17,6 +17,11 @@ typedef struct _CURSORINFO
}
CURSORINFO
,
*
LPCURSORINFO
;
#pragma pack(4)
typedef
struct
_MOUSE_DRIVER
{
VOID
(
*
pSetCursor
)(
CURSORICONINFO
*
);
VOID
(
*
pMoveCursor
)(
WORD
,
WORD
);
}
MOUSE_DRIVER
;
WORD
WINAPI
DISPLAY_Inquire
(
LPCURSORINFO
lpCursorInfo
);
VOID
WINAPI
DISPLAY_SetCursor
(
CURSORICONINFO
*
lpCursor
);
VOID
WINAPI
DISPLAY_MoveCursor
(
WORD
wAbsX
,
WORD
wAbsY
);
...
...
include/ttydrv.h
View file @
151170c4
...
...
@@ -16,7 +16,7 @@ extern CLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
extern
void
TTYDRV_CLIPBOARD_EmptyClipboard
();
extern
void
TTYDRV_CLIPBOARD_SetClipboardData
(
UINT32
wFormat
);
extern
BOOL32
TTYDRV_CLIPBOARD_RequestSelection
();
extern
void
TTYDRV_CLIPBOARD_ResetOwner
(
WND
*
pWnd
);
extern
void
TTYDRV_CLIPBOARD_ResetOwner
(
WND
*
pWnd
,
BOOL32
bFooBar
);
/* TTY event driver */
...
...
include/win.h
View file @
151170c4
...
...
@@ -55,6 +55,7 @@ typedef enum
#define RDW_C_DELETEHRGN 0x0002
struct
tagDCE
;
struct
tagDC
;
struct
_WND_DRIVER
;
typedef
struct
tagWND
...
...
@@ -83,15 +84,20 @@ typedef struct tagWND
UINT32
wIDmenu
;
/* ID or hmenu (from CreateWindow) */
DWORD
helpContext
;
/* Help context ID */
WORD
flags
;
/* Misc. flags (see below) */
#if 0
Window window; /* X window (only for top-level windows) */
#endif
HMENU16
hSysMenu
;
/* window's copy of System Menu */
DWORD
userdata
;
/* User private data */
struct
_WND_DRIVER
*
pDriver
;
/* Window driver */
void
*
pDriverData
;
/* Window driver data */
DWORD
wExtra
[
1
];
/* Window extra bytes */
}
WND
;
typedef
struct
_WND_DRIVER
{
void
(
*
pInitialize
)(
WND
*
);
void
(
*
pFinalize
)(
WND
*
);
BOOL32
(
*
pCreateDesktopWindow
)(
WND
*
,
CLASS
*
,
BOOL32
);
BOOL32
(
*
pCreateWindow
)(
WND
*
,
CLASS
*
,
CREATESTRUCT32A
*
,
BOOL32
);
BOOL32
(
*
pDestroyWindow
)(
WND
*
);
...
...
@@ -102,6 +108,9 @@ typedef struct _WND_DRIVER
void
(
*
pSetFocus
)(
WND
*
);
void
(
*
pPreSizeMove
)(
WND
*
);
void
(
*
pPostSizeMove
)(
WND
*
);
void
(
*
pScrollWindow
)(
WND
*
,
struct
tagDC
*
,
INT32
,
INT32
,
const
RECT32
*
,
BOOL32
);
void
(
*
pSetDrawable
)(
WND
*
,
struct
tagDC
*
,
WORD
,
BOOL32
);
BOOL32
(
*
pIsSelfClipping
)(
WND
*
);
}
WND_DRIVER
;
typedef
struct
...
...
include/x11drv.h
View file @
151170c4
...
...
@@ -6,11 +6,17 @@
#define __WINE_X11DRV_H
#include "config.h"
#include "ts_xlib.h"
#include "ts_xutil.h"
#ifndef X_DISPLAY_MISSING
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#endif
/* !defined(X_DISPLAY_MISSING) */
#include "winbase.h"
#include "windows.h"
#include "wintypes.h"
#include "display.h"
#include "gdi.h"
#include "xmalloc.h"
/* for XCREATEIMAGE macro */
#include "clipboard.h"
...
...
@@ -219,10 +225,18 @@ extern int *X11DRV_DIB_BuildColorMap( struct tagDC *dc, WORD coloruse,
int
*
nColors
);
/* X11 windows driver */
extern
WND_DRIVER
X11DRV_WND_Driver
;
extern
Window
X11DRV_WND_GetXWindow
(
HWND32
hwnd
);
typedef
struct
_X11DRV_WND_DATA
{
Window
window
;
}
X11DRV_WND_DATA
;
extern
Window
X11DRV_WND_GetXWindow
(
WND
*
wndPtr
);
extern
Window
X11DRV_WND_FindXWindow
(
WND
*
wndPtr
);
extern
void
X11DRV_WND_Initialize
(
WND
*
wndPtr
);
extern
void
X11DRV_WND_Finalize
(
WND
*
wndPtr
);
extern
BOOL32
X11DRV_WND_CreateDesktopWindow
(
WND
*
wndPtr
,
CLASS
*
classPtr
,
BOOL32
bUnicode
);
extern
BOOL32
X11DRV_WND_CreateWindow
(
WND
*
wndPtr
,
CLASS
*
classPtr
,
CREATESTRUCT32A
*
cs
,
BOOL32
bUnicode
);
extern
BOOL32
X11DRV_WND_DestroyWindow
(
WND
*
pWnd
);
...
...
@@ -233,6 +247,9 @@ extern void X11DRV_WND_SetText(WND *wndPtr, LPCSTR text);
extern
void
X11DRV_WND_SetFocus
(
WND
*
wndPtr
);
extern
void
X11DRV_WND_PreSizeMove
(
WND
*
wndPtr
);
extern
void
X11DRV_WND_PostSizeMove
(
WND
*
wndPtr
);
extern
void
X11DRV_WND_ScrollWindow
(
WND
*
wndPtr
,
DC
*
dcPtr
,
INT32
dx
,
INT32
dy
,
const
RECT32
*
clipRect
,
BOOL32
bUpdate
);
extern
void
X11DRV_WND_SetDrawable
(
WND
*
wndPtr
,
DC
*
dc
,
WORD
flags
,
BOOL32
bSetClipOrigin
);
extern
BOOL32
X11DRV_WND_IsSelfClipping
(
WND
*
wndPtr
);
/* X11 clipboard driver */
...
...
@@ -241,7 +258,7 @@ extern CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
extern
void
X11DRV_CLIPBOARD_EmptyClipboard
();
extern
void
X11DRV_CLIPBOARD_SetClipboardData
(
UINT32
wFormat
);
extern
BOOL32
X11DRV_CLIPBOARD_RequestSelection
();
extern
void
X11DRV_CLIPBOARD_ResetOwner
(
WND
*
pWnd
);
extern
void
X11DRV_CLIPBOARD_ResetOwner
(
WND
*
pWnd
,
BOOL32
bFooBar
);
void
X11DRV_CLIPBOARD_ReadSelection
(
Window
w
,
Atom
prop
);
void
X11DRV_CLIPBOARD_ReleaseSelection
(
Window
w
,
HWND32
hwnd
);
...
...
@@ -258,9 +275,10 @@ extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpK
/* X11 mouse driver */
#if 0
extern
MOUSE_DRIVER
X11DRV_MOUSE_Driver
;
#endif
extern
void
X11DRV_MOUSE_SetCursor
(
CURSORICONINFO
*
lpCursor
);
extern
void
X11DRV_MOUSE_MoveCursor
(
WORD
wAbsX
,
WORD
wAbsY
);
/* X11 event driver */
...
...
objects/palette.c
View file @
151170c4
...
...
@@ -10,8 +10,6 @@
#include <stdlib.h>
#include <string.h>
#include "ts_xlib.h"
#include "gdi.h"
#include "color.h"
#include "palette.h"
...
...
windows/dce.c
View file @
151170c4
...
...
@@ -26,7 +26,6 @@
#include "heap.h"
#include "sysmetrics.h"
#include "debug.h"
#include "x11drv.h"
#define NB_DCE 5
/* Number of DCEs created at startup */
...
...
@@ -380,7 +379,8 @@ static BOOL32 DCE_AddClipRects( WND *pWndStart, WND *pWndEnd,
{
RECT32
rect
;
if
(
pWndStart
->
window
)
return
TRUE
;
/* X itself will do the clipping */
if
(
pWndStart
->
pDriver
->
pIsSelfClipping
(
pWndStart
)
)
return
TRUE
;
/* The driver itself will do the clipping */
for
(;
pWndStart
!=
pWndEnd
;
pWndStart
=
pWndStart
->
next
)
{
...
...
@@ -514,57 +514,6 @@ static void DCE_OffsetVisRgn( HDC32 hDC, HRGN32 hVisRgn )
GDI_HEAP_UNLOCK
(
hDC
);
}
/***********************************************************************
* DCE_SetDrawable
*
* Set the drawable, origin and dimensions for the DC associated to
* a given window.
*/
static
void
DCE_SetDrawable
(
WND
*
wndPtr
,
DC
*
dc
,
WORD
flags
,
BOOL32
bSetClipOrigin
)
{
X11DRV_PDEVICE
*
physDev
=
(
X11DRV_PDEVICE
*
)
dc
->
physDev
;
if
(
!
wndPtr
)
/* Get a DC for the whole screen */
{
dc
->
w
.
DCOrgX
=
0
;
dc
->
w
.
DCOrgY
=
0
;
physDev
->
drawable
=
rootWindow
;
TSXSetSubwindowMode
(
display
,
physDev
->
gc
,
IncludeInferiors
);
}
else
{
if
(
flags
&
DCX_WINDOW
)
{
dc
->
w
.
DCOrgX
=
wndPtr
->
rectWindow
.
left
;
dc
->
w
.
DCOrgY
=
wndPtr
->
rectWindow
.
top
;
}
else
{
dc
->
w
.
DCOrgX
=
wndPtr
->
rectClient
.
left
;
dc
->
w
.
DCOrgY
=
wndPtr
->
rectClient
.
top
;
}
while
(
!
wndPtr
->
window
)
{
wndPtr
=
wndPtr
->
parent
;
dc
->
w
.
DCOrgX
+=
wndPtr
->
rectClient
.
left
;
dc
->
w
.
DCOrgY
+=
wndPtr
->
rectClient
.
top
;
}
dc
->
w
.
DCOrgX
-=
wndPtr
->
rectWindow
.
left
;
dc
->
w
.
DCOrgY
-=
wndPtr
->
rectWindow
.
top
;
physDev
->
drawable
=
wndPtr
->
window
;
#if 0
/* This is needed when we reuse a cached DC because
* SetDCState() called by ReleaseDC() screws up DC
* origins for child windows.
*/
if( bSetClipOrigin )
TSXSetClipOrigin( display, physDev->gc, dc->w.DCOrgX, dc->w.DCOrgY );
#endif
}
}
/***********************************************************************
* DCE_ExcludeRgn
*
...
...
@@ -745,7 +694,7 @@ HDC32 WINAPI GetDCEx32( HWND32 hwnd, HRGN32 hrgnClip, DWORD flags )
/* recompute visible region */
DCE_
SetDrawable
(
wndPtr
,
dc
,
flags
,
bUpdateClipOrigin
);
wndPtr
->
pDriver
->
p
SetDrawable
(
wndPtr
,
dc
,
flags
,
bUpdateClipOrigin
);
if
(
bUpdateVisRgn
)
{
TRACE
(
dc
,
"updating visrgn for %08x dce, hwnd [%04x]
\n
"
,
(
unsigned
)
dce
,
hwnd
);
...
...
windows/dinput.c
View file @
151170c4
...
...
@@ -18,8 +18,6 @@
* an utter mess.)
*/
#include "ts_xlib.h"
#include "config.h"
#include <string.h>
#include <unistd.h>
...
...
windows/display.c
View file @
151170c4
...
...
@@ -5,27 +5,19 @@
*
*/
#include "ts_xlib.h"
#include "ts_xresource.h"
#include "ts_xutil.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "windows.h"
#include "win.h"
#include "gdi.h"
#include "display.h"
#include "callback.h"
#include "heap.h"
#include "debug.h"
#include "debugtools.h"
#include "x11drv.h"
Cursor
DISPLAY_XCursor
=
None
;
/* Current X cursor */
#include "display.h"
#include "wintypes.h"
BOOL32
DISPLAY_DisableWarpPointer
=
FALSE
;
/* hack; see DISPLAY_MoveCursor */
extern
MOUSE_DRIVER
X11DRV_MOUSE_Driver
;
/***********************************************************************
* MOUSE_GetDriver()
*/
MOUSE_DRIVER
*
MOUSE_GetDriver
()
{
return
&
X11DRV_MOUSE_Driver
;
}
/***********************************************************************
* DISPLAY_Inquire (DISPLAY.101)
...
...
@@ -39,153 +31,11 @@ WORD WINAPI DISPLAY_Inquire(LPCURSORINFO lpCursorInfo)
}
/***********************************************************************
* DISPLAY_DoSetCursor
*/
static
BOOL32
DISPLAY_DoSetCursor
(
CURSORICONINFO
*
ptr
)
{
Pixmap
pixmapBits
,
pixmapMask
,
pixmapAll
;
XColor
fg
,
bg
;
Cursor
cursor
=
None
;
if
(
!
ptr
)
/* Create an empty cursor */
{
static
const
char
data
[]
=
{
0
};
bg
.
red
=
bg
.
green
=
bg
.
blue
=
0x0000
;
pixmapBits
=
XCreateBitmapFromData
(
display
,
rootWindow
,
data
,
1
,
1
);
if
(
pixmapBits
)
{
cursor
=
XCreatePixmapCursor
(
display
,
pixmapBits
,
pixmapBits
,
&
bg
,
&
bg
,
0
,
0
);
XFreePixmap
(
display
,
pixmapBits
);
}
}
else
/* Create the X cursor from the bits */
{
XImage
*
image
;
if
(
ptr
->
bPlanes
*
ptr
->
bBitsPerPixel
!=
1
)
{
WARN
(
cursor
,
"Cursor has more than 1 bpp!
\n
"
);
return
FALSE
;
}
/* Create a pixmap and transfer all the bits to it */
/* NOTE: Following hack works, but only because XFree depth
* 1 images really use 1 bit/pixel (and so the same layout
* as the Windows cursor data). Perhaps use a more generic
* algorithm here.
*/
pixmapAll
=
XCreatePixmap
(
display
,
rootWindow
,
ptr
->
nWidth
,
ptr
->
nHeight
*
2
,
1
);
image
=
XCreateImage
(
display
,
DefaultVisualOfScreen
(
screen
),
1
,
ZPixmap
,
0
,
(
char
*
)(
ptr
+
1
),
ptr
->
nWidth
,
ptr
->
nHeight
*
2
,
16
,
ptr
->
nWidthBytes
);
if
(
image
)
{
image
->
byte_order
=
MSBFirst
;
image
->
bitmap_bit_order
=
MSBFirst
;
image
->
bitmap_unit
=
16
;
_XInitImageFuncPtrs
(
image
);
if
(
pixmapAll
)
XPutImage
(
display
,
pixmapAll
,
BITMAP_monoGC
,
image
,
0
,
0
,
0
,
0
,
ptr
->
nWidth
,
ptr
->
nHeight
*
2
);
image
->
data
=
NULL
;
XDestroyImage
(
image
);
}
/* Now create the 2 pixmaps for bits and mask */
pixmapBits
=
XCreatePixmap
(
display
,
rootWindow
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
);
pixmapMask
=
XCreatePixmap
(
display
,
rootWindow
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
);
/* Make sure everything went OK so far */
if
(
pixmapBits
&&
pixmapMask
&&
pixmapAll
)
{
/* We have to do some magic here, as cursors are not fully
* compatible between Windows and X11. Under X11, there
* are only 3 possible color cursor: black, white and
* masked. So we map the 4th Windows color (invert the
* bits on the screen) to black. This require some boolean
* arithmetic:
*
* Windows | X11
* Xor And Result | Bits Mask Result
* 0 0 black | 0 1 background
* 0 1 no change | X 0 no change
* 1 0 white | 1 1 foreground
* 1 1 inverted | 0 1 background
*
* which gives:
* Bits = 'Xor' and not 'And'
* Mask = 'Xor' or not 'And'
*
* FIXME: apparently some servers do support 'inverted' color.
* I don't know if it's correct per the X spec, but maybe
* we ought to take advantage of it. -- AJ
*/
XCopyArea
(
display
,
pixmapAll
,
pixmapBits
,
BITMAP_monoGC
,
0
,
0
,
ptr
->
nWidth
,
ptr
->
nHeight
,
0
,
0
);
XCopyArea
(
display
,
pixmapAll
,
pixmapMask
,
BITMAP_monoGC
,
0
,
0
,
ptr
->
nWidth
,
ptr
->
nHeight
,
0
,
0
);
XSetFunction
(
display
,
BITMAP_monoGC
,
GXandReverse
);
XCopyArea
(
display
,
pixmapAll
,
pixmapBits
,
BITMAP_monoGC
,
0
,
ptr
->
nHeight
,
ptr
->
nWidth
,
ptr
->
nHeight
,
0
,
0
);
XSetFunction
(
display
,
BITMAP_monoGC
,
GXorReverse
);
XCopyArea
(
display
,
pixmapAll
,
pixmapMask
,
BITMAP_monoGC
,
0
,
ptr
->
nHeight
,
ptr
->
nWidth
,
ptr
->
nHeight
,
0
,
0
);
XSetFunction
(
display
,
BITMAP_monoGC
,
GXcopy
);
fg
.
red
=
fg
.
green
=
fg
.
blue
=
0xffff
;
bg
.
red
=
bg
.
green
=
bg
.
blue
=
0x0000
;
cursor
=
XCreatePixmapCursor
(
display
,
pixmapBits
,
pixmapMask
,
&
fg
,
&
bg
,
ptr
->
ptHotSpot
.
x
,
ptr
->
ptHotSpot
.
y
);
}
/* Now free everything */
if
(
pixmapAll
)
XFreePixmap
(
display
,
pixmapAll
);
if
(
pixmapBits
)
XFreePixmap
(
display
,
pixmapBits
);
if
(
pixmapMask
)
XFreePixmap
(
display
,
pixmapMask
);
}
if
(
cursor
==
None
)
return
FALSE
;
if
(
DISPLAY_XCursor
!=
None
)
XFreeCursor
(
display
,
DISPLAY_XCursor
);
DISPLAY_XCursor
=
cursor
;
if
(
rootWindow
!=
DefaultRootWindow
(
display
)
||
!
WIN_GetDesktop
())
{
/* Set the cursor on the desktop window */
XDefineCursor
(
display
,
rootWindow
,
cursor
);
}
else
{
/* FIXME: this won't work correctly with native USER !*/
/* Set the same cursor for all top-level windows */
HWND32
hwnd
=
GetWindow32
(
GetDesktopWindow32
(),
GW_CHILD
);
while
(
hwnd
)
{
Window
win
=
X11DRV_WND_GetXWindow
(
hwnd
);
if
(
win
&&
win
!=
DefaultRootWindow
(
display
))
XDefineCursor
(
display
,
win
,
cursor
);
hwnd
=
GetWindow32
(
hwnd
,
GW_HWNDNEXT
);
}
}
return
TRUE
;
}
/***********************************************************************
* DISPLAY_SetCursor (DISPLAY.102)
*/
VOID
WINAPI
DISPLAY_SetCursor
(
CURSORICONINFO
*
lpCursor
)
{
EnterCriticalSection
(
&
X11DRV_CritSection
);
CALL_LARGE_STACK
(
DISPLAY_DoSetCursor
,
lpCursor
);
LeaveCriticalSection
(
&
X11DRV_CritSection
);
MOUSE_GetDriver
()
->
pSetCursor
(
lpCursor
);
}
/***********************************************************************
...
...
@@ -193,40 +43,7 @@ VOID WINAPI DISPLAY_SetCursor( CURSORICONINFO *lpCursor )
*/
VOID
WINAPI
DISPLAY_MoveCursor
(
WORD
wAbsX
,
WORD
wAbsY
)
{
/*
* We do not want the to create MotionNotify events here,
* otherwise we will get an endless recursion:
* XMotionEvent -> MOUSEEVENTF_MOVE -> mouse_event -> DisplayMoveCursor
* -> XWarpPointer -> XMotionEvent -> ...
*
* Unfortunately, the XWarpPointer call does create a MotionNotify
* event. So, we use a hack: before MOUSE_SendEvent calls the mouse event
* procedure, it sets a global flag. If this flag is set, we skip the
* XWarpPointer call. If we are *not* called from within MOUSE_SendEvent,
* we will call XWarpPointer, which will create a MotionNotify event.
* Strictly speaking, this is also wrong, but that should normally not
* have any negative effects ...
*
* But first of all, we check whether we already are at the position
* are supposed to move to; if so, we don't need to do anything.
*/
Window
root
,
child
;
int
rootX
,
rootY
,
winX
,
winY
;
unsigned
int
xstate
;
if
(
DISPLAY_DisableWarpPointer
)
return
;
if
(
!
TSXQueryPointer
(
display
,
rootWindow
,
&
root
,
&
child
,
&
rootX
,
&
rootY
,
&
winX
,
&
winY
,
&
xstate
))
return
;
if
(
winX
==
wAbsX
&&
winY
==
wAbsY
)
return
;
TRACE
(
cursor
,
"(%d,%d): moving from (%d,%d)
\n
"
,
wAbsX
,
wAbsY
,
winX
,
winY
);
TSXWarpPointer
(
display
,
rootWindow
,
rootWindow
,
0
,
0
,
0
,
0
,
wAbsX
,
wAbsY
);
MOUSE_GetDriver
()
->
pMoveCursor
(
wAbsX
,
wAbsY
);
}
/***********************************************************************
...
...
@@ -244,4 +61,3 @@ VOID WINAPI UserRepaintDisable( BOOL16 disable )
{
TRACE
(
cursor
,
"(%d): stub
\n
"
,
disable
);
}
windows/input.c
View file @
151170c4
...
...
@@ -22,11 +22,11 @@
#include "keyboard.h"
#include "mouse.h"
#include "message.h"
#include "sysmetrics.h"
#include "debug.h"
#include "debugtools.h"
#include "struct32.h"
#include "winerror.h"
#include "x11drv.h"
static
INT16
captureHT
=
HTCLIENT
;
static
HWND32
captureWnd
=
0
;
...
...
@@ -162,8 +162,8 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
extra
=
(
DWORD
)
wme
->
hWnd
;
assert
(
dwFlags
&
MOUSEEVENTF_ABSOLUTE
);
posX
=
(
dx
*
screenWidth
)
>>
16
;
posY
=
(
dy
*
screenHeight
)
>>
16
;
posX
=
(
dx
*
SYSMETRICS_CXSCREEN
)
>>
16
;
posY
=
(
dy
*
SYSMETRICS_CYSCREEN
)
>>
16
;
}
else
{
...
...
@@ -177,8 +177,8 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
{
if
(
dwFlags
&
MOUSEEVENTF_ABSOLUTE
)
{
posX
=
(
dx
*
screenWidth
)
>>
16
;
posY
=
(
dy
*
screenHeight
)
>>
16
;
posX
=
(
dx
*
SYSMETRICS_CXSCREEN
)
>>
16
;
posY
=
(
dy
*
SYSMETRICS_CYSCREEN
)
>>
16
;
}
else
{
...
...
windows/message.c
View file @
151170c4
...
...
@@ -4,8 +4,6 @@
* Copyright 1993, 1994 Alexandre Julliard
*/
#include "ts_xlib.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
...
...
windows/scroll.c
View file @
151170c4
...
...
@@ -17,7 +17,6 @@
#include "region.h"
#include "sysmetrics.h"
#include "debug.h"
#include "x11drv.h"
/*************************************************************************
* ScrollWindow16 (USER.61)
...
...
@@ -345,29 +344,7 @@ rect?rect->left:0, rect?rect->top:0, rect ?rect->right:0, rect ?rect->bottom:0,
((
flags
&
SW_SCROLLCHILDREN
)
?
DCX_NOCLIPCHILDREN
:
0
)
);
if
(
(
dc
=
(
DC
*
)
GDI_GetObjPtr
(
hDC
,
DC_MAGIC
))
)
{
X11DRV_PDEVICE
*
physDev
=
(
X11DRV_PDEVICE
*
)
dc
->
physDev
;
POINT32
dst
,
src
;
if
(
dx
>
0
)
dst
.
x
=
(
src
.
x
=
dc
->
w
.
DCOrgX
+
cliprc
.
left
)
+
dx
;
else
src
.
x
=
(
dst
.
x
=
dc
->
w
.
DCOrgX
+
cliprc
.
left
)
-
dx
;
if
(
dy
>
0
)
dst
.
y
=
(
src
.
y
=
dc
->
w
.
DCOrgY
+
cliprc
.
top
)
+
dy
;
else
src
.
y
=
(
dst
.
y
=
dc
->
w
.
DCOrgY
+
cliprc
.
top
)
-
dy
;
if
((
cliprc
.
right
-
cliprc
.
left
>
abs
(
dx
))
&&
(
cliprc
.
bottom
-
cliprc
.
top
>
abs
(
dy
)))
{
if
(
bUpdate
)
/* handles non-Wine windows hanging over the scrolled area */
TSXSetGraphicsExposures
(
display
,
physDev
->
gc
,
True
);
TSXSetFunction
(
display
,
physDev
->
gc
,
GXcopy
);
TSXCopyArea
(
display
,
physDev
->
drawable
,
physDev
->
drawable
,
physDev
->
gc
,
src
.
x
,
src
.
y
,
cliprc
.
right
-
cliprc
.
left
-
abs
(
dx
),
cliprc
.
bottom
-
cliprc
.
top
-
abs
(
dy
),
dst
.
x
,
dst
.
y
);
if
(
bUpdate
)
TSXSetGraphicsExposures
(
display
,
physDev
->
gc
,
False
);
}
wnd
->
pDriver
->
pScrollWindow
(
wnd
,
dc
,
dx
,
dy
,
&
cliprc
,
bUpdate
);
if
(
dc
->
w
.
hVisRgn
&&
bUpdate
)
{
...
...
windows/ttydrv/clipboard.c
View file @
151170c4
...
...
@@ -43,6 +43,6 @@ BOOL32 TTYDRV_CLIPBOARD_RequestSelection()
/***********************************************************************
* TTYDRV_CLIPBOARD_ResetOwner
*/
void
TTYDRV_CLIPBOARD_ResetOwner
(
WND
*
pWnd
)
void
TTYDRV_CLIPBOARD_ResetOwner
(
WND
*
pWnd
,
BOOL32
bFooBar
)
{
}
windows/ttydrv/event.c
View file @
151170c4
...
...
@@ -66,6 +66,8 @@ BOOL32 TTYDRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state)
if
(
state
)
*
state
=
0
;
return
TRUE
;
}
/***********************************************************************
...
...
windows/ttydrv/init.c
View file @
151170c4
...
...
@@ -11,6 +11,8 @@
#if 0
WND_DRIVER TTYDRV_WND_Driver =
{
TTYDRV_WND_Initialize,
TTYDRV_WND_Finalize,
TTYDRV_WND_CreateDesktopWindow,
TTYDRV_WND_CreateWindow,
TTYDRV_WND_DestroyWindow,
...
...
windows/win.c
View file @
151170c4
...
...
@@ -322,6 +322,7 @@ static WND* WIN_DestroyWindow( WND* wndPtr )
wndPtr
->
class
=
NULL
;
pWnd
=
wndPtr
->
next
;
wndPtr
->
pDriver
->
pFinalize
(
wndPtr
);
USER_HEAP_FREE
(
hwnd
);
return
pWnd
;
}
...
...
@@ -395,6 +396,9 @@ BOOL32 WIN_CreateDesktopWindow(void)
if
(
!
hwndDesktop
)
return
FALSE
;
pWndDesktop
=
(
WND
*
)
USER_HEAP_LIN_ADDR
(
hwndDesktop
);
pWndDesktop
->
pDriver
=
&
X11DRV_WND_Driver
;
pWndDesktop
->
pDriver
->
pInitialize
(
pWndDesktop
);
pWndDesktop
->
next
=
NULL
;
pWndDesktop
->
child
=
NULL
;
pWndDesktop
->
parent
=
NULL
;
...
...
@@ -424,7 +428,6 @@ BOOL32 WIN_CreateDesktopWindow(void)
pWndDesktop
->
flags
=
0
;
pWndDesktop
->
hSysMenu
=
0
;
pWndDesktop
->
userdata
=
0
;
pWndDesktop
->
pDriver
=
&
X11DRV_WND_Driver
;
pWndDesktop
->
winproc
=
(
WNDPROC16
)
class
->
winproc
;
/* FIXME: How do we know if it should be Unicode or not */
...
...
@@ -543,8 +546,9 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
wndPtr
->
owner
=
WIN_GetTopParentPtr
(
WIN_FindWndPtr
(
cs
->
hwndParent
));
}
wndPtr
->
pDriver
=
&
X11DRV_WND_Driver
;
wndPtr
->
window
=
0
;
wndPtr
->
pDriver
=
wndPtr
->
parent
->
pDriver
;
wndPtr
->
pDriver
->
pInitialize
(
wndPtr
);
wndPtr
->
class
=
classPtr
;
wndPtr
->
winproc
=
classPtr
->
winproc
;
wndPtr
->
dwMagic
=
WND_MAGIC
;
...
...
@@ -585,6 +589,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
if
(
ret
)
{
TRACE
(
win
,
"CBT-hook returned 0
\n
"
);
wndPtr
->
pDriver
->
pFinalize
(
wndPtr
);
USER_HEAP_FREE
(
hwnd
);
return
0
;
}
...
...
@@ -916,7 +921,7 @@ static void WIN_SendDestroyMsg( WND* pWnd )
WIN_CheckFocus
(
pWnd
);
if
(
CARET_GetHwnd
()
==
pWnd
->
hwndSelf
)
DestroyCaret32
();
if
(
!
pWnd
->
window
)
CLIPBOARD_GetDriver
()
->
pResetOwner
(
pWnd
);
CLIPBOARD_GetDriver
()
->
pResetOwner
(
pWnd
,
TRUE
);
SendMessage32A
(
pWnd
->
hwndSelf
,
WM_DESTROY
,
0
,
0
);
...
...
@@ -978,7 +983,7 @@ BOOL32 WINAPI DestroyWindow32( HWND32 hwnd )
if
(
!
IsWindow32
(
hwnd
)
)
return
TRUE
;
}
if
(
wndPtr
->
window
)
CLIPBOARD_GetDriver
()
->
pResetOwner
(
wndPtr
);
/* before the window is unmapped */
CLIPBOARD_GetDriver
()
->
pResetOwner
(
wndPtr
,
FALSE
);
/* before the window is unmapped */
/* Hide the window */
...
...
windows/winpos.c
View file @
151170c4
...
...
@@ -20,6 +20,7 @@
#include "dce.h"
#include "nonclient.h"
#include "debug.h"
#include "x11drv.h"
#define HAS_DLGFRAME(style,exStyle) \
(((exStyle) & WS_EX_DLGMODALFRAME) || \
...
...
@@ -2108,7 +2109,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
if
(
wnd
->
next
==
wndPtr
)
flags
|=
SWP_NOZORDER
;
}
}
else
if
(
!
(
wndPtr
->
window
)
)
else
if
(
!
(
(
X11DRV_WND_DATA
*
)
wndPtr
->
pDriverData
)
->
window
)
{
/* FIXME: the following optimization is no good for "X-ed" windows */
if
(
hwndInsertAfter
==
HWND_TOP
)
...
...
@@ -2166,7 +2167,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
hwndInsertAfter
=
WINPOS_ReorderOwnedPopups
(
hwndInsertAfter
,
wndPtr
,
winpos
.
flags
);
if
(
wndPtr
->
window
)
if
(
((
X11DRV_WND_DATA
*
)
wndPtr
->
pDriverData
)
->
window
)
{
WIN_UnlinkWindow
(
winpos
.
hwnd
);
WIN_LinkWindow
(
winpos
.
hwnd
,
hwndInsertAfter
);
...
...
@@ -2174,7 +2175,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
else
WINPOS_MoveWindowZOrder
(
winpos
.
hwnd
,
hwndInsertAfter
);
}
if
(
!
wndPtr
->
window
&&
!
(
winpos
.
flags
&
SWP_NOREDRAW
)
&&
if
(
!
((
X11DRV_WND_DATA
*
)
wndPtr
->
pDriverData
)
->
window
&&
!
(
winpos
.
flags
&
SWP_NOREDRAW
)
&&
((
winpos
.
flags
&
(
SWP_NOMOVE
|
SWP_NOSIZE
|
SWP_FRAMECHANGED
))
!=
(
SWP_NOMOVE
|
SWP_NOSIZE
))
)
visRgn
=
DCE_GetVisRgn
(
hwnd
,
DCX_WINDOW
|
DCX_CLIPSIBLINGS
);
...
...
@@ -2222,7 +2223,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
oldWindowRect
=
wndPtr
->
rectWindow
;
if
(
wndPtr
->
window
)
if
(
((
X11DRV_WND_DATA
*
)
wndPtr
->
pDriverData
)
->
window
)
{
RECT32
oldClientRect
=
wndPtr
->
rectClient
;
...
...
@@ -2325,7 +2326,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
if
(
flags
&
SWP_SHOWWINDOW
)
{
wndPtr
->
dwStyle
|=
WS_VISIBLE
;
if
(
wndPtr
->
window
)
if
(
((
X11DRV_WND_DATA
*
)
wndPtr
->
pDriverData
)
->
window
)
{
HWND32
focus
,
curr
;
...
...
@@ -2360,7 +2361,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
{
wndPtr
->
dwStyle
&=
~
WS_VISIBLE
;
if
(
wndPtr
->
window
)
if
(
((
X11DRV_WND_DATA
*
)
wndPtr
->
pDriverData
)
->
window
)
{
wndPtr
->
pDriver
->
pSetWindowPos
(
wndPtr
,
&
winpos
,
uFlags
&
SMC_SETXPOS
);
if
(
uFlags
&
SMC_SETXPOS
)
...
...
@@ -2396,7 +2397,8 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter,
/* Repaint the window */
if
(
wndPtr
->
window
)
EVENT_Synchronize
();
/* Wait for all expose events */
if
(((
X11DRV_WND_DATA
*
)
wndPtr
->
pDriverData
)
->
window
)
EVENT_Synchronize
();
/* Wait for all expose events */
if
(
!
GetCapture32
())
EVENT_DummyMotionNotify
();
/* Simulate a mouse event to set the cursor */
...
...
windows/x11drv/clipboard.c
View file @
151170c4
...
...
@@ -38,19 +38,21 @@ static Window selectionPrevWindow = None;
*/
static
void
X11DRV_CLIPBOARD_CheckSelection
(
WND
*
pWnd
)
{
TRACE
(
clipboard
,
"
\t
checking %08x
\n
"
,
(
unsigned
)
pWnd
->
window
);
TRACE
(
clipboard
,
"
\t
checking %08x
\n
"
,
(
unsigned
)
X11DRV_WND_GetXWindow
(
pWnd
)
);
if
(
selectionAcquired
&&
selectionWindow
!=
None
&&
pWnd
->
window
==
selectionWindow
)
X11DRV_WND_GetXWindow
(
pWnd
)
==
selectionWindow
)
{
selectionPrevWindow
=
selectionWindow
;
selectionWindow
=
None
;
if
(
pWnd
->
next
)
selectionWindow
=
pWnd
->
next
->
window
;
selectionWindow
=
X11DRV_WND_GetXWindow
(
pWnd
->
next
)
;
else
if
(
pWnd
->
parent
)
if
(
pWnd
->
parent
->
child
!=
pWnd
)
selectionWindow
=
pWnd
->
parent
->
child
->
window
;
selectionWindow
=
X11DRV_WND_GetXWindow
(
pWnd
->
parent
->
child
)
;
TRACE
(
clipboard
,
"
\t
switching selection from %08x to %08x
\n
"
,
(
unsigned
)
selectionPrevWindow
,
(
unsigned
)
selectionWindow
);
...
...
@@ -208,7 +210,9 @@ void X11DRV_CLIPBOARD_SetClipboardData(UINT32 wFormat)
if
(
!
selectionAcquired
&&
(
wFormat
==
CF_TEXT
||
wFormat
==
CF_OEMTEXT
)
)
{
owner
=
X11DRV_WND_GetXWindow
(
hWndClipWindow
?
hWndClipWindow
:
AnyPopup32
()
);
owner
=
X11DRV_WND_FindXWindow
(
WIN_FindWndPtr
(
hWndClipWindow
?
hWndClipWindow
:
AnyPopup32
()
)
);
TSXSetSelectionOwner
(
display
,
XA_PRIMARY
,
owner
,
CurrentTime
);
if
(
TSXGetSelectionOwner
(
display
,
XA_PRIMARY
)
==
owner
)
...
...
@@ -240,9 +244,10 @@ BOOL32 X11DRV_CLIPBOARD_RequestSelection()
* CLIPBOARD_ReadSelection() will be invoked
* from the SelectionNotify event handler */
TSXConvertSelection
(
display
,
XA_PRIMARY
,
XA_STRING
,
TSXInternAtom
(
display
,
"PRIMARY_TEXT"
,
False
),
X11DRV_WND_GetXWindow
(
hWnd
),
CurrentTime
);
TSXConvertSelection
(
display
,
XA_PRIMARY
,
XA_STRING
,
TSXInternAtom
(
display
,
"PRIMARY_TEXT"
,
False
),
X11DRV_WND_FindXWindow
(
WIN_FindWndPtr
(
hWnd
)
),
CurrentTime
);
/* wait until SelectionNotify is processed
*
...
...
@@ -265,10 +270,16 @@ BOOL32 X11DRV_CLIPBOARD_RequestSelection()
*
* Called from DestroyWindow().
*/
void
X11DRV_CLIPBOARD_ResetOwner
(
WND
*
pWnd
)
void
X11DRV_CLIPBOARD_ResetOwner
(
WND
*
pWnd
,
BOOL32
bFooBar
)
{
LPCLIPFORMAT
lpFormat
=
ClipFormats
;
if
(
bFooBar
&&
X11DRV_WND_GetXWindow
(
pWnd
))
return
;
if
(
!
bFooBar
&&
!
X11DRV_WND_GetXWindow
(
pWnd
))
return
;
TRACE
(
clipboard
,
"clipboard owner = %04x, selection = %08x
\n
"
,
hWndClipOwner
,
(
unsigned
)
selectionWindow
);
...
...
@@ -293,7 +304,7 @@ void X11DRV_CLIPBOARD_ResetOwner(WND *pWnd)
/* now try to salvage current selection from being destroyed by X */
if
(
pWnd
->
window
)
X11DRV_CLIPBOARD_CheckSelection
(
pWnd
);
if
(
X11DRV_WND_GetXWindow
(
pWnd
)
)
X11DRV_CLIPBOARD_CheckSelection
(
pWnd
);
}
#endif
/* !defined(X_DISPLAY_MISSING) */
windows/x11drv/event.c
View file @
151170c4
/*
* X11
windows
driver
* X11
event
driver
*
* Copyright 1993 Alexandre Julliard
*/
...
...
@@ -526,11 +526,12 @@ static BOOL32 EVENT_QueryZOrder( WND* pWndCheck )
if
(
!
__check_query_condition
(
&
pWndZ
,
&
pWnd
)
)
return
TRUE
;
parent
=
__get_common_ancestor
(
pWndZ
->
window
,
pWnd
->
window
,
parent
=
__get_common_ancestor
(
X11DRV_WND_GetXWindow
(
pWndZ
),
X11DRV_WND_GetXWindow
(
pWnd
),
&
children
,
&
total
);
if
(
parent
&&
children
)
{
w
=
__get_top_decoration
(
pWndCheck
->
window
,
parent
);
w
=
__get_top_decoration
(
X11DRV_WND_GetXWindow
(
pWndCheck
)
,
parent
);
if
(
w
!=
children
[
total
-
1
]
)
{
check
=
__td_lookup
(
w
,
children
,
total
);
...
...
@@ -540,7 +541,7 @@ static BOOL32 EVENT_QueryZOrder( WND* pWndCheck )
if
(
pWnd
!=
pWndCheck
)
{
if
(
!
(
pWnd
->
flags
&
WIN_MANAGED
)
||
!
(
w
=
__get_top_decoration
(
pWnd
->
window
,
parent
))
)
!
(
w
=
__get_top_decoration
(
X11DRV_WND_GetXWindow
(
pWnd
)
,
parent
))
)
continue
;
pos
=
__td_lookup
(
w
,
children
,
total
);
if
(
pos
<
best
&&
pos
>
check
)
...
...
@@ -1029,7 +1030,7 @@ static void EVENT_DropFromOffiX( WND *pWnd, XClientMessageEvent *event )
if
(
!
lpDragInfo
||
!
spDragInfo
)
return
;
TSXQueryPointer
(
display
,
pWnd
->
window
,
&
w_aux_root
,
&
w_aux_child
,
TSXQueryPointer
(
display
,
X11DRV_WND_GetXWindow
(
pWnd
)
,
&
w_aux_root
,
&
w_aux_child
,
&
x
,
&
y
,
&
u
.
pt_aux
.
x
,
&
u
.
pt_aux
.
y
,
(
unsigned
int
*
)
&
aux_long
);
lpDragInfo
->
hScope
=
pWnd
->
hwndSelf
;
...
...
windows/x11drv/init.c
View file @
151170c4
...
...
@@ -12,6 +12,8 @@
WND_DRIVER
X11DRV_WND_Driver
=
{
X11DRV_WND_Initialize
,
X11DRV_WND_Finalize
,
X11DRV_WND_CreateDesktopWindow
,
X11DRV_WND_CreateWindow
,
X11DRV_WND_DestroyWindow
,
...
...
@@ -21,7 +23,10 @@ WND_DRIVER X11DRV_WND_Driver =
X11DRV_WND_SetText
,
X11DRV_WND_SetFocus
,
X11DRV_WND_PreSizeMove
,
X11DRV_WND_PostSizeMove
X11DRV_WND_PostSizeMove
,
X11DRV_WND_ScrollWindow
,
X11DRV_WND_SetDrawable
,
X11DRV_WND_IsSelfClipping
};
CLIPBOARD_DRIVER
X11DRV_CLIPBOARD_Driver
=
...
...
@@ -55,16 +60,12 @@ EVENT_DRIVER X11DRV_EVENT_Driver =
X11DRV_EVENT_IsUserIdle
};
#if 0
MOUSE_DRIVER
X11DRV_MOUSE_Driver
=
{
X11DRV_MOUSE_SetCursor
,
X11DRV_MOUSE_MoveCursor
};
#endif
#endif
/* !defined(X_DISPLAY_MISSING) */
windows/x11drv/mouse.c
View file @
151170c4
/*
* X11
windows
driver
* X11
mouse
driver
*
* Copyright 1998
Patrik Stridvall
* Copyright 1998
Ulrich Weigand
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#include "ts_xlib.h"
#include "debug.h"
#include "callback.h"
#include "wintypes.h"
#include "x11drv.h"
/**********************************************************************/
Cursor
DISPLAY_XCursor
=
None
;
/* Current X cursor */
BOOL32
DISPLAY_DisableWarpPointer
=
FALSE
;
/* hack; see DISPLAY_MoveCursor */
/***********************************************************************
* X11DRV_MOUSE_DoSetCursor
*/
static
BOOL32
X11DRV_MOUSE_DoSetCursor
(
CURSORICONINFO
*
ptr
)
{
Pixmap
pixmapBits
,
pixmapMask
,
pixmapAll
;
XColor
fg
,
bg
;
Cursor
cursor
=
None
;
if
(
!
ptr
)
/* Create an empty cursor */
{
static
const
char
data
[]
=
{
0
};
bg
.
red
=
bg
.
green
=
bg
.
blue
=
0x0000
;
pixmapBits
=
XCreateBitmapFromData
(
display
,
rootWindow
,
data
,
1
,
1
);
if
(
pixmapBits
)
{
cursor
=
XCreatePixmapCursor
(
display
,
pixmapBits
,
pixmapBits
,
&
bg
,
&
bg
,
0
,
0
);
XFreePixmap
(
display
,
pixmapBits
);
}
}
else
/* Create the X cursor from the bits */
{
XImage
*
image
;
if
(
ptr
->
bPlanes
*
ptr
->
bBitsPerPixel
!=
1
)
{
WARN
(
cursor
,
"Cursor has more than 1 bpp!
\n
"
);
return
FALSE
;
}
/* Create a pixmap and transfer all the bits to it */
/* NOTE: Following hack works, but only because XFree depth
* 1 images really use 1 bit/pixel (and so the same layout
* as the Windows cursor data). Perhaps use a more generic
* algorithm here.
*/
pixmapAll
=
XCreatePixmap
(
display
,
rootWindow
,
ptr
->
nWidth
,
ptr
->
nHeight
*
2
,
1
);
image
=
XCreateImage
(
display
,
DefaultVisualOfScreen
(
screen
),
1
,
ZPixmap
,
0
,
(
char
*
)(
ptr
+
1
),
ptr
->
nWidth
,
ptr
->
nHeight
*
2
,
16
,
ptr
->
nWidthBytes
);
if
(
image
)
{
image
->
byte_order
=
MSBFirst
;
image
->
bitmap_bit_order
=
MSBFirst
;
image
->
bitmap_unit
=
16
;
_XInitImageFuncPtrs
(
image
);
if
(
pixmapAll
)
XPutImage
(
display
,
pixmapAll
,
BITMAP_monoGC
,
image
,
0
,
0
,
0
,
0
,
ptr
->
nWidth
,
ptr
->
nHeight
*
2
);
image
->
data
=
NULL
;
XDestroyImage
(
image
);
}
/* Now create the 2 pixmaps for bits and mask */
pixmapBits
=
XCreatePixmap
(
display
,
rootWindow
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
);
pixmapMask
=
XCreatePixmap
(
display
,
rootWindow
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
);
/* Make sure everything went OK so far */
if
(
pixmapBits
&&
pixmapMask
&&
pixmapAll
)
{
/* We have to do some magic here, as cursors are not fully
* compatible between Windows and X11. Under X11, there
* are only 3 possible color cursor: black, white and
* masked. So we map the 4th Windows color (invert the
* bits on the screen) to black. This require some boolean
* arithmetic:
*
* Windows | X11
* Xor And Result | Bits Mask Result
* 0 0 black | 0 1 background
* 0 1 no change | X 0 no change
* 1 0 white | 1 1 foreground
* 1 1 inverted | 0 1 background
*
* which gives:
* Bits = 'Xor' and not 'And'
* Mask = 'Xor' or not 'And'
*
* FIXME: apparently some servers do support 'inverted' color.
* I don't know if it's correct per the X spec, but maybe
* we ought to take advantage of it. -- AJ
*/
XCopyArea
(
display
,
pixmapAll
,
pixmapBits
,
BITMAP_monoGC
,
0
,
0
,
ptr
->
nWidth
,
ptr
->
nHeight
,
0
,
0
);
XCopyArea
(
display
,
pixmapAll
,
pixmapMask
,
BITMAP_monoGC
,
0
,
0
,
ptr
->
nWidth
,
ptr
->
nHeight
,
0
,
0
);
XSetFunction
(
display
,
BITMAP_monoGC
,
GXandReverse
);
XCopyArea
(
display
,
pixmapAll
,
pixmapBits
,
BITMAP_monoGC
,
0
,
ptr
->
nHeight
,
ptr
->
nWidth
,
ptr
->
nHeight
,
0
,
0
);
XSetFunction
(
display
,
BITMAP_monoGC
,
GXorReverse
);
XCopyArea
(
display
,
pixmapAll
,
pixmapMask
,
BITMAP_monoGC
,
0
,
ptr
->
nHeight
,
ptr
->
nWidth
,
ptr
->
nHeight
,
0
,
0
);
XSetFunction
(
display
,
BITMAP_monoGC
,
GXcopy
);
fg
.
red
=
fg
.
green
=
fg
.
blue
=
0xffff
;
bg
.
red
=
bg
.
green
=
bg
.
blue
=
0x0000
;
cursor
=
XCreatePixmapCursor
(
display
,
pixmapBits
,
pixmapMask
,
&
fg
,
&
bg
,
ptr
->
ptHotSpot
.
x
,
ptr
->
ptHotSpot
.
y
);
}
/* Now free everything */
if
(
pixmapAll
)
XFreePixmap
(
display
,
pixmapAll
);
if
(
pixmapBits
)
XFreePixmap
(
display
,
pixmapBits
);
if
(
pixmapMask
)
XFreePixmap
(
display
,
pixmapMask
);
}
if
(
cursor
==
None
)
return
FALSE
;
if
(
DISPLAY_XCursor
!=
None
)
XFreeCursor
(
display
,
DISPLAY_XCursor
);
DISPLAY_XCursor
=
cursor
;
if
(
rootWindow
!=
DefaultRootWindow
(
display
)
||
!
WIN_GetDesktop
())
{
/* Set the cursor on the desktop window */
XDefineCursor
(
display
,
rootWindow
,
cursor
);
}
else
{
/* FIXME: this won't work correctly with native USER !*/
/* Set the same cursor for all top-level windows */
HWND32
hwnd
=
GetWindow32
(
GetDesktopWindow32
(),
GW_CHILD
);
while
(
hwnd
)
{
Window
win
=
X11DRV_WND_FindXWindow
(
WIN_FindWndPtr
(
hwnd
)
);
if
(
win
&&
win
!=
DefaultRootWindow
(
display
))
XDefineCursor
(
display
,
win
,
cursor
);
hwnd
=
GetWindow32
(
hwnd
,
GW_HWNDNEXT
);
}
}
return
TRUE
;
}
/***********************************************************************
* X11DRV_MOUSE_SetCursor
*/
void
X11DRV_MOUSE_SetCursor
(
CURSORICONINFO
*
lpCursor
)
{
EnterCriticalSection
(
&
X11DRV_CritSection
);
CALL_LARGE_STACK
(
X11DRV_MOUSE_DoSetCursor
,
lpCursor
);
LeaveCriticalSection
(
&
X11DRV_CritSection
);
}
/***********************************************************************
* X11DRV_MOUSE_MoveCursor
*/
void
X11DRV_MOUSE_MoveCursor
(
WORD
wAbsX
,
WORD
wAbsY
)
{
/*
* We do not want the to create MotionNotify events here,
* otherwise we will get an endless recursion:
* XMotionEvent -> MOUSEEVENTF_MOVE -> mouse_event -> DisplayMoveCursor
* -> XWarpPointer -> XMotionEvent -> ...
*
* Unfortunately, the XWarpPointer call does create a MotionNotify
* event. So, we use a hack: before MOUSE_SendEvent calls the mouse event
* procedure, it sets a global flag. If this flag is set, we skip the
* XWarpPointer call. If we are *not* called from within MOUSE_SendEvent,
* we will call XWarpPointer, which will create a MotionNotify event.
* Strictly speaking, this is also wrong, but that should normally not
* have any negative effects ...
*
* But first of all, we check whether we already are at the position
* are supposed to move to; if so, we don't need to do anything.
*/
Window
root
,
child
;
int
rootX
,
rootY
,
winX
,
winY
;
unsigned
int
xstate
;
if
(
DISPLAY_DisableWarpPointer
)
return
;
if
(
!
TSXQueryPointer
(
display
,
rootWindow
,
&
root
,
&
child
,
&
rootX
,
&
rootY
,
&
winX
,
&
winY
,
&
xstate
))
return
;
if
(
winX
==
wAbsX
&&
winY
==
wAbsY
)
return
;
TRACE
(
cursor
,
"(%d,%d): moving from (%d,%d)
\n
"
,
wAbsX
,
wAbsY
,
winX
,
winY
);
TSXWarpPointer
(
display
,
rootWindow
,
rootWindow
,
0
,
0
,
0
,
0
,
wAbsX
,
wAbsY
);
}
#endif
/* !defined(X_DISPLAY_MISSING) */
windows/x11drv/wnd.c
View file @
151170c4
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment