Commit 12869e46 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11.drv: Use nameless unions/structs.

parent bb9030cb
......@@ -27,9 +27,6 @@
#include <X11/cursorfont.h>
#include <X11/Xlib.h>
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include "x11drv.h"
/* avoid conflict with field names in included win32 headers */
......
......@@ -40,8 +40,6 @@
#include <stdarg.h>
#include <string.h>
#define NONAMELESSUNION
#include "x11drv.h"
#include "wingdi.h"
......@@ -1127,12 +1125,12 @@ static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, UINT fl
TRACE_(key)( "hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags );
input.type = INPUT_KEYBOARD;
input.u.ki.wVk = vkey;
input.u.ki.wScan = scan;
input.u.ki.dwFlags = flags;
input.u.ki.time = time;
input.u.ki.dwExtraInfo = 0;
input.type = INPUT_KEYBOARD;
input.ki.wVk = vkey;
input.ki.wScan = scan;
input.ki.dwFlags = flags;
input.ki.time = time;
input.ki.dwExtraInfo = 0;
__wine_send_input( hwnd, &input, NULL );
}
......
......@@ -48,7 +48,6 @@ MAKE_FUNCPTR(XcursorLibraryLoadCursor);
# undef MAKE_FUNCPTR
#endif /* SONAME_LIBXCURSOR */
#define NONAMELESSUNION
#define OEMRESOURCE
#include "x11drv.h"
......@@ -476,7 +475,7 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x
{
struct x11drv_thread_data *thread_data;
struct x11drv_win_data *data;
POINT pt = { input->u.mi.dx, input->u.mi.dy };
POINT pt = { input->mi.dx, input->mi.dy };
TRACE( "hwnd %p, window %lx, event_root %lx, x_root %d, y_root %d, input %p\n", hwnd, window, event_root,
x_root, y_root, input );
......@@ -508,10 +507,10 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x
release_win_data( data );
}
TRACE( "mapped %s to %s\n", wine_dbgstr_point( (POINT *)&input->u.mi.dx ), wine_dbgstr_point( &pt ) );
TRACE( "mapped %s to %s\n", wine_dbgstr_point( (POINT *)&input->mi.dx ), wine_dbgstr_point( &pt ) );
input->u.mi.dx = pt.x;
input->u.mi.dy = pt.y;
input->mi.dx = pt.x;
input->mi.dy = pt.y;
}
/***********************************************************************
......@@ -542,7 +541,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
/* ignore event if a button is pressed, since the mouse is then grabbed too */
!(state & (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask|Button6Mask|Button7Mask)))
{
RECT rect = { input->u.mi.dx, input->u.mi.dy, input->u.mi.dx + 1, input->u.mi.dy + 1 };
RECT rect = { input->mi.dx, input->mi.dy, input->mi.dx + 1, input->mi.dy + 1 };
SERVER_START_REQ( update_window_zorder )
{
......@@ -1493,12 +1492,12 @@ void move_resize_window( HWND hwnd, int dir )
/* fake a button release event */
pos = root_to_virtual_screen( x, y );
input.type = INPUT_MOUSE;
input.u.mi.dx = pos.x;
input.u.mi.dy = pos.y;
input.u.mi.mouseData = button_up_data[button - 1];
input.u.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.u.mi.time = NtGetTickCount();
input.u.mi.dwExtraInfo = 0;
input.mi.dx = pos.x;
input.mi.dy = pos.y;
input.mi.mouseData = button_up_data[button - 1];
input.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.mi.time = NtGetTickCount();
input.mi.dwExtraInfo = 0;
__wine_send_input( hwnd, &input, NULL );
}
......@@ -1533,12 +1532,12 @@ BOOL X11DRV_ButtonPress( HWND hwnd, XEvent *xev )
TRACE( "hwnd %p/%lx button %u pos %d,%d\n", hwnd, event->window, buttonNum, event->x, event->y );
input.u.mi.dx = event->x;
input.u.mi.dy = event->y;
input.u.mi.mouseData = button_down_data[buttonNum];
input.u.mi.dwFlags = button_down_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.u.mi.dwExtraInfo = 0;
input.mi.dx = event->x;
input.mi.dy = event->y;
input.mi.mouseData = button_down_data[buttonNum];
input.mi.dwFlags = button_down_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.mi.dwExtraInfo = 0;
update_user_time( event->time );
map_event_coords( hwnd, event->window, event->root, event->x_root, event->y_root, &input );
......@@ -1560,12 +1559,12 @@ BOOL X11DRV_ButtonRelease( HWND hwnd, XEvent *xev )
TRACE( "hwnd %p/%lx button %u pos %d,%d\n", hwnd, event->window, buttonNum, event->x, event->y );
input.u.mi.dx = event->x;
input.u.mi.dy = event->y;
input.u.mi.mouseData = button_up_data[buttonNum];
input.u.mi.dwFlags = button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.u.mi.dwExtraInfo = 0;
input.mi.dx = event->x;
input.mi.dy = event->y;
input.mi.mouseData = button_up_data[buttonNum];
input.mi.dwFlags = button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.mi.dwExtraInfo = 0;
map_event_coords( hwnd, event->window, event->root, event->x_root, event->y_root, &input );
send_mouse_input( hwnd, event->window, event->state, &input );
......@@ -1584,12 +1583,12 @@ BOOL X11DRV_MotionNotify( HWND hwnd, XEvent *xev )
TRACE( "hwnd %p/%lx pos %d,%d is_hint %d serial %lu\n",
hwnd, event->window, event->x, event->y, event->is_hint, event->serial );
input.u.mi.dx = event->x;
input.u.mi.dy = event->y;
input.u.mi.mouseData = 0;
input.u.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.u.mi.dwExtraInfo = 0;
input.mi.dx = event->x;
input.mi.dy = event->y;
input.mi.mouseData = 0;
input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
input.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.mi.dwExtraInfo = 0;
if (!hwnd && is_old_motion_event( event->serial ))
{
......@@ -1615,12 +1614,12 @@ BOOL X11DRV_EnterNotify( HWND hwnd, XEvent *xev )
if (hwnd == x11drv_thread_data()->grab_hwnd) return FALSE;
/* simulate a mouse motion event */
input.u.mi.dx = event->x;
input.u.mi.dy = event->y;
input.u.mi.mouseData = 0;
input.u.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.u.mi.dwExtraInfo = 0;
input.mi.dx = event->x;
input.mi.dy = event->y;
input.mi.mouseData = 0;
input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
input.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.mi.dwExtraInfo = 0;
if (is_old_motion_event( event->serial ))
{
......@@ -1705,16 +1704,16 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
values++;
}
input->u.mi.dx = round( x->value );
input->u.mi.dy = round( y->value );
input->mi.dx = round( x->value );
input->mi.dy = round( y->value );
TRACE( "event %f,%f value %f,%f input %d,%d\n", x_value, y_value, x->value, y->value,
(int)input->u.mi.dx, (int)input->u.mi.dy );
(int)input->mi.dx, (int)input->mi.dy );
x->value -= input->u.mi.dx;
y->value -= input->u.mi.dy;
x->value -= input->mi.dx;
y->value -= input->mi.dy;
if (!input->u.mi.dx && !input->u.mi.dy)
if (!input->mi.dx && !input->mi.dy)
{
TRACE( "accumulating motion\n" );
return FALSE;
......@@ -1738,12 +1737,12 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
}
input.type = INPUT_MOUSE;
input.u.mi.mouseData = 0;
input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.u.mi.dwExtraInfo = 0;
input.u.mi.dx = 0;
input.u.mi.dy = 0;
input.mi.mouseData = 0;
input.mi.dwFlags = MOUSEEVENTF_MOVE;
input.mi.time = EVENT_x11_time_to_win32_time( event->time );
input.mi.dwExtraInfo = 0;
input.mi.dx = 0;
input.mi.dy = 0;
if (!map_raw_event_coords( event, &input )) return FALSE;
__wine_send_input( 0, &input, NULL );
......
......@@ -20,7 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define NONAMELESSUNION
#include "x11drv_dll.h"
#include "commctrl.h"
#include "shellapi.h"
......@@ -675,7 +674,7 @@ static BOOL modify_icon( struct tray_icon *icon, NOTIFYICONDATAW *nid )
lstrcpynW( icon->info_text, nid->szInfo, ARRAY_SIZE( icon->info_text ));
lstrcpynW( icon->info_title, nid->szInfoTitle, ARRAY_SIZE( icon->info_title ));
icon->info_flags = nid->dwInfoFlags;
icon->info_timeout = max(min(nid->u.uTimeout, BALLOON_SHOW_MAX_TIMEOUT), BALLOON_SHOW_MIN_TIMEOUT);
icon->info_timeout = max(min(nid->uTimeout, BALLOON_SHOW_MAX_TIMEOUT), BALLOON_SHOW_MIN_TIMEOUT);
icon->info_icon = nid->hBalloonIcon;
update_balloon( icon );
}
......@@ -758,7 +757,7 @@ int CDECL wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data )
case NIM_SETVERSION:
if ((icon = get_icon( data->hWnd, data->uID )))
{
icon->version = data->u.uVersion;
icon->version = data->uVersion;
ret = TRUE;
}
break;
......
......@@ -20,8 +20,6 @@
*/
#define COBJMACROS
#define NONAMELESSUNION
#include "x11drv_dll.h"
#include "shellapi.h"
#include "shlobj.h"
......@@ -566,11 +564,11 @@ static HRESULT WINAPI XDNDDATAOBJECT_GetData(IDataObject *dataObject,
if (iter->format == formatEtc->cfFormat)
{
pMedium->tymed = TYMED_HGLOBAL;
pMedium->u.hGlobal = GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, iter->size);
if (pMedium->u.hGlobal == NULL)
pMedium->hGlobal = GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, iter->size);
if (pMedium->hGlobal == NULL)
return E_OUTOFMEMORY;
memcpy(GlobalLock(pMedium->u.hGlobal), iter->data, iter->size);
GlobalUnlock(pMedium->u.hGlobal);
memcpy(GlobalLock(pMedium->hGlobal), iter->data, iter->size);
GlobalUnlock(pMedium->hGlobal);
pMedium->pUnkForRelease = 0;
return S_OK;
}
......
......@@ -26,8 +26,6 @@
#include "config.h"
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include <assert.h>
#include <X11/Xlib.h>
#ifdef HAVE_X11_EXTENSIONS_XRANDR_H
......@@ -165,11 +163,11 @@ static void add_xrandr10_mode( DEVMODEW *mode, DWORD depth, DWORD width, DWORD h
mode->dmFields |= DM_DISPLAYFREQUENCY;
mode->dmDisplayFrequency = frequency;
}
mode->u1.s2.dmDisplayOrientation = DMDO_DEFAULT;
mode->dmDisplayOrientation = DMDO_DEFAULT;
mode->dmBitsPerPel = depth;
mode->dmPelsWidth = width;
mode->dmPelsHeight = height;
mode->u2.dmDisplayFlags = 0;
mode->dmDisplayFlags = 0;
memcpy( (BYTE *)mode + sizeof(*mode), &size_id, sizeof(size_id) );
}
......@@ -246,10 +244,10 @@ static BOOL xrandr10_get_current_mode( x11drv_settings_id id, DEVMODEW *mode )
mode->dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT |
DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY | DM_POSITION;
mode->u1.s2.dmDisplayOrientation = DMDO_DEFAULT;
mode->u2.dmDisplayFlags = 0;
mode->u1.s2.dmPosition.x = 0;
mode->u1.s2.dmPosition.y = 0;
mode->dmDisplayOrientation = DMDO_DEFAULT;
mode->dmDisplayFlags = 0;
mode->dmPosition.x = 0;
mode->dmPosition.y = 0;
if (id.id != 1)
{
......@@ -1305,9 +1303,9 @@ static void add_xrandr14_mode( DEVMODEW *mode, XRRModeInfo *info, DWORD depth, D
mode->dmPelsWidth = info->height;
mode->dmPelsHeight = info->width;
}
mode->u1.s2.dmDisplayOrientation = orientation;
mode->dmDisplayOrientation = orientation;
mode->dmBitsPerPel = depth;
mode->u2.dmDisplayFlags = 0;
mode->dmDisplayFlags = 0;
memcpy( (BYTE *)mode + sizeof(*mode), &info->id, sizeof(info->id) );
}
......@@ -1477,14 +1475,14 @@ static BOOL xrandr14_get_current_mode( x11drv_settings_id id, DEVMODEW *mode )
{
mode->dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT |
DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY | DM_POSITION;
mode->u1.s2.dmDisplayOrientation = DMDO_DEFAULT;
mode->dmDisplayOrientation = DMDO_DEFAULT;
mode->dmBitsPerPel = 0;
mode->dmPelsWidth = 0;
mode->dmPelsHeight = 0;
mode->u2.dmDisplayFlags = 0;
mode->dmDisplayFlags = 0;
mode->dmDisplayFrequency = 0;
mode->u1.s2.dmPosition.x = 0;
mode->u1.s2.dmPosition.y = 0;
mode->dmPosition.x = 0;
mode->dmPosition.y = 0;
ret = TRUE;
goto done;
}
......@@ -1504,16 +1502,16 @@ static BOOL xrandr14_get_current_mode( x11drv_settings_id id, DEVMODEW *mode )
mode->dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT |
DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY | DM_POSITION;
mode->u1.s2.dmDisplayOrientation = get_orientation( crtc_info->rotation );
mode->dmDisplayOrientation = get_orientation( crtc_info->rotation );
mode->dmBitsPerPel = screen_bpp;
mode->dmPelsWidth = crtc_info->width;
mode->dmPelsHeight = crtc_info->height;
mode->u2.dmDisplayFlags = 0;
mode->dmDisplayFlags = 0;
mode->dmDisplayFrequency = get_frequency( mode_info );
/* Convert RandR coordinates to virtual screen coordinates */
primary = get_primary_rect( screen_resources );
mode->u1.s2.dmPosition.x = crtc_info->x - primary.left;
mode->u1.s2.dmPosition.y = crtc_info->y - primary.top;
mode->dmPosition.x = crtc_info->x - primary.left;
mode->dmPosition.y = crtc_info->y - primary.top;
ret = TRUE;
done:
......@@ -1612,7 +1610,7 @@ static LONG xrandr14_set_current_mode( x11drv_settings_id id, const DEVMODEW *mo
outputs = &output;
output_count = 1;
}
rotation = get_rotation( mode->u1.s2.dmDisplayOrientation );
rotation = get_rotation( mode->dmDisplayOrientation );
/* According to the RandR spec, the entire CRTC must fit inside the screen.
* Since we use the union of all enabled CRTCs to determine the necessary
......@@ -1624,12 +1622,12 @@ static LONG xrandr14_set_current_mode( x11drv_settings_id id, const DEVMODEW *mo
goto done;
get_screen_size( screen_resources, &screen_width, &screen_height );
screen_width = max( screen_width, mode->u1.s2.dmPosition.x + mode->dmPelsWidth );
screen_height = max( screen_height, mode->u1.s2.dmPosition.y + mode->dmPelsHeight );
screen_width = max( screen_width, mode->dmPosition.x + mode->dmPelsWidth );
screen_height = max( screen_height, mode->dmPosition.y + mode->dmPelsHeight );
set_screen_size( screen_width, screen_height );
status = pXRRSetCrtcConfig( gdi_display, screen_resources, crtc, CurrentTime,
mode->u1.s2.dmPosition.x, mode->u1.s2.dmPosition.y, rrmode,
mode->dmPosition.x, mode->dmPosition.y, rrmode,
rotation, outputs, output_count );
if (status == RRSetConfigSuccess)
ret = DISP_CHANGE_SUCCESSFUL;
......
......@@ -31,9 +31,6 @@
#include <math.h>
#include <dlfcn.h>
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include "x11drv.h"
#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
......@@ -104,11 +101,11 @@ static void add_xf86vm_mode(DEVMODEW *mode, DWORD depth, const XF86VidModeModeIn
mode->dmFields |= DM_DISPLAYFREQUENCY;
mode->dmDisplayFrequency = mode_info->dotclock * 1000 / (mode_info->htotal * mode_info->vtotal);
}
mode->u1.s2.dmDisplayOrientation = DMDO_DEFAULT;
mode->dmDisplayOrientation = DMDO_DEFAULT;
mode->dmBitsPerPel = depth;
mode->dmPelsWidth = mode_info->hdisplay;
mode->dmPelsHeight = mode_info->vdisplay;
mode->u2.dmDisplayFlags = 0;
mode->dmDisplayFlags = 0;
memcpy((BYTE *)mode + sizeof(*mode), &mode_info, sizeof(mode_info));
}
......@@ -177,10 +174,10 @@ static BOOL xf86vm_get_current_mode(x11drv_settings_id id, DEVMODEW *mode)
mode->dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT |
DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY | DM_POSITION;
mode->u1.s2.dmDisplayOrientation = DMDO_DEFAULT;
mode->u2.dmDisplayFlags = 0;
mode->u1.s2.dmPosition.x = 0;
mode->u1.s2.dmPosition.y = 0;
mode->dmDisplayOrientation = DMDO_DEFAULT;
mode->dmDisplayFlags = 0;
mode->dmPosition.x = 0;
mode->dmPosition.y = 0;
if (id.id != 1)
{
......
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