winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2017
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
640 discussions
Start a n
N
ew thread
Henri Verbeet : wined3d: Only warn about 0 compare functions in wined3d_gl_compare_func().
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: 3821dcf996f873a8d18a7e765d332889e12f6ea2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3821dcf996f873a8d18a7e765…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Wed May 31 11:07:02 2017 +0200 wined3d: Only warn about 0 compare functions in wined3d_gl_compare_func(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index bc5b098..950c4d5 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -301,7 +301,10 @@ GLenum wined3d_gl_compare_func(enum wined3d_cmp_func f) case WINED3D_CMP_ALWAYS: return GL_ALWAYS; default: - FIXME("Unrecognized compare function %#x.\n", f); + if (!f) + WARN("Unrecognized compare function %#x.\n", f); + else + FIXME("Unrecognized compare function %#x.\n", f); return GL_NONE; } }
1
0
0
0
Alexandre Julliard : wineandroid: Add an event queue to support handling Java callbacks in the desktop thread.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: 5be4a0e38842d2fa241ca769ce4d50e4eb55c68a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5be4a0e38842d2fa241ca769c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed May 31 11:49:12 2017 +0200 wineandroid: Add an event queue to support handling Java callbacks in the desktop thread. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wineandroid.drv/android.h | 18 ++++ dlls/wineandroid.drv/window.c | 168 ++++++++++++++++++++++++++++++ dlls/wineandroid.drv/wineandroid.drv.spec | 2 + 3 files changed, 188 insertions(+) diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index ab4a431..9fefb11 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -57,6 +57,24 @@ extern void init_monitors( int width, int height ) DECLSPEC_HIDDEN; /* JNI entry points */ extern void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height ) DECLSPEC_HIDDEN; +enum event_type +{ + DESKTOP_CHANGED, +}; + +union event_data +{ + enum event_type type; + struct + { + enum event_type type; + unsigned int width; + unsigned int height; + } desktop; +}; + +int send_event( const union event_data *data ); + extern JavaVM *wine_get_java_vm(void); extern jobject wine_get_java_object(void); diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index e7c83b0..cf35215 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -44,6 +44,7 @@ #include "wine/unicode.h" #include "android.h" +#include "wine/server.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(android); @@ -133,6 +134,35 @@ static void release_win_data( struct android_win_data *data ) } +/* Handling of events coming from the Java side */ + +struct java_event +{ + struct list entry; + union event_data data; +}; + +static struct list event_queue = LIST_INIT( event_queue ); +static struct java_event *current_event; +static int event_pipe[2]; +static DWORD desktop_tid; + +/*********************************************************************** + * send_event + */ +int send_event( const union event_data *data ) +{ + int res; + + if ((res = write( event_pipe[1], data, sizeof(*data) )) != sizeof(*data)) + { + p__android_log_print( ANDROID_LOG_ERROR, "wine", "failed to send event" ); + return -1; + } + return 0; +} + + /*********************************************************************** * desktop_changed * @@ -140,7 +170,145 @@ static void release_win_data( struct android_win_data *data ) */ void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height ) { + union event_data data; + + memset( &data, 0, sizeof(data) ); + data.type = DESKTOP_CHANGED; + data.desktop.width = width; + data.desktop.height = height; p__android_log_print( ANDROID_LOG_INFO, "wine", "desktop_changed: %ux%u", width, height ); + send_event( &data ); +} + + +/*********************************************************************** + * init_event_queue + */ +static void init_event_queue(void) +{ + HANDLE handle; + int ret; + + if (pipe2( event_pipe, O_CLOEXEC | O_NONBLOCK ) == -1) + { + ERR( "could not create data\n" ); + ExitProcess(1); + } + if (wine_server_fd_to_handle( event_pipe[0], GENERIC_READ | SYNCHRONIZE, 0, &handle )) + { + ERR( "Can't allocate handle for event fd\n" ); + ExitProcess(1); + } + SERVER_START_REQ( set_queue_fd ) + { + req->handle = wine_server_obj_handle( handle ); + ret = wine_server_call( req ); + } + SERVER_END_REQ; + if (ret) + { + ERR( "Can't store handle for event fd %x\n", ret ); + ExitProcess(1); + } + CloseHandle( handle ); + desktop_tid = GetCurrentThreadId(); +} + + +/*********************************************************************** + * pull_events + * + * Pull events from the event pipe and add them to the queue + */ +static void pull_events(void) +{ + struct java_event *event; + int res; + + for (;;) + { + if (!(event = HeapAlloc( GetProcessHeap(), 0, sizeof(*event) ))) break; + + res = read( event_pipe[0], &event->data, sizeof(event->data) ); + if (res != sizeof(event->data)) break; + list_add_tail( &event_queue, &event->entry ); + } + HeapFree( GetProcessHeap(), 0, event ); +} + + +/*********************************************************************** + * process_events + */ +static int process_events( DWORD mask ) +{ + struct java_event *event, *next, *previous; + unsigned int count = 0; + + assert( GetCurrentThreadId() == desktop_tid ); + + pull_events(); + + previous = current_event; + + LIST_FOR_EACH_ENTRY_SAFE( event, next, &event_queue, struct java_event, entry ) + { + if (!(mask & QS_SENDMESSAGE)) continue; /* skip it */ + + /* remove it first, in case we process events recursively */ + list_remove( &event->entry ); + current_event = event; + + switch (event->data.type) + { + case DESKTOP_CHANGED: + TRACE( "DESKTOP_CHANGED %ux%u\n", event->data.desktop.width, event->data.desktop.height ); + screen_width = event->data.desktop.width; + screen_height = event->data.desktop.height; + init_monitors( screen_width, screen_height ); + SetWindowPos( GetDesktopWindow(), 0, 0, 0, screen_width, screen_height, + SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW ); + break; + + default: + FIXME( "got event %u\n", event->data.type ); + } + HeapFree( GetProcessHeap(), 0, event ); + count++; + } + current_event = previous; + return count; +} + + +/*********************************************************************** + * ANDROID_MsgWaitForMultipleObjectsEx + */ +DWORD CDECL ANDROID_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, + DWORD timeout, DWORD mask, DWORD flags ) +{ + if (GetCurrentThreadId() == desktop_tid) + { + /* don't process nested events */ + if (current_event) mask = 0; + if (process_events( mask )) return count - 1; + } + return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL, + timeout, flags & MWMO_ALERTABLE ); +} + +/********************************************************************** + * ANDROID_CreateWindow + */ +BOOL CDECL ANDROID_CreateWindow( HWND hwnd ) +{ + TRACE( "%p\n", hwnd ); + + if (hwnd == GetDesktopWindow()) + { + init_event_queue(); + } + return TRUE; } diff --git a/dlls/wineandroid.drv/wineandroid.drv.spec b/dlls/wineandroid.drv/wineandroid.drv.spec index b94c9f8..49402a8 100644 --- a/dlls/wineandroid.drv/wineandroid.drv.spec +++ b/dlls/wineandroid.drv/wineandroid.drv.spec @@ -6,6 +6,8 @@ @ cdecl EnumDisplayMonitors(long ptr ptr long) ANDROID_EnumDisplayMonitors @ cdecl GetMonitorInfo(long ptr) ANDROID_GetMonitorInfo +@ cdecl CreateWindow(long) ANDROID_CreateWindow @ cdecl DestroyWindow(long) ANDROID_DestroyWindow +@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) ANDROID_MsgWaitForMultipleObjectsEx @ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) ANDROID_WindowPosChanging @ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) ANDROID_WindowPosChanged
1
0
0
0
Alexandre Julliard : wineandroid: Register a JNI callback for reporting desktop size changes.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: 77d55905b1ee712d09e0e3ce7d6ddde46bde4cf5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=77d55905b1ee712d09e0e3ce7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed May 31 11:47:49 2017 +0200 wineandroid: Register a JNI callback for reporting desktop size changes. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wineandroid.drv/android.h | 13 ++++++++ dlls/wineandroid.drv/init.c | 68 ++++++++++++++++++++++++++++++++++++++++++ dlls/wineandroid.drv/window.c | 11 +++++++ 3 files changed, 92 insertions(+) diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 7c708f3..ab4a431 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -25,6 +25,7 @@ #include <stdarg.h> #include <stdlib.h> #include <jni.h> +#include <android/log.h> #include "windef.h" #include "winbase.h" @@ -34,6 +35,15 @@ /************************************************************************** + * Android interface + */ + +#define DECL_FUNCPTR(f) extern typeof(f) * p##f DECLSPEC_HIDDEN +DECL_FUNCPTR( __android_log_print ); +#undef DECL_FUNCPTR + + +/************************************************************************** * USER driver */ @@ -44,6 +54,9 @@ extern MONITORINFOEXW default_monitor DECLSPEC_HIDDEN; extern void init_monitors( int width, int height ) DECLSPEC_HIDDEN; +/* JNI entry points */ +extern void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height ) DECLSPEC_HIDDEN; + extern JavaVM *wine_get_java_vm(void); extern jobject wine_get_java_object(void); diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 3a3ce80..406edf9 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -385,3 +385,71 @@ const struct gdi_dc_funcs * CDECL ANDROID_get_gdi_driver( unsigned int version ) } return &android_drv_funcs; } + + +static const JNINativeMethod methods[] = +{ + { "wine_desktop_changed", "(II)V", desktop_changed }, +}; + +#define DECL_FUNCPTR(f) typeof(f) * p##f = NULL +#define LOAD_FUNCPTR(lib, func) do { \ + if ((p##func = wine_dlsym( lib, #func, NULL, 0 )) == NULL) \ + { ERR( "can't find symbol %s\n", #func); return; } \ + } while(0) + +DECL_FUNCPTR( __android_log_print ); + +static void load_android_libs(void) +{ + void *liblog; + char error[1024]; + + if (!(liblog = wine_dlopen( "liblog.so", RTLD_GLOBAL, error, sizeof(error) ))) + { + ERR( "failed to load liblog.so: %s\n", error ); + return; + } + LOAD_FUNCPTR( liblog, __android_log_print ); +} + +#undef DECL_FUNCPTR +#undef LOAD_FUNCPTR + +static BOOL process_attach(void) +{ + jclass class; + jobject object = wine_get_java_object(); + JNIEnv *jni_env; + JavaVM *java_vm; + + if ((java_vm = wine_get_java_vm())) /* running under Java */ + { +#ifdef __i386__ + WORD old_fs = wine_get_fs(); +#endif + load_android_libs(); + (*java_vm)->AttachCurrentThread( java_vm, &jni_env, 0 ); + class = (*jni_env)->GetObjectClass( jni_env, object ); + (*jni_env)->RegisterNatives( jni_env, class, methods, sizeof(methods)/sizeof(methods[0]) ); + (*jni_env)->DeleteLocalRef( jni_env, class ); +#ifdef __i386__ + wine_set_fs( old_fs ); /* the Java VM hijacks %fs for its own purposes, restore it */ +#endif + } + return TRUE; +} + +/*********************************************************************** + * dll initialisation routine + */ +BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls( inst ); + return process_attach(); + } + return TRUE; +} diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index f874458..e7c83b0 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -134,6 +134,17 @@ static void release_win_data( struct android_win_data *data ) /*********************************************************************** + * desktop_changed + * + * JNI callback, runs in the context of the Java thread. + */ +void desktop_changed( JNIEnv *env, jobject obj, jint width, jint height ) +{ + p__android_log_print( ANDROID_LOG_INFO, "wine", "desktop_changed: %ux%u", width, height ); +} + + +/*********************************************************************** * ANDROID_DestroyWindow */ void CDECL ANDROID_DestroyWindow( HWND hwnd )
1
0
0
0
Alexandre Julliard : wineandroid: Add support for storing per-window driver information.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: 2ecca0100817c3bf3c3d93b3ecb41e073621bcdf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2ecca0100817c3bf3c3d93b3e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed May 31 11:22:20 2017 +0200 wineandroid: Add support for storing per-window driver information. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wineandroid.drv/Makefile.in | 3 +- dlls/wineandroid.drv/window.c | 233 ++++++++++++++++++++++++++++++ dlls/wineandroid.drv/wineandroid.drv.spec | 3 + 3 files changed, 238 insertions(+), 1 deletion(-) diff --git a/dlls/wineandroid.drv/Makefile.in b/dlls/wineandroid.drv/Makefile.in index dd3ad19..f83d494 100644 --- a/dlls/wineandroid.drv/Makefile.in +++ b/dlls/wineandroid.drv/Makefile.in @@ -2,7 +2,8 @@ MODULE = wineandroid.drv IMPORTS = user32 gdi32 C_SRCS = \ - init.c + init.c \ + window.c IN_SRCS = \ build.gradle.in diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c new file mode 100644 index 0000000..f874458 --- /dev/null +++ b/dlls/wineandroid.drv/window.c @@ -0,0 +1,233 @@ +/* + * Window related functions + * + * Copyright 1993, 1994, 1995, 1996, 2001, 2013-2017 Alexandre Julliard + * Copyright 1993 David Metcalfe + * Copyright 1995, 1996 Alex Korobka + * + * 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 + */ + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT + +#include "config.h" +#include "wine/port.h" + +#include <assert.h> +#include <fcntl.h> +#include <poll.h> +#include <errno.h> +#include <stdarg.h> +#include <stdlib.h> +#include <stdio.h> +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "wine/unicode.h" + +#include "android.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(android); + +/* private window data */ +struct android_win_data +{ + HWND hwnd; /* hwnd that this private data belongs to */ + HWND parent; /* parent hwnd for child windows */ + RECT window_rect; /* USER window rectangle relative to parent */ + RECT whole_rect; /* X window rectangle for the whole window relative to parent */ + RECT client_rect; /* client area relative to parent */ +}; + +#define SWP_AGG_NOPOSCHANGE (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER) + +static CRITICAL_SECTION win_data_section; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &win_data_section, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": win_data_section") } +}; +static CRITICAL_SECTION win_data_section = { &critsect_debug, -1, 0, 0, 0, 0 }; + +static struct android_win_data *win_data_context[32768]; + +static inline int context_idx( HWND hwnd ) +{ + return LOWORD( hwnd ) >> 1; +} + + +/*********************************************************************** + * alloc_win_data + */ +static struct android_win_data *alloc_win_data( HWND hwnd ) +{ + struct android_win_data *data; + + if ((data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data)))) + { + data->hwnd = hwnd; + EnterCriticalSection( &win_data_section ); + win_data_context[context_idx(hwnd)] = data; + } + return data; +} + + +/*********************************************************************** + * free_win_data + */ +static void free_win_data( struct android_win_data *data ) +{ + win_data_context[context_idx( data->hwnd )] = NULL; + LeaveCriticalSection( &win_data_section ); + HeapFree( GetProcessHeap(), 0, data ); +} + + +/*********************************************************************** + * get_win_data + * + * Lock and return the data structure associated with a window. + */ +static struct android_win_data *get_win_data( HWND hwnd ) +{ + struct android_win_data *data; + + if (!hwnd) return NULL; + EnterCriticalSection( &win_data_section ); + if ((data = win_data_context[context_idx(hwnd)]) && data->hwnd == hwnd) return data; + LeaveCriticalSection( &win_data_section ); + return NULL; +} + + +/*********************************************************************** + * release_win_data + * + * Release the data returned by get_win_data. + */ +static void release_win_data( struct android_win_data *data ) +{ + if (data) LeaveCriticalSection( &win_data_section ); +} + + +/*********************************************************************** + * ANDROID_DestroyWindow + */ +void CDECL ANDROID_DestroyWindow( HWND hwnd ) +{ + struct android_win_data *data; + + if (!(data = get_win_data( hwnd ))) return; + + free_win_data( data ); +} + + +/*********************************************************************** + * create_win_data + * + * Create a data window structure for an existing window. + */ +static struct android_win_data *create_win_data( HWND hwnd, const RECT *window_rect, + const RECT *client_rect ) +{ + struct android_win_data *data; + HWND parent; + + if (!(parent = GetAncestor( hwnd, GA_PARENT ))) return NULL; /* desktop or HWND_MESSAGE */ + + if (parent != GetDesktopWindow()) + { + if (!(data = get_win_data( parent )) && + !(data = create_win_data( parent, NULL, NULL ))) + return NULL; + release_win_data( data ); + } + + if (!(data = alloc_win_data( hwnd ))) return NULL; + + data->parent = (parent == GetDesktopWindow()) ? 0 : parent; + + if (window_rect) + { + data->whole_rect = data->window_rect = *window_rect; + data->client_rect = *client_rect; + } + else + { + GetWindowRect( hwnd, &data->window_rect ); + MapWindowPoints( 0, parent, (POINT *)&data->window_rect, 2 ); + data->whole_rect = data->window_rect; + GetClientRect( hwnd, &data->client_rect ); + MapWindowPoints( hwnd, parent, (POINT *)&data->client_rect, 2 ); + } + return data; +} + + +/*********************************************************************** + * ANDROID_WindowPosChanging + */ +void CDECL ANDROID_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, + const RECT *window_rect, const RECT *client_rect, RECT *visible_rect, + struct window_surface **surface ) +{ + struct android_win_data *data = get_win_data( hwnd ); + + TRACE( "win %p window %s client %s style %08x flags %08x\n", + hwnd, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), + GetWindowLongW( hwnd, GWL_STYLE ), swp_flags ); + + if (!data && !(data = create_win_data( hwnd, window_rect, client_rect ))) return; + + *visible_rect = *window_rect; + + release_win_data( data ); +} + + +/*********************************************************************** + * ANDROID_WindowPosChanged + */ +void CDECL ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, + const RECT *window_rect, const RECT *client_rect, + const RECT *visible_rect, const RECT *valid_rects, + struct window_surface *surface ) +{ + struct android_win_data *data; + DWORD new_style = GetWindowLongW( hwnd, GWL_STYLE ); + + if (!(data = get_win_data( hwnd ))) return; + + data->window_rect = *window_rect; + data->whole_rect = *visible_rect; + data->client_rect = *client_rect; + + release_win_data( data ); + + TRACE( "win %p window %s client %s style %08x flags %08x\n", + hwnd, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), new_style, swp_flags ); +} diff --git a/dlls/wineandroid.drv/wineandroid.drv.spec b/dlls/wineandroid.drv/wineandroid.drv.spec index 1723bd4..b94c9f8 100644 --- a/dlls/wineandroid.drv/wineandroid.drv.spec +++ b/dlls/wineandroid.drv/wineandroid.drv.spec @@ -6,3 +6,6 @@ @ cdecl EnumDisplayMonitors(long ptr ptr long) ANDROID_EnumDisplayMonitors @ cdecl GetMonitorInfo(long ptr) ANDROID_GetMonitorInfo +@ cdecl DestroyWindow(long) ANDROID_DestroyWindow +@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) ANDROID_WindowPosChanging +@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) ANDROID_WindowPosChanged
1
0
0
0
Alexandre Julliard : wineandroid: Initialize screen dimensions.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: a5904bc661a809caf4f85bae64fe8f08669c54ae URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a5904bc661a809caf4f85bae6…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed May 31 11:15:17 2017 +0200 wineandroid: Initialize screen dimensions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wineandroid.drv/Makefile.in | 1 + dlls/wineandroid.drv/android.h | 50 ++++++++++ dlls/wineandroid.drv/init.c | 156 +++++++++++++++++++++++++++++- dlls/wineandroid.drv/wineandroid.drv.spec | 5 + 4 files changed, 208 insertions(+), 4 deletions(-) diff --git a/dlls/wineandroid.drv/Makefile.in b/dlls/wineandroid.drv/Makefile.in index 13ec433..dd3ad19 100644 --- a/dlls/wineandroid.drv/Makefile.in +++ b/dlls/wineandroid.drv/Makefile.in @@ -1,4 +1,5 @@ MODULE = wineandroid.drv +IMPORTS = user32 gdi32 C_SRCS = \ init.c diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h new file mode 100644 index 0000000..7c708f3 --- /dev/null +++ b/dlls/wineandroid.drv/android.h @@ -0,0 +1,50 @@ +/* + * Android driver definitions + * + * Copyright 2013 Alexandre Julliard + * + * 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 + */ + +#ifndef __WINE_ANDROID_H +#define __WINE_ANDROID_H + +#include <limits.h> +#include <stdarg.h> +#include <stdlib.h> +#include <jni.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "wine/gdi_driver.h" + + +/************************************************************************** + * USER driver + */ + +extern unsigned int screen_width DECLSPEC_HIDDEN; +extern unsigned int screen_height DECLSPEC_HIDDEN; +extern RECT virtual_screen_rect DECLSPEC_HIDDEN; +extern MONITORINFOEXW default_monitor DECLSPEC_HIDDEN; + +extern void init_monitors( int width, int height ) DECLSPEC_HIDDEN; + +extern JavaVM *wine_get_java_vm(void); +extern jobject wine_get_java_object(void); + +#endif /* __WINE_ANDROID_H */ diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index da2a168..3a3ce80 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -28,13 +28,30 @@ #include "windef.h" #include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "wine/gdi_driver.h" +#include "android.h" +#include "wine/server.h" +#include "wine/library.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(android); +unsigned int screen_width = 0; +unsigned int screen_height = 0; +RECT virtual_screen_rect = { 0, 0, 0, 0 }; + +MONITORINFOEXW default_monitor = +{ + sizeof(default_monitor), /* cbSize */ + { 0, 0, 0, 0 }, /* rcMonitor */ + { 0, 0, 0, 0 }, /* rcWork */ + MONITORINFOF_PRIMARY, /* dwFlags */ + { '\\','\\','.','\\','D','I','S','P','L','A','Y','1',0 } /* szDevice */ +}; + +static const unsigned int screen_bpp = 32; /* we don't support other modes */ + +static int device_init_done; + typedef struct { struct gdi_physdev dev; @@ -42,6 +59,65 @@ typedef struct static const struct gdi_dc_funcs android_drv_funcs; + +/****************************************************************************** + * init_monitors + */ +void init_monitors( int width, int height ) +{ + static const WCHAR trayW[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0}; + RECT rect; + HWND hwnd = FindWindowW( trayW, NULL ); + + virtual_screen_rect.right = width; + virtual_screen_rect.bottom = height; + default_monitor.rcMonitor = default_monitor.rcWork = virtual_screen_rect; + + if (!hwnd || !IsWindowVisible( hwnd )) return; + if (!GetWindowRect( hwnd, &rect )) return; + if (rect.top) default_monitor.rcWork.bottom = rect.top; + else default_monitor.rcWork.top = rect.bottom; + TRACE( "found tray %p %s work area %s\n", hwnd, + wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &default_monitor.rcWork )); +} + + +/********************************************************************** + * fetch_display_metrics + */ +static void fetch_display_metrics(void) +{ + if (wine_get_java_vm()) return; /* for Java threads it will be set when the top view is created */ + + SERVER_START_REQ( get_window_rectangles ) + { + req->handle = wine_server_user_handle( GetDesktopWindow() ); + req->relative = COORDS_CLIENT; + if (!wine_server_call( req )) + { + screen_width = reply->window.right; + screen_height = reply->window.bottom; + } + } + SERVER_END_REQ; + + init_monitors( screen_width, screen_height ); + TRACE( "screen %ux%u\n", screen_width, screen_height ); +} + + +/********************************************************************** + * device_init + * + * Perform initializations needed upon creation of the first device. + */ +static void device_init(void) +{ + device_init_done = TRUE; + fetch_display_metrics(); +} + + /****************************************************************************** * create_android_physdev */ @@ -49,6 +125,8 @@ static ANDROID_PDEVICE *create_android_physdev(void) { ANDROID_PDEVICE *physdev; + if (!device_init_done) device_init(); + if (!(physdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physdev) ))) return NULL; return physdev; } @@ -92,6 +170,76 @@ static BOOL ANDROID_DeleteDC( PHYSDEV dev ) } +/*********************************************************************** + * ANDROID_GetDeviceCaps + */ +static INT ANDROID_GetDeviceCaps( PHYSDEV dev, INT cap ) +{ + switch(cap) + { + case HORZRES: return screen_width; + case VERTRES: return screen_height; + case DESKTOPHORZRES: return virtual_screen_rect.right - virtual_screen_rect.left; + case DESKTOPVERTRES: return virtual_screen_rect.bottom - virtual_screen_rect.top; + case BITSPIXEL: return screen_bpp; + default: + dev = GET_NEXT_PHYSDEV( dev, pGetDeviceCaps ); + return dev->funcs->pGetDeviceCaps( dev, cap ); + } +} + + +/*********************************************************************** + * ANDROID_GetMonitorInfo + */ +BOOL CDECL ANDROID_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info ) +{ + if (handle != (HMONITOR)1) + { + SetLastError( ERROR_INVALID_HANDLE ); + return FALSE; + } + info->rcMonitor = default_monitor.rcMonitor; + info->rcWork = default_monitor.rcWork; + info->dwFlags = default_monitor.dwFlags; + if (info->cbSize >= sizeof(MONITORINFOEXW)) + lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, default_monitor.szDevice ); + return TRUE; +} + + +/*********************************************************************** + * ANDROID_EnumDisplayMonitors + */ +BOOL CDECL ANDROID_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp ) +{ + if (hdc) + { + POINT origin; + RECT limit, monrect; + + if (!GetDCOrgEx( hdc, &origin )) return FALSE; + if (GetClipBox( hdc, &limit ) == ERROR) return FALSE; + + if (rect && !IntersectRect( &limit, &limit, rect )) return TRUE; + + monrect = default_monitor.rcMonitor; + OffsetRect( &monrect, -origin.x, -origin.y ); + if (IntersectRect( &monrect, &monrect, &limit )) + if (!proc( (HMONITOR)1, hdc, &monrect, lp )) + return FALSE; + } + else + { + RECT unused; + if (!rect || IntersectRect( &unused, &default_monitor.rcMonitor, rect )) + if (!proc( (HMONITOR)1, 0, &default_monitor.rcMonitor, lp )) + return FALSE; + } + return TRUE; +} + + static const struct gdi_dc_funcs android_drv_funcs = { NULL, /* pAbortDoc */ @@ -131,7 +279,7 @@ static const struct gdi_dc_funcs android_drv_funcs = NULL, /* pGetCharABCWidths */ NULL, /* pGetCharABCWidthsI */ NULL, /* pGetCharWidth */ - NULL, /* pGetDeviceCaps */ + ANDROID_GetDeviceCaps, /* pGetDeviceCaps */ NULL, /* pGetDeviceGammaRamp */ NULL, /* pGetFontData */ NULL, /* pGetFontRealizationInfo */ diff --git a/dlls/wineandroid.drv/wineandroid.drv.spec b/dlls/wineandroid.drv/wineandroid.drv.spec index 9e94320..1723bd4 100644 --- a/dlls/wineandroid.drv/wineandroid.drv.spec +++ b/dlls/wineandroid.drv/wineandroid.drv.spec @@ -1,3 +1,8 @@ # GDI driver @ cdecl wine_get_gdi_driver(long) ANDROID_get_gdi_driver + +# USER driver + +@ cdecl EnumDisplayMonitors(long ptr ptr long) ANDROID_EnumDisplayMonitors +@ cdecl GetMonitorInfo(long ptr) ANDROID_GetMonitorInfo
1
0
0
0
Alexandre Julliard : wineandroid: Add an initial GDI driver.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: e5069b1017359253ff2c5444c251d24b9e6682c5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e5069b1017359253ff2c5444c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed May 31 10:58:55 2017 +0200 wineandroid: Add an initial GDI driver. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wineandroid.drv/Makefile.in | 6 + dlls/wineandroid.drv/init.c | 239 ++++++++++++++++++++++++++++++ dlls/wineandroid.drv/wineandroid.drv.spec | 4 +- 3 files changed, 248 insertions(+), 1 deletion(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=e5069b1017359253ff2c5…
1
0
0
0
Nikolay Sivov : comdlg32: Improve tracing messages.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: 1c1db33aba8a46cc634c56432d75a47585145a01 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1c1db33aba8a46cc634c56432…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed May 31 06:16:02 2017 +0300 comdlg32: Improve tracing messages. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/comdlg32/filedlg.c | 20 ++++++++++---------- dlls/comdlg32/filedlgbrowser.c | 9 +++------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index fa4a0d0..2ad7efa 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -765,7 +765,7 @@ static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) HANDLE hDlgTmpl = 0; HWND hChildDlg = 0; - TRACE("\n"); + TRACE("%p, %p\n", fodInfos, hwnd); /* * If OFN_ENABLETEMPLATEHANDLE is specified, the OPENFILENAME @@ -1038,7 +1038,7 @@ static LRESULT FILEDLG95_OnWMSize(HWND hwnd, WPARAM wParam) if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE; /* get the new dialog rectangle */ GetWindowRect( hwnd, &rc); - TRACE("Size from %d,%d to %d,%d\n", fodInfos->sizedlg.cx, fodInfos->sizedlg.cy, + TRACE("%p, size from %d,%d to %d,%d\n", hwnd, fodInfos->sizedlg.cx, fodInfos->sizedlg.cy, rc.right -rc.left, rc.bottom -rc.top); /* not initialized yet */ if( (fodInfos->sizedlg.cx == 0 && fodInfos->sizedlg.cy == 0) || @@ -2763,7 +2763,7 @@ static LRESULT FILEDLG95_SHELL_Init(HWND hwnd) { FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); - TRACE("\n"); + TRACE("%p\n", hwnd); /* * Initialisation of the FileOpenDialogInfos structure @@ -2900,7 +2900,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd) int nFilters = 0; /* number of filters */ int nFilterIndexCB; - TRACE("\n"); + TRACE("%p\n", hwnd); if(fodInfos->customfilter) { @@ -3133,7 +3133,7 @@ static void FILEDLG95_LOOKIN_Init(HWND hwndCombo) TEXTMETRICW tm; LookInInfos *liInfos = MemAlloc(sizeof(LookInInfos)); - TRACE("\n"); + TRACE("%p\n", hwndCombo); liInfos->iMaxIndentation = 0; @@ -3352,7 +3352,7 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId) SFOLDER *tmpFolder; LookInInfos *liInfos; - TRACE("%08x\n", iInsertId); + TRACE("%p, %p, %d\n", hwnd, pidl, iInsertId); if(!pidl) return -1; @@ -3382,7 +3382,7 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId) sizeof(sfi), SHGFI_DISPLAYNAME | SHGFI_PIDL | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED); - TRACE("-- Add %s attr=%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes); + TRACE("-- Add %s attr=0x%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes); if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM)) { @@ -3451,7 +3451,7 @@ int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl) int iItemPos; LookInInfos *liInfos; - TRACE("\n"); + TRACE("%p, %p\n", hwnd, pidl); iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidl,SEARCH_PIDL); @@ -4009,7 +4009,7 @@ static inline BOOL is_win16_looks(DWORD flags) */ BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn) { - TRACE("flags %08x\n", ofn->Flags); + TRACE("flags 0x%08x\n", ofn->Flags); if (!valid_struct_size( ofn->lStructSize )) { @@ -4044,7 +4044,7 @@ BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn) */ BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn) { - TRACE("flags %08x\n", ofn->Flags); + TRACE("flags 0x%08x\n", ofn->Flags); if (!valid_struct_size( ofn->lStructSize )) { diff --git a/dlls/comdlg32/filedlgbrowser.c b/dlls/comdlg32/filedlgbrowser.c index 85a3dd9..a225e9e 100644 --- a/dlls/comdlg32/filedlgbrowser.c +++ b/dlls/comdlg32/filedlgbrowser.c @@ -215,13 +215,11 @@ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner) /*************************************************************************** * IShellBrowserImpl_QueryInterface */ -static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, - REFIID riid, - LPVOID *ppvObj) +static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, REFIID riid, void **ppvObj) { IShellBrowserImpl *This = impl_from_IShellBrowser(iface); - TRACE("(%p)\n\t%s\n", This, debugstr_guid(riid)); + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj); *ppvObj = NULL; @@ -241,7 +239,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, return S_OK; } - FIXME("Unknown interface requested\n"); + FIXME("unsupported interface, %s\n", debugstr_guid(riid)); return E_NOINTERFACE; } @@ -272,7 +270,6 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface) { COMDLG32_SHFree(This); TRACE("-- destroyed\n"); - return 0; } return ref; }
1
0
0
0
Nikolay Sivov : comdlg32: Simplify notification helper.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: c4b133e231bb5e32814b35f9a5cd3ba930570aff URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c4b133e231bb5e32814b35f9a…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed May 31 06:16:01 2017 +0300 comdlg32: Simplify notification helper. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/comdlg32/filedlg.c | 49 ++++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index da85260..fa4a0d0 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -853,38 +853,29 @@ static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode) { FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndParentDlg); - LRESULT hook_result = 0; + LRESULT hook_result; + OFNOTIFYW ofnNotify; - TRACE("%p 0x%04x\n",hwndParentDlg, uCode); + TRACE("%p %d\n", hwndParentDlg, uCode); - if(!fodInfos) return 0; + if (!fodInfos || !fodInfos->DlgInfos.hwndCustomDlg) + return 0; + + TRACE("CALL NOTIFY for %d\n", uCode); + + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = uCode; + ofnNotify.lpOFN = fodInfos->ofnInfos; + ofnNotify.pszFile = NULL; + + if (fodInfos->unicode) + hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify); + else + hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify); + + TRACE("RET NOTIFY retval %#lx\n", hook_result); - if(fodInfos->DlgInfos.hwndCustomDlg) - { - TRACE("CALL NOTIFY for %x\n", uCode); - if(fodInfos->unicode) - { - OFNOTIFYW ofnNotify; - ofnNotify.hdr.hwndFrom=hwndParentDlg; - ofnNotify.hdr.idFrom=0; - ofnNotify.hdr.code = uCode; - ofnNotify.lpOFN = fodInfos->ofnInfos; - ofnNotify.pszFile = NULL; - hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); - } - else - { - OFNOTIFYA ofnNotify; - ofnNotify.hdr.hwndFrom=hwndParentDlg; - ofnNotify.hdr.idFrom=0; - ofnNotify.hdr.code = uCode; - ofnNotify.lpOFN = (LPOPENFILENAMEA)fodInfos->ofnInfos; - ofnNotify.pszFile = NULL; - hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); - } - TRACE("RET NOTIFY\n"); - } - TRACE("Retval: 0x%08lx\n", hook_result); return hook_result; }
1
0
0
0
Nikolay Sivov : comctl32/toolbar: Support undocumented IDs for standard bitmap lists.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: d93ae6ff346d0a84ad0db2cc034b72f0595e59e0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d93ae6ff346d0a84ad0db2cc0…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed May 31 05:56:39 2017 +0300 comctl32/toolbar: Support undocumented IDs for standard bitmap lists. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/comctl32/tests/toolbar.c | 93 ++++++++++++++++++++++++++++++++++++++++++- dlls/comctl32/toolbar.c | 7 +++- 2 files changed, 97 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index 2d12732..e2c29f4 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -490,13 +490,81 @@ static void add_128x15_bitmap(HWND hToolbar, int nCmds) static void test_add_bitmap(void) { + TBADDBITMAP stdsmall, std; HWND hToolbar = NULL; TBADDBITMAP bmp128; TBADDBITMAP bmp80; - TBADDBITMAP stdsmall; TBADDBITMAP addbmp; HIMAGELIST himl; - INT ret; + INT ret, id; + + /* Test default bitmaps range */ + for (id = IDB_STD_SMALL_COLOR; id < IDB_HIST_LARGE_COLOR; id++) + { + HIMAGELIST himl; + int cx, cy, count; + + rebuild_toolbar(&hToolbar); + + std.hInst = HINST_COMMCTRL; + std.nID = id; + + ret = SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&std); + ok(ret == 0, "Got %d\n", ret); + + himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); + ok(himl != NULL, "Got %p\n", himl); + + ret = ImageList_GetIconSize(himl, &cx, &cy); + ok(ret, "Got %d\n", ret); + ok(cx == cy, "Got %d x %d\n", cx, cy); + + count = ImageList_GetImageCount(himl); + + /* Image count */ + switch (id) + { + case IDB_STD_SMALL_COLOR: + case IDB_STD_LARGE_COLOR: + case 2: + case 3: + ok(count == 15, "got count %d\n", count); + break; + case IDB_VIEW_SMALL_COLOR: + case IDB_VIEW_LARGE_COLOR: + case 6: + case 7: + ok(count == 12, "got count %d\n", count); + break; + case IDB_HIST_SMALL_COLOR: + case IDB_HIST_LARGE_COLOR: + ok(count == 5, "got count %d\n", count); + break; + default: + ok(0, "id %d, count %d\n", id, count); + } + + /* Image sizes */ + switch (id) + { + case IDB_STD_SMALL_COLOR: + case 2: + case IDB_VIEW_SMALL_COLOR: + case 6: + case IDB_HIST_SMALL_COLOR: + ok(cx == 16, "got size %d\n", cx); + break; + case IDB_STD_LARGE_COLOR: + case 3: + case IDB_VIEW_LARGE_COLOR: + case 7: + case IDB_HIST_LARGE_COLOR: + ok(cx == 24, "got size %d\n", cx); + break; + default: + ok(0, "id %d, size %d\n", id, cx); + } + } /* empty 128x15 bitmap */ bmp128.hInst = GetModuleHandleA(NULL); @@ -2409,6 +2477,26 @@ todo_wine DestroyWindow(hwnd); } +static void test_imagelist(void) +{ + HIMAGELIST imagelist; + HWND hwnd = NULL; + int ret; + + rebuild_toolbar(&hwnd); + + imagelist = (HIMAGELIST)SendMessageA(hwnd, TB_GETIMAGELIST, 0, 0); + ok(imagelist == NULL, "got %p\n", imagelist); + + ret = SendMessageA(hwnd, TB_SETBITMAPSIZE, 0, MAKELONG(16, 16)); + ok(ret, "got %d\n", ret); + + imagelist = (HIMAGELIST)SendMessageA(hwnd, TB_GETIMAGELIST, 0, 0); + ok(imagelist == NULL, "got %p\n", imagelist); + + DestroyWindow(hwnd); +} + START_TEST(toolbar) { WNDCLASSA wc; @@ -2454,6 +2542,7 @@ START_TEST(toolbar) test_noresize(); test_save(); test_drawtext_flags(); + test_imagelist(); PostQuitMessage(0); while(GetMessageA(&msg,0,0,0)) { diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 4da3008..8a03597 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -2810,18 +2810,22 @@ TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp switch (lpAddBmp->nID) { case IDB_STD_SMALL_COLOR: + case 2: info.nButtons = 15; info.nID = IDB_STD_SMALL; break; case IDB_STD_LARGE_COLOR: + case 3: info.nButtons = 15; info.nID = IDB_STD_LARGE; break; case IDB_VIEW_SMALL_COLOR: + case 6: info.nButtons = 12; info.nID = IDB_VIEW_SMALL; break; case IDB_VIEW_LARGE_COLOR: + case 7: info.nButtons = 12; info.nID = IDB_VIEW_LARGE; break; @@ -2834,6 +2838,7 @@ TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp info.nID = IDB_HIST_LARGE; break; default: + WARN("unknown bitmap id, %ld\n", lpAddBmp->nID); return -1; } @@ -4346,7 +4351,7 @@ TOOLBAR_SetBitmapSize (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) short width = (short)LOWORD(lParam); short height = (short)HIWORD(lParam); - TRACE("hwnd=%p, wParam=%ld, lParam=%ld\n", infoPtr->hwndSelf, wParam, lParam); + TRACE("hwnd=%p, wParam=%ld, size %d x %d\n", infoPtr->hwndSelf, wParam, width, height); if (wParam != 0) FIXME("wParam is %ld. Perhaps image list index?\n", wParam);
1
0
0
0
Nikolay Sivov : comctl32/toolbar: Don't add NULL imagelist entries.
by Alexandre Julliard
31 May '17
31 May '17
Module: wine Branch: master Commit: ece34a1319f47cb7cd242c0f95d57cd1d35ae8f4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ece34a1319f47cb7cd242c0f9…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed May 31 05:56:38 2017 +0300 comctl32/toolbar: Don't add NULL imagelist entries. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/comctl32/toolbar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index c57707b..4da3008 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -6904,6 +6904,10 @@ static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIS /* Check if the entry already exists */ c = TOOLBAR_GetImageListEntry(*pies, *cies, id); + /* Don't add new entry for NULL imagelist */ + if (!c && !himl) + return NULL; + /* If this is a new entry we must create it and insert into the array */ if (!c) {
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
64
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Results per page:
10
25
50
100
200