Commit d09c3289 authored by Alexandre Julliard's avatar Alexandre Julliard

Intern all the atoms we'll need in one step to avoid multiple server

round trips.
parent f01e7c63
...@@ -69,6 +69,7 @@ static DWORD CALLBACK desktop_thread( LPVOID driver_data ) ...@@ -69,6 +69,7 @@ static DWORD CALLBACK desktop_thread( LPVOID driver_data )
MSG msg; MSG msg;
HWND hwnd; HWND hwnd;
WND *win; WND *win;
Atom atom = x11drv_atom(WM_DELETE_WINDOW);
NtCurrentTeb()->driver_data = driver_data; NtCurrentTeb()->driver_data = driver_data;
display = thread_display(); display = thread_display();
...@@ -82,7 +83,8 @@ static DWORD CALLBACK desktop_thread( LPVOID driver_data ) ...@@ -82,7 +83,8 @@ static DWORD CALLBACK desktop_thread( LPVOID driver_data )
SetWindowLongW( hwnd, GWL_WNDPROC, (LONG)desktop_winproc ); SetWindowLongW( hwnd, GWL_WNDPROC, (LONG)desktop_winproc );
wine_tsx11_lock(); wine_tsx11_lock();
XSetWMProtocols( display, root_window, &wmDeleteWindow, 1 ); XChangeProperty ( display, root_window, x11drv_atom(WM_PROTOCOLS),
XA_ATOM, 32, PropModeReplace, (char *)&atom, 1 );
XMapWindow( display, root_window ); XMapWindow( display, root_window );
wine_tsx11_unlock(); wine_tsx11_unlock();
......
...@@ -56,12 +56,6 @@ WINE_DECLARE_DEBUG_CHANNEL(clipboard); ...@@ -56,12 +56,6 @@ WINE_DECLARE_DEBUG_CHANNEL(clipboard);
/* X context to associate a hwnd to an X window */ /* X context to associate a hwnd to an X window */
extern XContext winContext; extern XContext winContext;
extern Atom wmProtocols;
extern Atom wmDeleteWindow;
extern Atom dndProtocol;
extern Atom dndSelection;
extern Atom netwmPing;
#define DndNotDnd -1 /* OffiX drag&drop */ #define DndNotDnd -1 /* OffiX drag&drop */
#define DndUnknown 0 #define DndUnknown 0
#define DndRawData 1 #define DndRawData 1
...@@ -434,7 +428,7 @@ static void handle_wm_protocols_message( HWND hwnd, XClientMessageEvent *event ) ...@@ -434,7 +428,7 @@ static void handle_wm_protocols_message( HWND hwnd, XClientMessageEvent *event )
if (!protocol) return; if (!protocol) return;
if (protocol == wmDeleteWindow) if (protocol == x11drv_atom(WM_DELETE_WINDOW))
{ {
/* Ignore the delete window request if the window has been disabled /* Ignore the delete window request if the window has been disabled
* and we are in managed mode. This is to disallow applications from * and we are in managed mode. This is to disallow applications from
...@@ -442,7 +436,7 @@ static void handle_wm_protocols_message( HWND hwnd, XClientMessageEvent *event ) ...@@ -442,7 +436,7 @@ static void handle_wm_protocols_message( HWND hwnd, XClientMessageEvent *event )
*/ */
if (IsWindowEnabled(hwnd)) PostMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 ); if (IsWindowEnabled(hwnd)) PostMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
} }
else if (protocol == wmTakeFocus) else if (protocol == x11drv_atom(WM_TAKE_FOCUS))
{ {
Time event_time = (Time)event->data.l[1]; Time event_time = (Time)event->data.l[1];
HWND last_focus = x11drv_thread_data()->last_focus; HWND last_focus = x11drv_thread_data()->last_focus;
...@@ -469,7 +463,9 @@ static void handle_wm_protocols_message( HWND hwnd, XClientMessageEvent *event ) ...@@ -469,7 +463,9 @@ static void handle_wm_protocols_message( HWND hwnd, XClientMessageEvent *event )
if (!hwnd) hwnd = last_focus; if (!hwnd) hwnd = last_focus;
if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, event_time ); if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, event_time );
} }
} else if (protocol == netwmPing) { }
else if (protocol == x11drv_atom(_NET_WM_PING))
{
XClientMessageEvent xev; XClientMessageEvent xev;
xev = *event; xev = *event;
...@@ -513,7 +509,7 @@ static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event ) ...@@ -513,7 +509,7 @@ static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event )
XSetICFocus( xic ); XSetICFocus( xic );
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
if (wmTakeFocus) return; /* ignore FocusIn if we are using take focus */ if (use_take_focus) return; /* ignore FocusIn if we are using take focus */
if (!can_activate_window(hwnd)) if (!can_activate_window(hwnd))
{ {
...@@ -636,7 +632,7 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor, ...@@ -636,7 +632,7 @@ static Atom EVENT_SelectionRequest_TARGETS( Display *display, Window requestor,
return None; return None;
/* Create TARGETS property list (First item in list is TARGETS itself) */ /* Create TARGETS property list (First item in list is TARGETS itself) */
for (targets[0] = xaTargets, cTargets = 1, wFormat = 0; for (targets[0] = x11drv_atom(TARGETS), cTargets = 1, wFormat = 0;
(wFormat = X11DRV_EnumClipboardFormats(wFormat));) (wFormat = X11DRV_EnumClipboardFormats(wFormat));)
{ {
LPWINE_CLIPFORMAT lpFormat = X11DRV_CLIPBOARD_LookupFormat(wFormat); LPWINE_CLIPFORMAT lpFormat = X11DRV_CLIPBOARD_LookupFormat(wFormat);
...@@ -736,14 +732,17 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent * ...@@ -736,14 +732,17 @@ static Atom EVENT_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent *
for (i = 0; i < cTargetPropList; i+=2) for (i = 0; i < cTargetPropList; i+=2)
{ {
char *targetName = TSXGetAtomName(display, targetPropList[i]);
char *propName = TSXGetAtomName(display, targetPropList[i+1]);
XSelectionRequestEvent event; XSelectionRequestEvent event;
TRACE("MULTIPLE(%d): Target='%s' Prop='%s'\n", if (TRACE_ON(event))
i/2, targetName, propName); {
TSXFree(targetName); char *targetName = TSXGetAtomName(display, targetPropList[i]);
TSXFree(propName); char *propName = TSXGetAtomName(display, targetPropList[i+1]);
TRACE("MULTIPLE(%d): Target='%s' Prop='%s'\n",
i/2, targetName, propName);
TSXFree(targetName);
TSXFree(propName);
}
/* We must have a non "None" property to service a MULTIPLE target atom */ /* We must have a non "None" property to service a MULTIPLE target atom */
if ( !targetPropList[i+1] ) if ( !targetPropList[i+1] )
...@@ -798,7 +797,7 @@ static void EVENT_SelectionRequest( HWND hWnd, XSelectionRequestEvent *event, BO ...@@ -798,7 +797,7 @@ static void EVENT_SelectionRequest( HWND hWnd, XSelectionRequestEvent *event, BO
*/ */
if ( !bIsMultiple ) if ( !bIsMultiple )
{ {
if (((event->selection != XA_PRIMARY) && (event->selection != xaClipboard))) if (((event->selection != XA_PRIMARY) && (event->selection != x11drv_atom(CLIPBOARD))))
goto END; goto END;
} }
...@@ -809,12 +808,12 @@ static void EVENT_SelectionRequest( HWND hWnd, XSelectionRequestEvent *event, BO ...@@ -809,12 +808,12 @@ static void EVENT_SelectionRequest( HWND hWnd, XSelectionRequestEvent *event, BO
if( rprop == None ) if( rprop == None )
rprop = event->target; rprop = event->target;
if(event->target == xaTargets) /* Return a list of all supported targets */ if(event->target == x11drv_atom(TARGETS)) /* Return a list of all supported targets */
{ {
/* TARGETS selection request */ /* TARGETS selection request */
rprop = EVENT_SelectionRequest_TARGETS( display, request, event->target, rprop ); rprop = EVENT_SelectionRequest_TARGETS( display, request, event->target, rprop );
} }
else if(event->target == xaMultiple) /* rprop contains a list of (target, property) atom pairs */ else if(event->target == x11drv_atom(MULTIPLE)) /* rprop contains a list of (target, property) atom pairs */
{ {
/* MULTIPLE selection request */ /* MULTIPLE selection request */
rprop = EVENT_SelectionRequest_MULTIPLE( hWnd, event ); rprop = EVENT_SelectionRequest_MULTIPLE( hWnd, event );
...@@ -884,7 +883,7 @@ END: ...@@ -884,7 +883,7 @@ END:
*/ */
static void EVENT_SelectionClear( HWND hWnd, XSelectionClearEvent *event ) static void EVENT_SelectionClear( HWND hWnd, XSelectionClearEvent *event )
{ {
if (event->selection == XA_PRIMARY || event->selection == xaClipboard) if (event->selection == XA_PRIMARY || event->selection == x11drv_atom(CLIPBOARD))
X11DRV_CLIPBOARD_ReleaseSelection( event->selection, event->window, hWnd ); X11DRV_CLIPBOARD_ReleaseSelection( event->selection, event->window, hWnd );
} }
...@@ -1029,7 +1028,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1029,7 +1028,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
if (!bAccept) return; if (!bAccept) return;
TSXGetWindowProperty( event->display, DefaultRootWindow(event->display), TSXGetWindowProperty( event->display, DefaultRootWindow(event->display),
dndSelection, 0, 65535, FALSE, x11drv_atom(DndSelection), 0, 65535, FALSE,
AnyPropertyType, &u.atom_aux, (int *) &u.pt_aux.y, AnyPropertyType, &u.atom_aux, (int *) &u.pt_aux.y,
&data_length, &aux_long, &p_data); &data_length, &aux_long, &p_data);
...@@ -1118,7 +1117,7 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1118,7 +1117,7 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return; if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return;
TSXGetWindowProperty( event->display, DefaultRootWindow(event->display), TSXGetWindowProperty( event->display, DefaultRootWindow(event->display),
dndSelection, 0, 65535, FALSE, x11drv_atom(DndSelection), 0, 65535, FALSE,
AnyPropertyType, &u.atom_aux, &u.i, AnyPropertyType, &u.atom_aux, &u.i,
&data_length, &aux_long, &p_data); &data_length, &aux_long, &p_data);
if (aux_long) if (aux_long)
...@@ -1208,9 +1207,9 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1208,9 +1207,9 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
static void EVENT_ClientMessage( HWND hWnd, XClientMessageEvent *event ) static void EVENT_ClientMessage( HWND hWnd, XClientMessageEvent *event )
{ {
if (event->message_type != None && event->format == 32) { if (event->message_type != None && event->format == 32) {
if (event->message_type == wmProtocols) if (event->message_type == x11drv_atom(WM_PROTOCOLS))
handle_wm_protocols_message( hWnd, event ); handle_wm_protocols_message( hWnd, event );
else if (event->message_type == dndProtocol) else if (event->message_type == x11drv_atom(DndProtocol))
{ {
/* query window (drag&drop event contains only drag window) */ /* query window (drag&drop event contains only drag window) */
Window root, child; Window root, child;
......
...@@ -56,17 +56,35 @@ extern Pixmap X11DRV_BITMAP_Pixmap( HBITMAP ); ...@@ -56,17 +56,35 @@ extern Pixmap X11DRV_BITMAP_Pixmap( HBITMAP );
/* X context to associate a hwnd to an X window */ /* X context to associate a hwnd to an X window */
XContext winContext = 0; XContext winContext = 0;
Atom wmProtocols = None; Atom X11DRV_Atoms[NB_XATOMS - FIRST_XATOM];
Atom wmDeleteWindow = None;
Atom wmTakeFocus = None; static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
Atom dndProtocol = None; {
Atom dndSelection = None; "CLIPBOARD",
Atom wmChangeState = None; "COMPOUND_TEXT",
Atom mwmHints = None; "MULTIPLE",
Atom kwmDockWindow = None; "SELECTION_DATA",
Atom netwmPid = None; "TARGETS",
Atom netwmPing = None; "TEXT",
Atom _kde_net_wm_system_tray_window_for = None; /* KDE 2 Final */ "UTF8_STRING",
"RAW_ASCENT",
"RAW_DESCENT",
"RAW_CAP_HEIGHT",
"WM_PROTOCOLS",
"WM_DELETE_WINDOW",
"WM_TAKE_FOCUS",
"KWM_DOCKWINDOW",
"DndProtocol",
"DndSelection",
"_MOTIF_WM_HINTS",
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR",
"_NET_WM_PID",
"_NET_WM_PING",
"_NET_WM_NAME",
"image/gif",
"text/rtf",
"text/richtext"
};
static LPCSTR whole_window_atom; static LPCSTR whole_window_atom;
static LPCSTR client_window_atom; static LPCSTR client_window_atom;
...@@ -336,17 +354,19 @@ void X11DRV_set_wm_hints( Display *display, WND *win ) ...@@ -336,17 +354,19 @@ void X11DRV_set_wm_hints( Display *display, WND *win )
Window group_leader; Window group_leader;
XClassHint *class_hints; XClassHint *class_hints;
XWMHints* wm_hints; XWMHints* wm_hints;
Atom protocols[2]; Atom protocols[3];
MwmHints mwm_hints;
int i; int i;
wine_tsx11_lock(); wine_tsx11_lock();
/* wm protocols */ /* wm protocols */
i = 0; i = 0;
protocols[i++] = wmDeleteWindow; protocols[i++] = x11drv_atom(WM_DELETE_WINDOW);
if (wmTakeFocus) protocols[i++] = wmTakeFocus; protocols[i++] = x11drv_atom(_NET_WM_PING);
if (netwmPing) protocols[i++] = netwmPing; if (use_take_focus) protocols[i++] = x11drv_atom(WM_TAKE_FOCUS);
XSetWMProtocols( display, data->whole_window, protocols, i ); XChangeProperty( display, data->whole_window, x11drv_atom(WM_PROTOCOLS),
XA_ATOM, 32, PropModeReplace, (char *)protocols, i );
/* class hints */ /* class hints */
if ((class_hints = XAllocClassHint())) if ((class_hints = XAllocClassHint()))
...@@ -373,44 +393,40 @@ void X11DRV_set_wm_hints( Display *display, WND *win ) ...@@ -373,44 +393,40 @@ void X11DRV_set_wm_hints( Display *display, WND *win )
if (win->dwExStyle & WS_EX_TRAYWINDOW) if (win->dwExStyle & WS_EX_TRAYWINDOW)
{ {
int val = 1; int val = 1;
if (kwmDockWindow != None) XChangeProperty( display, data->whole_window, x11drv_atom(KWM_DOCKWINDOW),
XChangeProperty( display, data->whole_window, kwmDockWindow, kwmDockWindow, x11drv_atom(KWM_DOCKWINDOW), 32, PropModeReplace, (char*)&val, 1 );
32, PropModeReplace, (char*)&val, 1 ); XChangeProperty( display, data->whole_window, x11drv_atom(_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR),
if (_kde_net_wm_system_tray_window_for != None) XA_WINDOW, 32, PropModeReplace, (char*)&data->whole_window, 1 );
XChangeProperty( display, data->whole_window, _kde_net_wm_system_tray_window_for,
XA_WINDOW, 32, PropModeReplace, (char*)&data->whole_window, 1 );
} }
/* set the WM_CLIENT_MACHINE and WM_LOCALE_NAME properties */ /* set the WM_CLIENT_MACHINE and WM_LOCALE_NAME properties */
XSetWMProperties(display, data->whole_window, NULL, NULL, NULL, 0, NULL, NULL, NULL); XSetWMProperties(display, data->whole_window, NULL, NULL, NULL, 0, NULL, NULL, NULL);
/* set the pid. together, these properties are needed so the window manager can kill us if we freeze */ /* set the pid. together, these properties are needed so the window manager can kill us if we freeze */
i = getpid(); i = getpid();
XChangeProperty(display, data->whole_window, netwmPid, XA_CARDINAL, 32, PropModeReplace, (char *)&i, 1); XChangeProperty(display, data->whole_window, x11drv_atom(_NET_WM_PID),
XA_CARDINAL, 32, PropModeReplace, (char *)&i, 1);
if (mwmHints != None)
{ mwm_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
MwmHints mwm_hints; mwm_hints.functions = 0;
mwm_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; if ((win->dwStyle & WS_CAPTION) == WS_CAPTION) mwm_hints.functions |= MWM_FUNC_MOVE;
mwm_hints.functions = 0; if (win->dwStyle & WS_THICKFRAME) mwm_hints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE;
if ((win->dwStyle & WS_CAPTION) == WS_CAPTION) mwm_hints.functions |= MWM_FUNC_MOVE; if (win->dwStyle & WS_MINIMIZEBOX) mwm_hints.functions |= MWM_FUNC_MINIMIZE;
if (win->dwStyle & WS_THICKFRAME) mwm_hints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; if (win->dwStyle & WS_MAXIMIZEBOX) mwm_hints.functions |= MWM_FUNC_MAXIMIZE;
if (win->dwStyle & WS_MINIMIZEBOX) mwm_hints.functions |= MWM_FUNC_MINIMIZE; if (win->dwStyle & WS_SYSMENU) mwm_hints.functions |= MWM_FUNC_CLOSE;
if (win->dwStyle & WS_MAXIMIZEBOX) mwm_hints.functions |= MWM_FUNC_MAXIMIZE; mwm_hints.decorations = 0;
if (win->dwStyle & WS_SYSMENU) mwm_hints.functions |= MWM_FUNC_CLOSE; if ((win->dwStyle & WS_CAPTION) == WS_CAPTION) mwm_hints.decorations |= MWM_DECOR_TITLE;
mwm_hints.decorations = 0; if (win->dwExStyle & WS_EX_DLGMODALFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER;
if ((win->dwStyle & WS_CAPTION) == WS_CAPTION) mwm_hints.decorations |= MWM_DECOR_TITLE; else if (win->dwStyle & WS_THICKFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER | MWM_DECOR_RESIZEH;
if (win->dwExStyle & WS_EX_DLGMODALFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER; else if ((win->dwStyle & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER;
else if (win->dwStyle & WS_THICKFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER | MWM_DECOR_RESIZEH; else if (win->dwStyle & WS_BORDER) mwm_hints.decorations |= MWM_DECOR_BORDER;
else if ((win->dwStyle & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER; else if (!(win->dwStyle & (WS_CHILD|WS_POPUP))) mwm_hints.decorations |= MWM_DECOR_BORDER;
else if (win->dwStyle & WS_BORDER) mwm_hints.decorations |= MWM_DECOR_BORDER; if (win->dwStyle & WS_SYSMENU) mwm_hints.decorations |= MWM_DECOR_MENU;
else if (!(win->dwStyle & (WS_CHILD|WS_POPUP))) mwm_hints.decorations |= MWM_DECOR_BORDER; if (win->dwStyle & WS_MINIMIZEBOX) mwm_hints.decorations |= MWM_DECOR_MINIMIZE;
if (win->dwStyle & WS_SYSMENU) mwm_hints.decorations |= MWM_DECOR_MENU; if (win->dwStyle & WS_MAXIMIZEBOX) mwm_hints.decorations |= MWM_DECOR_MAXIMIZE;
if (win->dwStyle & WS_MINIMIZEBOX) mwm_hints.decorations |= MWM_DECOR_MINIMIZE;
if (win->dwStyle & WS_MAXIMIZEBOX) mwm_hints.decorations |= MWM_DECOR_MAXIMIZE; XChangeProperty( display, data->whole_window, x11drv_atom(_MOTIF_WM_HINTS),
x11drv_atom(_MOTIF_WM_HINTS), 32, PropModeReplace,
XChangeProperty( display, data->whole_window, mwmHints, mwmHints, 32, (char*)&mwm_hints, sizeof(mwm_hints)/sizeof(long) );
PropModeReplace, (char*)&mwm_hints, sizeof(mwm_hints)/sizeof(long) );
}
wm_hints = XAllocWMHints(); wm_hints = XAllocWMHints();
wine_tsx11_unlock(); wine_tsx11_unlock();
...@@ -674,18 +690,8 @@ static void create_desktop( Display *display, WND *wndPtr ) ...@@ -674,18 +690,8 @@ static void create_desktop( Display *display, WND *wndPtr )
X11DRV_WND_DATA *data = wndPtr->pDriverData; X11DRV_WND_DATA *data = wndPtr->pDriverData;
wine_tsx11_lock(); wine_tsx11_lock();
winContext = XUniqueContext(); winContext = XUniqueContext();
wmProtocols = XInternAtom( display, "WM_PROTOCOLS", False ); XInternAtoms( display, (char **)atom_names, NB_XATOMS - FIRST_XATOM, False, X11DRV_Atoms );
wmDeleteWindow = XInternAtom( display, "WM_DELETE_WINDOW", False );
if (use_take_focus) wmTakeFocus = XInternAtom( display, "WM_TAKE_FOCUS", False );
dndProtocol = XInternAtom( display, "DndProtocol" , False );
dndSelection = XInternAtom( display, "DndSelection" , False );
wmChangeState = XInternAtom( display, "WM_CHANGE_STATE", False );
mwmHints = XInternAtom( display, _XA_MWM_HINTS, False );
kwmDockWindow = XInternAtom( display, "KWM_DOCKWINDOW", False );
_kde_net_wm_system_tray_window_for = XInternAtom( display, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False );
netwmPid = XInternAtom( display, "_NET_WM_PID", False );
netwmPing = XInternAtom( display, "_NET_WM_PING", False );
wine_tsx11_unlock(); wine_tsx11_unlock();
whole_window_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_whole_window" )); whole_window_atom = MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_whole_window" ));
...@@ -699,6 +705,8 @@ static void create_desktop( Display *display, WND *wndPtr ) ...@@ -699,6 +705,8 @@ static void create_desktop( Display *display, WND *wndPtr )
SetPropA( wndPtr->hwndSelf, client_window_atom, (HANDLE)root_window ); SetPropA( wndPtr->hwndSelf, client_window_atom, (HANDLE)root_window );
SetPropA( wndPtr->hwndSelf, "__wine_x11_visual_id", (HANDLE)XVisualIDFromVisual(visual) ); SetPropA( wndPtr->hwndSelf, "__wine_x11_visual_id", (HANDLE)XVisualIDFromVisual(visual) );
X11DRV_InitClipboard( display );
if (root_window != DefaultRootWindow(display)) X11DRV_create_desktop_thread(); if (root_window != DefaultRootWindow(display)) X11DRV_create_desktop_thread();
} }
...@@ -849,11 +857,8 @@ BOOL X11DRV_SetWindowText( HWND hwnd, LPCWSTR text ) ...@@ -849,11 +857,8 @@ BOOL X11DRV_SetWindowText( HWND hwnd, LPCWSTR text )
according to the standard according to the standard
( http://www.pps.jussieu.fr/~jch/software/UTF8_STRING/UTF8_STRING.text ). ( http://www.pps.jussieu.fr/~jch/software/UTF8_STRING/UTF8_STRING.text ).
*/ */
XChangeProperty( display, win, XChangeProperty( display, win, x11drv_atom(_NET_WM_NAME), x11drv_atom(UTF8_STRING),
XInternAtom(display, "_NET_WM_NAME", False), 8, PropModeReplace, (unsigned char *) utf8_buffer, count);
XInternAtom(display, "UTF8_STRING", False),
8, PropModeReplace, (unsigned char *) utf8_buffer,
count);
wine_tsx11_unlock(); wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, utf8_buffer ); HeapFree( GetProcessHeap(), 0, utf8_buffer );
......
...@@ -364,30 +364,43 @@ extern int use_xkb; ...@@ -364,30 +364,43 @@ extern int use_xkb;
extern int use_take_focus; extern int use_take_focus;
extern int managed_mode; extern int managed_mode;
extern Atom wmProtocols; /* atoms */
extern Atom wmDeleteWindow;
extern Atom wmTakeFocus;
extern Atom dndProtocol;
extern Atom dndSelection;
extern Atom wmChangeState;
extern Atom kwmDockWindow;
extern Atom _kde_net_wm_system_tray_window_for;
/* X11 clipboard driver */ enum x11drv_atoms
typedef struct tagPROPERTYFORMATMAP
{ {
LPCSTR lpszProperty; FIRST_XATOM = XA_LAST_PREDEFINED + 1,
LPCSTR lpszFormat; XATOM_CLIPBOARD = FIRST_XATOM,
} PROPERTYFORMATMAP; XATOM_COMPOUND_TEXT,
XATOM_MULTIPLE,
XATOM_SELECTION_DATA,
XATOM_TARGETS,
XATOM_TEXT,
XATOM_UTF8_STRING,
XATOM_RAW_ASCENT,
XATOM_RAW_DESCENT,
XATOM_RAW_CAP_HEIGHT,
XATOM_WM_PROTOCOLS,
XATOM_WM_DELETE_WINDOW,
XATOM_WM_TAKE_FOCUS,
XATOM_KWM_DOCKWINDOW,
XATOM_DndProtocol,
XATOM_DndSelection,
XATOM__MOTIF_WM_HINTS,
XATOM__KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR,
XATOM__NET_WM_PID,
XATOM__NET_WM_PING,
XATOM__NET_WM_NAME,
XATOM_image_gif,
XATOM_text_rtf,
XATOM_text_richtext,
NB_XATOMS
};
typedef struct tagPROPERTYALIASMAP extern Atom X11DRV_Atoms[NB_XATOMS - FIRST_XATOM];
{
LPCSTR lpszProperty; #define x11drv_atom(name) (X11DRV_Atoms[XATOM_##name - FIRST_XATOM])
UINT drvDataProperty;
LPCSTR lpszAlias; /* X11 clipboard driver */
UINT drvDataAlias;
} PROPERTYALIASMAP;
typedef struct tagWINE_CLIPDATA { typedef struct tagWINE_CLIPDATA {
UINT wFormatID; UINT wFormatID;
...@@ -416,11 +429,7 @@ typedef struct tagWINE_CLIPFORMAT { ...@@ -416,11 +429,7 @@ typedef struct tagWINE_CLIPFORMAT {
#define CF_FLAG_BUILTINFMT 1 /* Built-in windows format */ #define CF_FLAG_BUILTINFMT 1 /* Built-in windows format */
#define CF_FLAG_SYNTHESIZED 8 /* Implicitly converted data */ #define CF_FLAG_SYNTHESIZED 8 /* Implicitly converted data */
extern Atom xaClipboard; extern void X11DRV_InitClipboard(Display *display);
extern Atom xaTargets;
extern Atom xaMultiple;
extern BOOL X11DRV_InitClipboard(Display *display);
extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType, Window w, HWND hwnd); extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType, Window w, HWND hwnd);
extern INT X11DRV_CountClipboardFormats(void); extern INT X11DRV_CountClipboardFormats(void);
extern UINT X11DRV_EnumClipboardFormats(UINT wFormat); extern UINT X11DRV_EnumClipboardFormats(UINT wFormat);
......
...@@ -379,13 +379,6 @@ static void process_attach(void) ...@@ -379,13 +379,6 @@ static void process_attach(void)
ExitProcess(1); ExitProcess(1);
} }
/* Initialize clipboard */
if (!X11DRV_InitClipboard( display ))
{
ERR( "Couldn't Initialize clipboard.\n" );
ExitProcess(1);
}
#ifdef HAVE_LIBXXF86VM #ifdef HAVE_LIBXXF86VM
/* initialize XVidMode */ /* initialize XVidMode */
X11DRV_XF86VM_Init(); X11DRV_XF86VM_Init();
......
...@@ -342,9 +342,6 @@ static int fontLF = -1, fontMRU = -1; /* last free, most recently used */ ...@@ -342,9 +342,6 @@ static int fontLF = -1, fontMRU = -1; /* last free, most recently used */
#define CHECK_PFONT(pFont) ( (((UINT)(pFont) & 0xFFFF0000) == X_PFONT_MAGIC) &&\ #define CHECK_PFONT(pFont) ( (((UINT)(pFont) & 0xFFFF0000) == X_PFONT_MAGIC) &&\
(((UINT)(pFont) & 0x0000FFFF) < fontCacheSize) ) (((UINT)(pFont) & 0x0000FFFF) < fontCacheSize) )
static Atom RAW_ASCENT;
static Atom RAW_DESCENT;
/*********************************************************************** /***********************************************************************
* Helper macros from X distribution * Helper macros from X distribution
*/ */
...@@ -1067,8 +1064,7 @@ static void XFONT_GetLeading( const LPIFONTINFO16 pFI, const XFontStruct* x_fs, ...@@ -1067,8 +1064,7 @@ static void XFONT_GetLeading( const LPIFONTINFO16 pFI, const XFontStruct* x_fs,
if( pEL ) *pEL = 0; if( pEL ) *pEL = 0;
if(XFT) { if(XFT) {
Atom RAW_CAP_HEIGHT = TSXInternAtom(gdi_display, "RAW_CAP_HEIGHT", TRUE); if(TSXGetFontProperty((XFontStruct*)x_fs, x11drv_atom(RAW_CAP_HEIGHT), &height))
if(TSXGetFontProperty((XFontStruct*)x_fs, RAW_CAP_HEIGHT, &height))
*pIL = XFT->ascent - *pIL = XFT->ascent -
(INT)(XFT->pixelsize / 1000.0 * height); (INT)(XFT->pixelsize / 1000.0 * height);
else else
...@@ -2032,13 +2028,10 @@ static int XLoadQueryFont_ErrorHandler(Display *dpy, XErrorEvent *event, void *a ...@@ -2032,13 +2028,10 @@ static int XLoadQueryFont_ErrorHandler(Display *dpy, XErrorEvent *event, void *a
static XFontStruct *safe_XLoadQueryFont(Display *display, char *name) static XFontStruct *safe_XLoadQueryFont(Display *display, char *name)
{ {
XFontStruct *ret; XFontStruct *ret;
wine_tsx11_lock();
X11DRV_expect_error(display, XLoadQueryFont_ErrorHandler, NULL); X11DRV_expect_error(display, XLoadQueryFont_ErrorHandler, NULL);
ret = XLoadQueryFont(display, name); ret = XLoadQueryFont(display, name);
if (X11DRV_check_error()) ret = NULL; if (X11DRV_check_error()) ret = NULL;
wine_tsx11_unlock();
return ret; return ret;
} }
...@@ -3020,12 +3013,6 @@ void X11DRV_FONT_InitX11Metrics( void ) ...@@ -3020,12 +3013,6 @@ void X11DRV_FONT_InitX11Metrics( void )
XFONT_GrowFreeList(0, fontCacheSize - 1); XFONT_GrowFreeList(0, fontCacheSize - 1);
TRACE("done!\n"); TRACE("done!\n");
/* update text caps parameter */
RAW_ASCENT = TSXInternAtom(gdi_display, "RAW_ASCENT", TRUE);
RAW_DESCENT = TSXInternAtom(gdi_display, "RAW_DESCENT", TRUE);
return;
} }
/*********************************************************************** /***********************************************************************
...@@ -3071,8 +3058,8 @@ static BOOL XFONT_SetX11Trans( fontObject *pfo ) ...@@ -3071,8 +3058,8 @@ static BOOL XFONT_SetX11Trans( fontObject *pfo )
TSXFree(fontName); TSXFree(fontName);
HeapFree(GetProcessHeap(), 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
TSXGetFontProperty( pfo->fs, RAW_ASCENT, &PX->RAW_ASCENT ); TSXGetFontProperty( pfo->fs, x11drv_atom(RAW_ASCENT), &PX->RAW_ASCENT );
TSXGetFontProperty( pfo->fs, RAW_DESCENT, &PX->RAW_DESCENT ); TSXGetFontProperty( pfo->fs, x11drv_atom(RAW_DESCENT), &PX->RAW_DESCENT );
PX->pixelsize = hypot(PX->a, PX->b); PX->pixelsize = hypot(PX->a, PX->b);
PX->ascent = PX->pixelsize / 1000.0 * PX->RAW_ASCENT; PX->ascent = PX->pixelsize / 1000.0 * PX->RAW_ASCENT;
......
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