From bbb8c60c7effcf1a1bab3256bf7b718dc082e0f3 Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Mon, 7 Jan 2013 14:43:21 -0600 Subject: [PATCH] winemac: Implement CreateDesktopWindow(). --- dlls/winemac.drv/Makefile.in | 3 +- dlls/winemac.drv/gdi.c | 2 +- dlls/winemac.drv/macdrv.h | 9 +++- dlls/winemac.drv/window.c | 73 +++++++++++++++++++++++++++++++ dlls/winemac.drv/winemac.drv.spec | 1 + 5 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 dlls/winemac.drv/window.c diff --git a/dlls/winemac.drv/Makefile.in b/dlls/winemac.drv/Makefile.in index 08a544099a7..2082b3733c0 100644 --- a/dlls/winemac.drv/Makefile.in +++ b/dlls/winemac.drv/Makefile.in @@ -5,7 +5,8 @@ EXTRALIBS = -framework AppKit C_SRCS = \ display.c \ gdi.c \ - macdrv_main.c + macdrv_main.c \ + window.c OBJC_SRCS = \ cocoa_display.m diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c index 176b5883787..333cb0cc400 100644 --- a/dlls/winemac.drv/gdi.c +++ b/dlls/winemac.drv/gdi.c @@ -99,7 +99,7 @@ static DWORD get_dpi(void) * * Returns the rectangle encompassing all the screens. */ -static CGRect macdrv_get_desktop_rect(void) +CGRect macdrv_get_desktop_rect(void) { CGRect ret; CGDirectDisplayID displayIDs[32]; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 6b52ff1edc3..2382809232e 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -3,7 +3,7 @@ * * Copyright 1996 Alexandre Julliard * Copyright 1999 Patrik Stridvall - * Copyright 2011, 2012 Ken Thomases for CodeWeavers Inc. + * Copyright 2011, 2012, 2013 Ken Thomases for CodeWeavers Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -63,4 +63,11 @@ static inline RECT rect_from_cgrect(CGRect cgrect) } +/************************************************************************** + * Mac GDI driver + */ + +extern CGRect macdrv_get_desktop_rect(void) DECLSPEC_HIDDEN; + + #endif /* __WINE_MACDRV_H */ diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c new file mode 100644 index 00000000000..a3747426404 --- /dev/null +++ b/dlls/winemac.drv/window.c @@ -0,0 +1,73 @@ +/* + * MACDRV windowing driver + * + * Copyright 1993, 1994, 1995, 1996, 2001 Alexandre Julliard + * Copyright 1993 David Metcalfe + * Copyright 1995, 1996 Alex Korobka + * Copyright 2011, 2012, 2013 Ken Thomases for CodeWeavers Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include "macdrv.h" +#include "winuser.h" +#include "wine/server.h" + +WINE_DEFAULT_DEBUG_CHANNEL(macdrv); + + +/********************************************************************** + * CreateDesktopWindow (MACDRV.@) + */ +BOOL CDECL macdrv_CreateDesktopWindow(HWND hwnd) +{ + unsigned int width, height; + + TRACE("%p\n", hwnd); + + /* retrieve the real size of the desktop */ + SERVER_START_REQ(get_window_rectangles) + { + req->handle = wine_server_user_handle(hwnd); + req->relative = COORDS_CLIENT; + wine_server_call(req); + width = reply->window.right; + height = reply->window.bottom; + } + SERVER_END_REQ; + + if (!width && !height) /* not initialized yet */ + { + CGRect rect = macdrv_get_desktop_rect(); + + SERVER_START_REQ(set_window_pos) + { + req->handle = wine_server_user_handle(hwnd); + req->previous = 0; + req->swp_flags = SWP_NOZORDER; + req->window.left = CGRectGetMinX(rect); + req->window.top = CGRectGetMinY(rect); + req->window.right = CGRectGetMaxX(rect); + req->window.bottom = CGRectGetMaxY(rect); + req->client = req->window; + wine_server_call(req); + } + SERVER_END_REQ; + } + + return TRUE; +} diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index 03fa490bb0f..7bea2e8cac9 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -4,5 +4,6 @@ # USER driver +@ cdecl CreateDesktopWindow(long) macdrv_CreateDesktopWindow @ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors @ cdecl GetMonitorInfo(long ptr) macdrv_GetMonitorInfo