Commit 44a1b59c authored by Alex Korobka's avatar Alex Korobka Committed by Alexandre Julliard

Fixes for ignored WVR_[VH]REDRAW flags, made minimization in managed

mode go through window manager, small bugfixes for menu and window code, extended clipboard driver model to handle formats other than text.
parent dc75bd40
......@@ -1177,10 +1177,11 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
GetClientRect( hwnd, &rect );
/* if(!TWEAK_Win95Look) { */
if(TWEAK_WineLook == WIN31_LOOK)
{
rect.bottom -= POPUP_YSHADE * SYSMETRICS_CYBORDER;
rect.right -= POPUP_XSHADE * SYSMETRICS_CXBORDER;
/* } */
}
if((hPrevBrush = SelectObject( hdc, GetSysColorBrush(COLOR_MENU) )))
{
......@@ -1397,8 +1398,11 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
}
if( y < 0 ) y = 0;
width += POPUP_XSHADE * SYSMETRICS_CXBORDER; /* add space for shading */
height += POPUP_YSHADE * SYSMETRICS_CYBORDER;
if( TWEAK_WineLook == WIN31_LOOK )
{
width += POPUP_XSHADE * SYSMETRICS_CXBORDER; /* add space for shading */
height += POPUP_YSHADE * SYSMETRICS_CYBORDER;
}
/* NOTE: In Windows, top menu popup is not owned. */
if (!pTopPopupWnd) /* create top level popup menu window */
......
......@@ -530,4 +530,15 @@ BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ * bmp )
return TRUE;
}
/***********************************************************************
* X11DRV_BITMAP_Pixmap
*
* This function exists solely for x11 driver of the window system.
*/
BOOL X11DRV_BITMAP_Pixmap(HBITMAP hbitmap)
{
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
return ((X11DRV_PHYSBITMAP *)(bmp->DDBitmap->physBitmap))->pixmap;
}
#endif /* !defined(X_DISPLAY_MISSING) */
......@@ -19,9 +19,9 @@ typedef struct tagWINE_CLIPFORMAT {
typedef struct tagCLIPBOARD_DRIVER
{
void (*pEmptyClipboard)(void);
void (*pSetClipboardData)(UINT);
BOOL (*pRequestSelection)(void);
void (*pEmpty)(void);
void (*pSetData)(UINT);
BOOL (*pGetData)(UINT);
void (*pResetOwner)(struct tagWND *, BOOL);
} CLIPBOARD_DRIVER;
......
......@@ -43,6 +43,7 @@ extern int TSXInitThreads(void);
extern int * TSXListDepths(Display*, int, int*);
extern int TSXReconfigureWMWindow(Display*, Window, int, unsigned int, XWindowChanges*);
extern int TSXSetWMProtocols(Display*, Window, Atom*, int);
extern int TSXIconifyWindow(Display*, Window, int);
extern int TSXSetTransientForHint(Display*, Window, Window);
extern int TSXActivateScreenSaver(Display*);
extern int TSXAllocColor(Display*, Colormap, XColor*);
......
......@@ -68,9 +68,9 @@ extern void TTYDRV_USER_EndDebugging(void);
extern struct tagCLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
extern void TTYDRV_CLIPBOARD_EmptyClipboard(void);
extern void TTYDRV_CLIPBOARD_SetClipboardData(UINT wFormat);
extern BOOL TTYDRV_CLIPBOARD_RequestSelection(void);
extern void TTYDRV_CLIPBOARD_Empty(void);
extern void TTYDRV_CLIPBOARD_SetData(UINT wFormat);
extern BOOL TTYDRV_CLIPBOARD_GetData(UINT wFormat);
extern void TTYDRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
/* TTY desktop driver */
......
......@@ -92,6 +92,7 @@ typedef struct tagWND
#define HAK_BITGRAVITY 1
#define HAK_ACCEPTFOCUS 2
#define HAK_ICONICSTATE 3
/* Bit Gravity */
......
......@@ -31,7 +31,7 @@ extern BOOL WINPOS_ShowIconTitle( WND* pWnd, BOOL bShow );
extern void WINPOS_GetMinMaxInfo( WND* pWnd, POINT *maxSize,
POINT *maxPos, POINT *minTrack,
POINT *maxTrack );
extern UINT16 WINPOS_MinMaximize( WND* pWnd, UINT16 cmd, LPRECT16 lpPos);
extern UINT WINPOS_MinMaximize( WND* pWnd, UINT16 cmd, LPRECT16 lpPos);
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
BOOL fChangeFocus );
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
......
......@@ -313,13 +313,11 @@ extern void X11DRV_USER_EndDebugging(void);
extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
extern void X11DRV_CLIPBOARD_EmptyClipboard(void);
extern void X11DRV_CLIPBOARD_SetClipboardData(UINT wFormat);
extern BOOL X11DRV_CLIPBOARD_RequestSelection(void);
extern void X11DRV_CLIPBOARD_Empty(void);
extern void X11DRV_CLIPBOARD_SetData(UINT wFormat);
extern BOOL X11DRV_CLIPBOARD_GetData(UINT wFormat);
extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
void X11DRV_CLIPBOARD_ReadSelection(Window w, Atom prop);
void X11DRV_CLIPBOARD_ReleaseSelection(Window w, HWND hwnd);
extern void X11DRV_CLIPBOARD_ReleaseSelection(Window w, HWND hwnd);
/* X11 desktop driver */
......@@ -415,6 +413,7 @@ extern struct tagWND_DRIVER X11DRV_WND_Driver;
typedef struct _X11DRV_WND_DATA {
Window window;
HBITMAP hWMIconBitmap;
int bit_gravity;
} X11DRV_WND_DATA;
......
......@@ -77,6 +77,7 @@ XGetWMSizeHints
XGetWindowAttributes
XGetWindowProperty
XGrabServer
XIconifyWindow
XInitThreads
XInstallColormap
XInternAtom
......
......@@ -308,6 +308,17 @@ int TSXSetWMProtocols(Display* a0, Window a1, Atom* a2, int a3)
return r;
}
int TSXIconifyWindow(Display* a0, Window a1, int a2)
{
int r;
TRACE(x11, "Call XIconifyWindow\n");
EnterCriticalSection( &X11DRV_CritSection );
r = XIconifyWindow(a0, a1, a2);
LeaveCriticalSection( &X11DRV_CritSection );
TRACE(x11, "Ret XIconifyWindow\n");
return r;
}
int TSXSetTransientForHint(Display* a0, Window a1, Window a2)
{
int r;
......
......@@ -250,7 +250,7 @@ BOOL WINAPI EmptyClipboard(void)
hWndClipOwner = hWndClipWindow;
CLIPBOARD_Driver->pEmptyClipboard();
CLIPBOARD_Driver->pEmpty();
return TRUE;
}
......@@ -293,7 +293,7 @@ HANDLE16 WINAPI SetClipboardData16( UINT16 wFormat, HANDLE16 hData )
if( (hqClipLock != GetFastQueue16()) || !lpFormat ||
(!hData && (!hWndClipOwner || (hWndClipOwner != hWndClipWindow))) ) return 0;
CLIPBOARD_Driver->pSetClipboardData(wFormat);
CLIPBOARD_Driver->pSetData(wFormat);
if ( lpFormat->wDataPresent || lpFormat->hData16 || lpFormat->hData32 )
{
......@@ -323,7 +323,7 @@ HANDLE16 WINAPI SetClipboardData16( UINT16 wFormat, HANDLE16 hData )
/**************************************************************************
* SetClipboardData32 (USER32.470)
* SetClipboardData (USER32.470)
*/
HANDLE WINAPI SetClipboardData( UINT wFormat, HANDLE hData )
{
......@@ -341,7 +341,7 @@ HANDLE WINAPI SetClipboardData( UINT wFormat, HANDLE hData )
if( (hqClipLock != GetFastQueue16()) || !lpFormat ||
(!hData && (!hWndClipOwner || (hWndClipOwner != hWndClipWindow))) ) return 0;
CLIPBOARD_Driver->pSetClipboardData(wFormat);
CLIPBOARD_Driver->pSetData(wFormat);
if ( lpFormat->wDataPresent || lpFormat->hData16 || lpFormat->hData32 )
{
......@@ -395,6 +395,9 @@ static BOOL CLIPBOARD_RenderFormat(LPWINE_CLIPFORMAT lpFormat)
* CLIPBOARD_RenderText
*
* Convert text between UNIX and DOS formats.
*
* FIXME: Should be a pair of driver functions that convert between OEM text and Windows.
*
*/
static BOOL CLIPBOARD_RenderText(LPWINE_CLIPFORMAT lpTarget, LPWINE_CLIPFORMAT lpSource)
{
......@@ -608,15 +611,13 @@ INT WINAPI CountClipboardFormats(void)
TRACE(clipboard,"(void)\n");
/* FIXME: Returns BOOL32 */
CLIPBOARD_Driver->pRequestSelection();
FormatCount += abs(lpFormat[CF_TEXT-1].wDataPresent -
lpFormat[CF_OEMTEXT-1].wDataPresent);
while(TRUE)
{
if (lpFormat == NULL) break;
if( lpFormat->wFormatID != CF_TEXT )
CLIPBOARD_Driver->pGetData( lpFormat->wFormatID );
if (lpFormat->wDataPresent)
{
TRACE(clipboard, "\tdata found for format %i\n", lpFormat->wFormatID);
......@@ -625,6 +626,11 @@ INT WINAPI CountClipboardFormats(void)
lpFormat = lpFormat->NextFormat;
}
/* these two are equivalent, adjust the total */
FormatCount += abs(ClipFormats[CF_TEXT-1].wDataPresent -
ClipFormats[CF_OEMTEXT-1].wDataPresent);
TRACE(clipboard,"\ttotal %d\n", FormatCount);
return FormatCount;
}
......@@ -650,29 +656,30 @@ UINT WINAPI EnumClipboardFormats( UINT wFormat )
if( hqClipLock != GetFastQueue16() ) return 0;
if( (!wFormat || wFormat == CF_TEXT || wFormat == CF_OEMTEXT) )
CLIPBOARD_Driver->pRequestSelection();
if( wFormat < CF_OEMTEXT )
CLIPBOARD_Driver->pGetData( CF_OEMTEXT );
if (wFormat == 0)
if (wFormat == 0) /* start from the beginning */
lpFormat = ClipFormats;
else
{
if (lpFormat->wDataPresent || ClipFormats[CF_OEMTEXT-1].wDataPresent)
return lpFormat->wFormatID;
else
wFormat = lpFormat->wFormatID; /* and CF_TEXT is not available */
}
/* walk up to the specified format record */
if( !(lpFormat = __lookup_format( lpFormat, wFormat )) ) return 0;
/* walk up to the specified format record */
/* find next format with available data */
if( !(lpFormat = __lookup_format( lpFormat, wFormat )) )
return 0;
lpFormat = lpFormat->NextFormat; /* right */
}
lpFormat = lpFormat->NextFormat;
while(TRUE)
{
if (lpFormat == NULL) return 0;
if (lpFormat->wDataPresent || (lpFormat->wFormatID == CF_OEMTEXT &&
ClipFormats[CF_TEXT-1].wDataPresent))
if( lpFormat->wFormatID != CF_OEMTEXT && lpFormat->wFormatID != CF_TEXT )
CLIPBOARD_Driver->pGetData( lpFormat->wFormatID );
if (lpFormat->wDataPresent ||
(lpFormat->wFormatID == CF_OEMTEXT && ClipFormats[CF_TEXT-1].wDataPresent) ||
(lpFormat->wFormatID == CF_TEXT && ClipFormats[CF_OEMTEXT-1].wDataPresent) )
break;
lpFormat = lpFormat->NextFormat;
}
......@@ -877,8 +884,7 @@ BOOL WINAPI IsClipboardFormatAvailable( UINT wFormat )
{
TRACE(clipboard,"(%04X) !\n", wFormat);
if( (wFormat == CF_TEXT || wFormat == CF_OEMTEXT) )
CLIPBOARD_Driver->pRequestSelection();
CLIPBOARD_Driver->pGetData( (wFormat == CF_TEXT) ? CF_OEMTEXT : wFormat );
return CLIPBOARD_IsPresent(wFormat);
}
......
......@@ -502,12 +502,14 @@ static BOOL MSG_PeekHardwareMsg( MSG *msg, HWND hwnd, DWORD first, DWORD last,
qmsg = sysMsgQueue->firstMsg;
#if 0
/* If the queue is empty, attempt to fill it */
if (!sysMsgQueue->msgCount && THREAD_IsWin16( THREAD_Current() )
&& EVENT_Pending())
EVENT_WaitNetEvent( FALSE, FALSE );
#endif
{
LeaveCriticalSection(&sysMsgQueue->cSection);
EVENT_WaitNetEvent( FALSE, TRUE );
EnterCriticalSection(&sysMsgQueue->cSection);
}
for ( kbd_msg = 0; qmsg; qmsg = nextqmsg)
{
......
......@@ -15,7 +15,7 @@ char *TTYDRV_CLIPBOARD_szSelection = NULL;
/***********************************************************************
* TTYDRV_CLIPBOARD_EmptyClipboard
*/
void TTYDRV_CLIPBOARD_EmptyClipboard()
void TTYDRV_CLIPBOARD_Empty()
{
if(TTYDRV_CLIPBOARD_szSelection)
{
......@@ -25,16 +25,16 @@ void TTYDRV_CLIPBOARD_EmptyClipboard()
}
/***********************************************************************
* TTYDRV_CLIPBOARD_SetClipboardData
* TTYDRV_CLIPBOARD_SetData
*/
void TTYDRV_CLIPBOARD_SetClipboardData(UINT wFormat)
void TTYDRV_CLIPBOARD_SetData(UINT wFormat)
{
}
/***********************************************************************
* TTYDRV_CLIPBOARD_RequestSelection
* TTYDRV_CLIPBOARD_GetData
*/
BOOL TTYDRV_CLIPBOARD_RequestSelection()
BOOL TTYDRV_CLIPBOARD_GetData(UINT wFormat)
{
return FALSE;
}
......
......@@ -24,9 +24,9 @@ USER_DRIVER TTYDRV_USER_Driver =
CLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver =
{
TTYDRV_CLIPBOARD_EmptyClipboard,
TTYDRV_CLIPBOARD_SetClipboardData,
TTYDRV_CLIPBOARD_RequestSelection,
TTYDRV_CLIPBOARD_Empty,
TTYDRV_CLIPBOARD_SetData,
TTYDRV_CLIPBOARD_GetData,
TTYDRV_CLIPBOARD_ResetOwner
};
......
......@@ -836,10 +836,14 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
/* Correct the window style */
if (!(cs->style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
if (!(cs->style & WS_CHILD))
{
wndPtr->dwStyle |= WS_CAPTION | WS_CLIPSIBLINGS;
wndPtr->flags |= WIN_NEED_SIZE;
wndPtr->dwStyle |= WS_CLIPSIBLINGS;
if (!(cs->style & WS_POPUP))
{
wndPtr->dwStyle |= WS_CAPTION;
wndPtr->flags |= WIN_NEED_SIZE;
}
}
if (cs->dwExStyle & WS_EX_DLGMODALFRAME) wndPtr->dwStyle &= ~WS_THICKFRAME;
......@@ -2701,13 +2705,10 @@ WND **WIN_BuildWinArray( WND *wndPtr, UINT bwaFlags, UINT* pTotal )
pWnd = WIN_LockWndPtr(wndPtr->child);
while (pWnd)
{
if( (pWnd->dwStyle & skipFlags) || (skipOwned && pWnd->owner) ) continue;
if( !skipHidden || pWnd->dwStyle & WS_VISIBLE )
{
if( !(pWnd->dwStyle & skipFlags) && !(skipOwned && pWnd->owner) &&
(!skipHidden || (pWnd->dwStyle & WS_VISIBLE)) )
count++;
WIN_UpdateWndPtr(&pWnd,pWnd->next);
}
WIN_UpdateWndPtr(&pWnd,pWnd->next);
}
if( count )
......
......@@ -24,7 +24,6 @@ extern HWND hWndClipOwner;
extern HWND hWndClipWindow;
extern WINE_CLIPFORMAT ClipFormats[];
static Bool selectionWait = False;
static Bool selectionAcquired = False;
static Window selectionWindow = None;
static Window selectionPrevWindow = None;
......@@ -67,15 +66,13 @@ static void X11DRV_CLIPBOARD_CheckSelection(WND* pWnd)
/**************************************************************************
* X11DRV_CLIPBOARD_ReadSelection
*
* Called from the SelectionNotify event handler.
*/
void X11DRV_CLIPBOARD_ReadSelection(Window w,Atom prop)
static void X11DRV_CLIPBOARD_ReadSelection(Window w, Atom prop)
{
HANDLE hText = 0;
LPWINE_CLIPFORMAT lpFormat = ClipFormats;
TRACE(clipboard,"ReadSelection callback\n");
TRACE(clipboard,"Reading X selection...\n");
if(prop != None)
{
......@@ -126,19 +123,16 @@ void X11DRV_CLIPBOARD_ReadSelection(Window w,Atom prop)
if( hText )
{
lpFormat = &ClipFormats[CF_TEXT-1];
if (lpFormat->wDataPresent || lpFormat->hData16 || lpFormat->hData32)
CLIPBOARD_DeleteRecord(lpFormat, !(hWndClipWindow));
lpFormat = &ClipFormats[CF_OEMTEXT-1];
if (lpFormat->wDataPresent || lpFormat->hData16 || lpFormat->hData32)
CLIPBOARD_DeleteRecord(lpFormat, !(hWndClipWindow));
lpFormat->wDataPresent = 1;
lpFormat->hData32 = hText;
lpFormat->hData16 = 0;
lpFormat = &ClipFormats[CF_TEXT-1];
if (lpFormat->wDataPresent || lpFormat->hData16 || lpFormat->hData32)
CLIPBOARD_DeleteRecord(lpFormat, !(hWndClipWindow));
lpFormat = &ClipFormats[CF_OEMTEXT-1];
if (lpFormat->wDataPresent || lpFormat->hData16 || lpFormat->hData32)
CLIPBOARD_DeleteRecord(lpFormat, !(hWndClipWindow));
lpFormat->wDataPresent = 1;
lpFormat->hData32 = hText;
lpFormat->hData16 = 0;
}
selectionWait=False;
}
/**************************************************************************
......@@ -180,27 +174,35 @@ void X11DRV_CLIPBOARD_ReleaseSelection(Window w, HWND hwnd)
}
/**************************************************************************
* X11DRV_CLIPBOARD_EmptyClipboard
* X11DRV_CLIPBOARD_Empty
*/
void X11DRV_CLIPBOARD_EmptyClipboard()
void X11DRV_CLIPBOARD_Empty()
{
if(selectionAcquired)
if( selectionAcquired )
{
selectionAcquired = False;
selectionPrevWindow = selectionWindow;
selectionWindow = None;
XEvent xe;
selectionAcquired = False;
selectionPrevWindow = selectionWindow;
selectionWindow = None;
TRACE(clipboard, "\tgiving up selection (spw = %08x)\n",
(unsigned)selectionPrevWindow);
TRACE(clipboard, "\tgiving up selection (spw = %08x)\n",
(unsigned)selectionPrevWindow);
TSXSetSelectionOwner(display, XA_PRIMARY, None, CurrentTime);
EnterCriticalSection(&X11DRV_CritSection);
XSetSelectionOwner(display, XA_PRIMARY, None, CurrentTime);
if( selectionPrevWindow )
while( !XCheckTypedWindowEvent( display, selectionPrevWindow,
SelectionClear, &xe ) );
LeaveCriticalSection(&X11DRV_CritSection);
}
}
/**************************************************************************
* X11DRV_CLIPBOARD_SetClipboardData
* X11DRV_CLIPBOARD_SetData
*/
void X11DRV_CLIPBOARD_SetClipboardData(UINT wFormat)
void X11DRV_CLIPBOARD_SetData(UINT wFormat)
{
Window owner;
......@@ -226,45 +228,55 @@ void X11DRV_CLIPBOARD_SetClipboardData(UINT wFormat)
}
/**************************************************************************
* X11DRV_CLIPBOARD_RequestSelection
* X11DRV_CLIPBOARD_GetData
*
* NOTE: Clipboard driver doesn't get requests for CF_TEXT data, only
* for CF_OEMTEXT.
*/
BOOL X11DRV_CLIPBOARD_RequestSelection()
BOOL X11DRV_CLIPBOARD_GetData(UINT wFormat)
{
BOOL bRet = selectionAcquired;
HWND hWnd = (hWndClipWindow) ? hWndClipWindow : GetActiveWindow();
WND *tmpWnd = WIN_FindWndPtr(hWnd);
WND* wnd = NULL;
if( selectionAcquired )
return TRUE;
if( !hWnd ) return FALSE;
if( wFormat != CF_OEMTEXT ) return FALSE;
TRACE(clipboard,"Requesting selection...\n");
if( !bRet && (wnd = WIN_FindWndPtr(hWnd)) )
{
XEvent xe;
Window w = X11DRV_WND_FindXWindow(wnd);
/* request data type XA_STRING, later
* CLIPBOARD_ReadSelection() will be invoked
* from the SelectionNotify event handler */
TRACE(clipboard, "Requesting XA_STRING selection...\n");
TSXConvertSelection(display, XA_PRIMARY, XA_STRING,
TSXInternAtom(display, "PRIMARY_TEXT", False),
X11DRV_WND_FindXWindow(tmpWnd ),
CurrentTime);
EnterCriticalSection( &X11DRV_CritSection );
XConvertSelection(display, XA_PRIMARY, XA_STRING,
XInternAtom(display, "PRIMARY_TEXT", False),
w, CurrentTime);
WIN_ReleaseWndPtr(tmpWnd);
/* wait until SelectionNotify is received */
/* wait until SelectionNotify is processed
*
* FIXME: Use TSXCheckTypedWindowEvent() instead ( same in the
* CLIPBOARD_CheckSelection() ).
*/
while( TRUE )
{
if( XCheckTypedWindowEvent(display, w, SelectionNotify, &xe) )
if( xe.xselection.selection == XA_PRIMARY )
break;
}
LeaveCriticalSection( &X11DRV_CritSection );
if (xe.xselection.target != XA_STRING)
X11DRV_CLIPBOARD_ReadSelection( 0, None );
else
X11DRV_CLIPBOARD_ReadSelection( xe.xselection.requestor,
xe.xselection.property );
selectionWait=True;
while(selectionWait) EVENT_WaitNetEvent( TRUE, FALSE );
/* treat Unix text as CF_OEMTEXT */
/* we treat Unix text as CF_OEMTEXT */
TRACE(clipboard,"\tgot CF_OEMTEXT = %i\n",
ClipFormats[CF_OEMTEXT-1].wDataPresent);
bRet = (BOOL)ClipFormats[CF_OEMTEXT-1].wDataPresent;
return (BOOL)ClipFormats[CF_OEMTEXT-1].wDataPresent;
TRACE(clipboard,"\tpresent CF_OEMTEXT = %i\n", bRet );
WIN_ReleaseWndPtr(wnd);
}
return bRet;
}
/**************************************************************************
......
......@@ -95,10 +95,10 @@ static void EVENT_Expose( WND *pWnd, XExposeEvent *event );
static void EVENT_GraphicsExpose( WND *pWnd, XGraphicsExposeEvent *event );
static void EVENT_ConfigureNotify( WND *pWnd, XConfigureEvent *event );
static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event);
static void EVENT_SelectionNotify( XSelectionEvent *event);
static void EVENT_SelectionClear( WND *pWnd, XSelectionClearEvent *event);
static void EVENT_ClientMessage( WND *pWnd, XClientMessageEvent *event );
static void EVENT_MapNotify( HWND hwnd, XMapEvent *event );
static void EVENT_MapNotify( WND* wnd, XMapEvent *event );
static void EVENT_UnmapNotify( WND* wnd, XUnmapEvent *event );
/* Usable only with OLVWM - compile option perhaps?
static void EVENT_EnterNotify( WND *pWnd, XCrossingEvent *event );
......@@ -387,19 +387,22 @@ static void EVENT_ProcessEvent( XEvent *event )
WND *pWnd;
switch (event->type)
{
{
case SelectionNotify: /* all of these should be caught by XCheckTypedWindowEvent() */
FIXME(event,"Got SelectionNotify - must not happen!\n");
/* fall through */
/* We get all these because of StructureNotifyMask.
This check is placed here to avoid getting error messages below,
as X might send some of these even for windows that have already
been deleted ... */
case UnmapNotify:
case CirculateNotify:
case CreateNotify:
case DestroyNotify:
case GravityNotify:
case ReparentNotify:
return;
}
}
if ( TSXFindContext( display, event->xany.window, winContext,
(char **)&pWnd ) != 0) {
......@@ -482,11 +485,6 @@ static void EVENT_ProcessEvent( XEvent *event )
EVENT_SelectionRequest( pWnd, (XSelectionRequestEvent *)event );
break;
case SelectionNotify:
if (!pWnd) return;
EVENT_SelectionNotify( (XSelectionEvent *)event );
break;
case SelectionClear:
if (!pWnd) return;
EVENT_SelectionClear( pWnd, (XSelectionClearEvent*) event );
......@@ -508,9 +506,14 @@ static void EVENT_ProcessEvent( XEvent *event )
case MapNotify:
if (!pWnd) return;
EVENT_MapNotify( pWnd->hwndSelf, (XMapEvent *)event );
EVENT_MapNotify( pWnd, (XMapEvent *)event );
break;
case UnmapNotify:
if (!pWnd) return;
EVENT_UnmapNotify( pWnd, (XUnmapEvent *)event );
break;
default:
WARN(event, "Unprocessed event %s for hwnd %04x\n",
event_names[event->type], pWnd? pWnd->hwndSelf : 0 );
......@@ -1037,7 +1040,7 @@ TRACE(win, "%04x adjusted to (%i,%i)-(%i,%i)\n", pWnd->hwndSelf,
if( oldClientRect.top - oldWindowRect.top != newClientRect.top - newWindowRect.top ||
oldClientRect.left - oldWindowRect.left != newClientRect.left - newWindowRect.left )
RedrawWindow( winpos.hwnd, 0, NULL, RDW_FRAME | RDW_ALLCHILDREN |
RedrawWindow( winpos.hwnd, NULL, 0, RDW_FRAME | RDW_ALLCHILDREN |
RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW );
SendMessageA( winpos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos );
......@@ -1059,22 +1062,26 @@ static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event )
{
XSelectionEvent result;
Atom rprop = None;
Window request = event->requestor;
Window request = event->requestor;
if(event->target == XA_STRING)
{
{
HANDLE16 hText;
LPSTR text;
int size,i,j;
rprop = event->property;
if(rprop == None) rprop = event->target;
if( rprop == None )
rprop = event->target;
if(event->selection!=XA_PRIMARY) rprop = None;
else if(!CLIPBOARD_IsPresent(CF_OEMTEXT)) rprop = None;
if( event->selection != XA_PRIMARY )
rprop = None;
else
if( !CLIPBOARD_IsPresent(CF_OEMTEXT) )
rprop = None;
else
{
{
/* open to make sure that clipboard is available */
BOOL couldOpen = OpenClipboard( pWnd->hwndSelf );
......@@ -1088,11 +1095,11 @@ static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event )
lpstr = (char*)HEAP_xalloc( GetProcessHeap(), 0, size-- );
for(i=0,j=0; i < size && text[i]; i++ )
{
{
if( text[i] == '\r' &&
(text[i+1] == '\n' || text[i+1] == '\0') ) continue;
lpstr[j++] = text[i];
}
}
lpstr[j]='\0';
TSXChangeProperty(display, request, rprop,
......@@ -1103,11 +1110,13 @@ static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event )
/* close only if we opened before */
if(couldOpen) CloseClipboard();
}
}
}
}
if(rprop == None)
TRACE(event,"Request for %s ignored\n", TSXGetAtomName(display,event->target));
if( rprop == None)
TRACE(event,"Request for %s ignored\n", TSXGetAtomName(display,event->target));
/* reply to sender */
result.type = SelectionNotify;
result.display = display;
......@@ -1119,21 +1128,6 @@ static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event )
TSXSendEvent(display,event->requestor,False,NoEventMask,(XEvent*)&result);
}
/***********************************************************************
* EVENT_SelectionNotify
*/
static void EVENT_SelectionNotify( XSelectionEvent *event )
{
if (event->selection != XA_PRIMARY) return;
if (event->target != XA_STRING) X11DRV_CLIPBOARD_ReadSelection( 0, None );
else X11DRV_CLIPBOARD_ReadSelection( event->requestor, event->property );
TRACE(event, "\tSelectionNotify done!\n");
}
/***********************************************************************
* EVENT_SelectionClear
*/
......@@ -1465,18 +1459,36 @@ void EVENT_EnterNotify( WND *pWnd, XCrossingEvent *event )
/**********************************************************************
* EVENT_MapNotify
*/
void EVENT_MapNotify( HWND hWnd, XMapEvent *event )
void EVENT_MapNotify( WND* wnd, XMapEvent *event )
{
HWND hwndFocus = GetFocus();
WND *tmpWnd = WIN_FindWndPtr(hwndFocus);
if (hwndFocus && IsChild( hWnd, hwndFocus ))
X11DRV_WND_SetFocus(tmpWnd );
WIN_ReleaseWndPtr(tmpWnd);
WND *wndFocus = WIN_FindWndPtr(hwndFocus);
if (wnd->flags & WIN_MANAGED)
wnd->dwStyle &= ~WS_MINIMIZE;
if (hwndFocus && IsChild( wnd->hwndSelf, hwndFocus ))
X11DRV_WND_SetFocus(wndFocus);
WIN_ReleaseWndPtr(wndFocus);
return;
}
/**********************************************************************
* EVENT_MapNotify
*/
void EVENT_UnmapNotify( WND* wnd, XUnmapEvent *event )
{
if (wnd->flags & WIN_MANAGED)
{
EndMenu();
wnd->dwStyle |= WS_MINIMIZE;
}
}
/**********************************************************************
* X11DRV_EVENT_Pending
*/
......
......@@ -28,9 +28,9 @@ USER_DRIVER X11DRV_USER_Driver =
CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver =
{
X11DRV_CLIPBOARD_EmptyClipboard,
X11DRV_CLIPBOARD_SetClipboardData,
X11DRV_CLIPBOARD_RequestSelection,
X11DRV_CLIPBOARD_Empty,
X11DRV_CLIPBOARD_SetData,
X11DRV_CLIPBOARD_GetData,
X11DRV_CLIPBOARD_ResetOwner
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment