From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/ntuser_private.h | 3 +- dlls/win32u/sysparams.c | 10 ----- dlls/win32u/win32u_private.h | 1 - dlls/win32u/window.c | 32 +++++++------- include/ntuser.h | 2 + include/wine/server_protocol.h | 18 ++++---- server/protocol.def | 12 ++---- server/request.h | 16 +++---- server/trace.c | 12 ++---- server/window.c | 77 ++++++++++++++++------------------ 10 files changed, 76 insertions(+), 107 deletions(-)
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 11b1a3ff8a1..f0bd14179d4 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -74,8 +74,7 @@ typedef struct tagWND HICON hIconSmall; /* window's small icon */ HICON hIconSmall2; /* window's secondary small icon, derived from hIcon */ HIMC imc; /* window's input context */ - UINT dpi; /* window DPI */ - DPI_AWARENESS dpi_awareness; /* DPI awareness */ + UINT dpi_context; /* window DPI awareness context */ struct window_surface *surface; /* Window surface if any */ struct list vulkan_surfaces; /* list of vulkan surfaces created for this window */ struct tagDIALOGINFO *dlgInfo; /* Dialog additional info (dialogs only) */ diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 05db64d1721..c556f79719d 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -2136,16 +2136,6 @@ static BOOL is_valid_dpi_awareness_context( UINT context, UINT dpi ) return FALSE; }
-UINT get_dpi_awareness_context_from_awareness( DPI_AWARENESS awareness ) -{ - switch (awareness) - { - default: return NTUSER_DPI_UNAWARE; - case DPI_AWARENESS_SYSTEM_AWARE: return NTUSER_DPI_SYSTEM_AWARE; - case DPI_AWARENESS_PER_MONITOR_AWARE: return NTUSER_DPI_PER_MONITOR_AWARE; - } -} - UINT get_thread_dpi_awareness_context(void) { struct ntuser_thread_info *info = NtUserGetThreadInfo(); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index e41fca01fc1..aecd60bae63 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -173,7 +173,6 @@ extern HBRUSH get_sys_color_brush( unsigned int index ); extern HPEN get_sys_color_pen( unsigned int index ); extern UINT get_system_dpi(void); extern int get_system_metrics( int index ); -extern UINT get_dpi_awareness_context_from_awareness( DPI_AWARENESS awareness ); extern UINT get_thread_dpi(void); extern UINT set_thread_dpi_awareness_context( UINT context ); extern UINT get_thread_dpi_awareness_context(void); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 582afee8883..b0fe0218da5 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -450,8 +450,7 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent ) { old_parent = wine_server_ptr_handle( reply->old_parent ); win->parent = parent = wine_server_ptr_handle( reply->full_parent ); - win->dpi = reply->dpi; - win->dpi_awareness = reply->awareness; + win->dpi_context = reply->dpi_context; }
} @@ -869,7 +868,7 @@ UINT get_window_dpi_awareness_context( HWND hwnd ) if (win == WND_DESKTOP) return NTUSER_DPI_PER_MONITOR_AWARE; if (win != WND_OTHER_PROCESS) { - ret = get_dpi_awareness_context_from_awareness( win->dpi_awareness ); + ret = win->dpi_context; release_win_ptr( win ); } else @@ -877,7 +876,7 @@ UINT get_window_dpi_awareness_context( HWND hwnd ) SERVER_START_REQ( get_window_info ) { req->handle = wine_server_user_handle( hwnd ); - if (!wine_server_call_err( req )) ret = get_dpi_awareness_context_from_awareness( reply->awareness ); + if (!wine_server_call_err( req )) ret = reply->dpi_context; } SERVER_END_REQ; } @@ -888,7 +887,7 @@ UINT get_window_dpi_awareness_context( HWND hwnd ) UINT get_dpi_for_window( HWND hwnd ) { WND *win; - UINT ret = 0; + UINT context = 0;
if (!(win = get_win_ptr( hwnd ))) { @@ -902,8 +901,7 @@ UINT get_dpi_for_window( HWND hwnd ) } if (win != WND_OTHER_PROCESS) { - ret = win->dpi; - if (!ret) ret = get_win_monitor_dpi( hwnd ); + context = win->dpi_context; release_win_ptr( win ); } else @@ -911,11 +909,13 @@ UINT get_dpi_for_window( HWND hwnd ) SERVER_START_REQ( get_window_info ) { req->handle = wine_server_user_handle( hwnd ); - if (!wine_server_call_err( req )) ret = reply->dpi; + if (!wine_server_call_err( req )) context = reply->dpi_context; } SERVER_END_REQ; } - return ret; + + if (NTUSER_DPI_CONTEXT_IS_MONITOR_AWARE( context )) return get_win_monitor_dpi( hwnd ); + return NTUSER_DPI_CONTEXT_GET_DPI( context ); }
static LONG_PTR get_win_data( const void *ptr, UINT size ) @@ -4911,11 +4911,10 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, HINSTANCE instance, BOOL ansi, DWORD style, DWORD ex_style ) { - DPI_AWARENESS awareness = NTUSER_DPI_CONTEXT_GET_AWARENESS( get_thread_dpi_awareness_context() ); + UINT dpi_context = get_thread_dpi_awareness_context(); HWND handle = 0, full_parent = 0, full_owner = 0; struct tagCLASS *class = NULL; int extra_bytes = 0; - UINT dpi = 0; WND *win;
SERVER_START_REQ( create_window ) @@ -4923,8 +4922,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, req->parent = wine_server_user_handle( parent ); req->owner = wine_server_user_handle( owner ); req->instance = wine_server_client_ptr( instance ); - req->dpi = get_system_dpi(); - req->awareness = awareness; + req->dpi_context = dpi_context; req->style = style; req->ex_style = ex_style; if (!(req->atom = get_int_atom_value( name )) && name->Length) @@ -4935,8 +4933,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, full_parent = wine_server_ptr_handle( reply->parent ); full_owner = wine_server_ptr_handle( reply->owner ); extra_bytes = reply->extra; - dpi = reply->dpi; - awareness = reply->awareness; + dpi_context = reply->dpi_context; class = wine_server_get_ptr( reply->class_ptr ); } } @@ -4988,8 +4985,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, win->class = class; win->winproc = get_class_winproc( class ); win->cbWndExtra = extra_bytes; - win->dpi = dpi; - win->dpi_awareness = awareness; + win->dpi_context = dpi_context; list_init( &win->vulkan_surfaces ); set_user_handle_ptr( handle, &win->obj ); if (is_winproc_unicode( win->winproc, !ansi )) win->flags |= WIN_ISUNICODE; @@ -5241,7 +5237,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, } else NtUserSetWindowLongPtr( hwnd, GWLP_ID, (ULONG_PTR)cs.hMenu, FALSE );
- win_dpi = win->dpi; + win_dpi = NTUSER_DPI_CONTEXT_GET_DPI( win->dpi_context ); release_win_ptr( win );
if (parent) map_dpi_create_struct( &cs, thread_dpi, win_dpi ); diff --git a/include/ntuser.h b/include/ntuser.h index 72cf57a5769..ff45ffa2bc8 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -291,6 +291,8 @@ struct unpack_dde_message_result #define NTUSER_DPI_CONTEXT_FLAG_PROCESS 0x80000000 #define NTUSER_DPI_CONTEXT_FLAG_VALID_MASK (NTUSER_DPI_CONTEXT_FLAG_PROCESS | NTUSER_DPI_CONTEXT_FLAG_GDISCALED)
+#define NTUSER_DPI_CONTEXT_IS_MONITOR_AWARE( ctx ) (NTUSER_DPI_CONTEXT_GET_AWARENESS( ctx ) == DPI_AWARENESS_PER_MONITOR_AWARE) + #define NTUSER_DPI_UNAWARE MAKE_NTUSER_DPI_CONTEXT( DPI_AWARENESS_UNAWARE, 1, USER_DEFAULT_SCREEN_DPI, 0 ) #define NTUSER_DPI_SYSTEM_AWARE MAKE_NTUSER_DPI_CONTEXT( DPI_AWARENESS_SYSTEM_AWARE, 1, system_dpi, 0 ) #define NTUSER_DPI_PER_MONITOR_AWARE MAKE_NTUSER_DPI_CONTEXT( DPI_AWARENESS_PER_MONITOR_AWARE, 1, 0, 0 ) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index d17f0936c3f..7b065c0080a 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -3223,11 +3223,11 @@ struct create_window_request user_handle_t owner; atom_t atom; mod_handle_t instance; - int dpi; - int awareness; + unsigned int dpi_context; unsigned int style; unsigned int ex_style; /* VARARG(class,unicode_str); */ + char __pad_44[4]; }; struct create_window_reply { @@ -3237,8 +3237,8 @@ struct create_window_reply user_handle_t owner; int extra; client_ptr_t class_ptr; - int dpi; - int awareness; + unsigned int dpi_context; + char __pad_36[4]; };
@@ -3299,8 +3299,8 @@ struct get_window_info_reply thread_id_t tid; atom_t atom; int is_unicode; - int dpi; - int awareness; + unsigned int dpi_context; + char __pad_36[4]; };
@@ -3352,8 +3352,8 @@ struct set_parent_reply struct reply_header __header; user_handle_t old_parent; user_handle_t full_parent; - int dpi; - int awareness; + unsigned int dpi_context; + char __pad_20[4]; };
@@ -6524,7 +6524,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 801 +#define SERVER_PROTOCOL_VERSION 802
/* ### protocol_version end ### */
diff --git a/server/protocol.def b/server/protocol.def index 37a39206ca4..1491994197c 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2373,8 +2373,7 @@ enum message_type user_handle_t owner; /* owner window */ atom_t atom; /* class atom */ mod_handle_t instance; /* module instance */ - int dpi; /* system DPI */ - int awareness; /* thread DPI awareness */ + unsigned int dpi_context; /* thread DPI context */ unsigned int style; /* window style */ unsigned int ex_style; /* window extended style */ VARARG(class,unicode_str); /* class name */ @@ -2384,8 +2383,7 @@ enum message_type user_handle_t owner; /* full handle of owner */ int extra; /* number of extra bytes */ client_ptr_t class_ptr; /* pointer to class in client address space */ - int dpi; /* window DPI if not per-monitor aware */ - int awareness; /* window DPI awareness */ + unsigned int dpi_context; /* window DPI context */ @END
@@ -2424,8 +2422,7 @@ enum message_type thread_id_t tid; /* thread owning the window */ atom_t atom; /* class atom */ int is_unicode; /* ANSI or unicode */ - int dpi; /* window DPI */ - int awareness; /* DPI awareness */ + unsigned int dpi_context; /* window DPI context */ @END
@@ -2465,8 +2462,7 @@ enum message_type @REPLY user_handle_t old_parent; /* old parent window */ user_handle_t full_parent; /* full handle of new parent */ - int dpi; /* new window DPI if not per-monitor aware */ - int awareness; /* new DPI awareness */ + unsigned int dpi_context; /* new DPI context */ @END
diff --git a/server/request.h b/server/request.h index 5061e0ed399..9f7e6173dc6 100644 --- a/server/request.h +++ b/server/request.h @@ -1525,18 +1525,16 @@ C_ASSERT( FIELD_OFFSET(struct create_window_request, parent) == 12 ); C_ASSERT( FIELD_OFFSET(struct create_window_request, owner) == 16 ); C_ASSERT( FIELD_OFFSET(struct create_window_request, atom) == 20 ); C_ASSERT( FIELD_OFFSET(struct create_window_request, instance) == 24 ); -C_ASSERT( FIELD_OFFSET(struct create_window_request, dpi) == 32 ); -C_ASSERT( FIELD_OFFSET(struct create_window_request, awareness) == 36 ); -C_ASSERT( FIELD_OFFSET(struct create_window_request, style) == 40 ); -C_ASSERT( FIELD_OFFSET(struct create_window_request, ex_style) == 44 ); +C_ASSERT( FIELD_OFFSET(struct create_window_request, dpi_context) == 32 ); +C_ASSERT( FIELD_OFFSET(struct create_window_request, style) == 36 ); +C_ASSERT( FIELD_OFFSET(struct create_window_request, ex_style) == 40 ); C_ASSERT( sizeof(struct create_window_request) == 48 ); C_ASSERT( FIELD_OFFSET(struct create_window_reply, handle) == 8 ); C_ASSERT( FIELD_OFFSET(struct create_window_reply, parent) == 12 ); C_ASSERT( FIELD_OFFSET(struct create_window_reply, owner) == 16 ); C_ASSERT( FIELD_OFFSET(struct create_window_reply, extra) == 20 ); C_ASSERT( FIELD_OFFSET(struct create_window_reply, class_ptr) == 24 ); -C_ASSERT( FIELD_OFFSET(struct create_window_reply, dpi) == 32 ); -C_ASSERT( FIELD_OFFSET(struct create_window_reply, awareness) == 36 ); +C_ASSERT( FIELD_OFFSET(struct create_window_reply, dpi_context) == 32 ); C_ASSERT( sizeof(struct create_window_reply) == 40 ); C_ASSERT( FIELD_OFFSET(struct destroy_window_request, handle) == 12 ); C_ASSERT( sizeof(struct destroy_window_request) == 16 ); @@ -1559,8 +1557,7 @@ C_ASSERT( FIELD_OFFSET(struct get_window_info_reply, pid) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_window_info_reply, tid) == 20 ); C_ASSERT( FIELD_OFFSET(struct get_window_info_reply, atom) == 24 ); C_ASSERT( FIELD_OFFSET(struct get_window_info_reply, is_unicode) == 28 ); -C_ASSERT( FIELD_OFFSET(struct get_window_info_reply, dpi) == 32 ); -C_ASSERT( FIELD_OFFSET(struct get_window_info_reply, awareness) == 36 ); +C_ASSERT( FIELD_OFFSET(struct get_window_info_reply, dpi_context) == 32 ); C_ASSERT( sizeof(struct get_window_info_reply) == 40 ); C_ASSERT( FIELD_OFFSET(struct set_window_info_request, flags) == 12 ); C_ASSERT( FIELD_OFFSET(struct set_window_info_request, is_unicode) == 14 ); @@ -1585,8 +1582,7 @@ C_ASSERT( FIELD_OFFSET(struct set_parent_request, parent) == 16 ); C_ASSERT( sizeof(struct set_parent_request) == 24 ); C_ASSERT( FIELD_OFFSET(struct set_parent_reply, old_parent) == 8 ); C_ASSERT( FIELD_OFFSET(struct set_parent_reply, full_parent) == 12 ); -C_ASSERT( FIELD_OFFSET(struct set_parent_reply, dpi) == 16 ); -C_ASSERT( FIELD_OFFSET(struct set_parent_reply, awareness) == 20 ); +C_ASSERT( FIELD_OFFSET(struct set_parent_reply, dpi_context) == 16 ); C_ASSERT( sizeof(struct set_parent_reply) == 24 ); C_ASSERT( FIELD_OFFSET(struct get_window_parents_request, handle) == 12 ); C_ASSERT( sizeof(struct get_window_parents_request) == 16 ); diff --git a/server/trace.c b/server/trace.c index f9c78ade989..9c1106d8fd5 100644 --- a/server/trace.c +++ b/server/trace.c @@ -2956,8 +2956,7 @@ static void dump_create_window_request( const struct create_window_request *req fprintf( stderr, ", owner=%08x", req->owner ); fprintf( stderr, ", atom=%04x", req->atom ); dump_uint64( ", instance=", &req->instance ); - fprintf( stderr, ", dpi=%d", req->dpi ); - fprintf( stderr, ", awareness=%d", req->awareness ); + fprintf( stderr, ", dpi_context=%08x", req->dpi_context ); fprintf( stderr, ", style=%08x", req->style ); fprintf( stderr, ", ex_style=%08x", req->ex_style ); dump_varargs_unicode_str( ", class=", cur_size ); @@ -2970,8 +2969,7 @@ static void dump_create_window_reply( const struct create_window_reply *req ) fprintf( stderr, ", owner=%08x", req->owner ); fprintf( stderr, ", extra=%d", req->extra ); dump_uint64( ", class_ptr=", &req->class_ptr ); - fprintf( stderr, ", dpi=%d", req->dpi ); - fprintf( stderr, ", awareness=%d", req->awareness ); + fprintf( stderr, ", dpi_context=%08x", req->dpi_context ); }
static void dump_destroy_window_request( const struct destroy_window_request *req ) @@ -3015,8 +3013,7 @@ static void dump_get_window_info_reply( const struct get_window_info_reply *req fprintf( stderr, ", tid=%04x", req->tid ); fprintf( stderr, ", atom=%04x", req->atom ); fprintf( stderr, ", is_unicode=%d", req->is_unicode ); - fprintf( stderr, ", dpi=%d", req->dpi ); - fprintf( stderr, ", awareness=%d", req->awareness ); + fprintf( stderr, ", dpi_context=%08x", req->dpi_context ); }
static void dump_set_window_info_request( const struct set_window_info_request *req ) @@ -3053,8 +3050,7 @@ static void dump_set_parent_reply( const struct set_parent_reply *req ) { fprintf( stderr, " old_parent=%08x", req->old_parent ); fprintf( stderr, ", full_parent=%08x", req->full_parent ); - fprintf( stderr, ", dpi=%d", req->dpi ); - fprintf( stderr, ", awareness=%d", req->awareness ); + fprintf( stderr, ", dpi_context=%08x", req->dpi_context ); }
static void dump_get_window_parents_request( const struct get_window_parents_request *req ) diff --git a/server/window.c b/server/window.c index 242e93f303a..b98429c8f31 100644 --- a/server/window.c +++ b/server/window.c @@ -83,8 +83,7 @@ struct window unsigned int color_key; /* color key for a layered window */ unsigned int alpha; /* alpha value for a layered window */ unsigned int layered_flags; /* flags for a layered window */ - unsigned int dpi; /* window DPI or 0 if per-monitor aware */ - DPI_AWARENESS dpi_awareness; /* DPI awareness mode */ + unsigned int dpi_context; /* DPI awareness context */ lparam_t user_data; /* user-specific data */ WCHAR *text; /* window caption text */ data_size_t text_len; /* length of window caption */ @@ -245,12 +244,20 @@ static inline void update_pixel_format_flags( struct window *win ) win->paint_flags |= PAINT_PIXEL_FORMAT_CHILD; }
+static unsigned int get_window_dpi( struct window *win ) +{ + unsigned int dpi; + if ((dpi = NTUSER_DPI_CONTEXT_GET_DPI( win->dpi_context ))) return dpi; + /* FIXME: return the window monitor DPI? */ + return USER_DEFAULT_SCREEN_DPI; +} + /* get the per-monitor DPI for a window */ static unsigned int get_monitor_dpi( struct window *win ) { /* FIXME: we return the desktop window DPI for now */ while (!is_desktop_window( win )) win = win->parent; - return win->dpi ? win->dpi : USER_DEFAULT_SCREEN_DPI; + return get_window_dpi( win ); }
/* link a window at the right place in the siblings list */ @@ -333,11 +340,7 @@ static int set_parent_window( struct window *win, struct window *parent ) win->parent = (struct window *)grab_object( parent ); link_window( win, WINPTR_TOP );
- if (!is_desktop_window( parent )) - { - win->dpi = parent->dpi; - win->dpi_awareness = parent->dpi_awareness; - } + if (!is_desktop_window( parent )) win->dpi_context = parent->dpi_context;
/* if parent belongs to a different thread and the window isn't */ /* top-level, attach the two threads */ @@ -573,8 +576,7 @@ static struct window *create_window( struct window *parent, struct window *owner win->is_linked = 0; win->is_layered = 0; win->is_orphan = 0; - win->dpi_awareness = DPI_AWARENESS_PER_MONITOR_AWARE; - win->dpi = 0; + win->dpi_context = NTUSER_DPI_PER_MONITOR_AWARE; win->user_data = 0; win->text = NULL; win->text_len = 0; @@ -760,7 +762,7 @@ static void screen_to_client( struct window *win, int *x, int *y, unsigned int d if (is_desktop_window( win )) return;
client_to_screen( win, &offset_x, &offset_y ); - map_dpi_point( win, x, y, dpi, win->dpi ); + map_dpi_point( win, x, y, dpi, get_window_dpi( win ) ); *x -= offset_x; *y -= offset_y; } @@ -816,7 +818,7 @@ static int is_point_in_window( struct window *win, int *x, int *y, unsigned int return 0; /* disabled child */ if ((win->ex_style & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) == (WS_EX_LAYERED|WS_EX_TRANSPARENT)) return 0; /* transparent */ - map_dpi_point( win, x, y, dpi, win->dpi ); + map_dpi_point( win, x, y, dpi, get_window_dpi( win ) ); if (!point_in_rect( &win->visible_rect, *x, *y )) return 0; /* not in window */ if (win->win_region && @@ -857,7 +859,7 @@ static struct window *child_window_from_point( struct window *parent, int x, int { int x_child = x, y_child = y;
- if (!is_point_in_window( ptr, &x_child, &y_child, parent->dpi )) continue; /* skip it */ + if (!is_point_in_window( ptr, &x_child, &y_child, get_window_dpi( parent ) )) continue; /* skip it */
/* if window is minimized or disabled, return at once */ if (ptr->style & (WS_MINIMIZE|WS_DISABLED)) return ptr; @@ -881,7 +883,7 @@ static int get_window_children_from_point( struct window *parent, int x, int y, { int x_child = x, y_child = y;
- if (!is_point_in_window( ptr, &x_child, &y_child, parent->dpi )) continue; /* skip it */ + if (!is_point_in_window( ptr, &x_child, &y_child, get_window_dpi( parent ) )) continue; /* skip it */
/* if point is in client area, and window is not minimized or disabled, check children */ if (!(ptr->style & (WS_MINIMIZE|WS_DISABLED)) && point_in_rect( &ptr->client_rect, x_child, y_child )) @@ -934,7 +936,7 @@ static int all_windows_from_point( struct window *top, int x, int y, unsigned in if (!is_desktop_window( top ) && !is_desktop_window( top->parent )) { screen_to_client( top->parent, &x, &y, dpi ); - dpi = top->parent->dpi; + dpi = get_window_dpi( top->parent ); }
if (!is_point_in_window( top, &x, &y, dpi )) return 1; @@ -1573,7 +1575,7 @@ static void redraw_window( struct window *win, struct region *region, int frame, if (!(child_rgn = create_empty_region())) continue; if (copy_region( child_rgn, tmp )) { - map_dpi_region( child, child_rgn, win->dpi, child->dpi ); + map_dpi_region( child, child_rgn, get_window_dpi( win ), get_window_dpi( child ) ); if (rect_in_region( child_rgn, &child->window_rect )) { offset_region( child_rgn, -child->client_rect.left, -child->client_rect.top ); @@ -2086,25 +2088,19 @@ DECL_HANDLER(create_window) if (!(win = create_window( parent, owner, atom, req->instance ))) return;
if (parent && !is_desktop_window( parent )) - { - win->dpi_awareness = parent->dpi_awareness; - win->dpi = parent->dpi; - } - else if (!parent || req->awareness != DPI_AWARENESS_PER_MONITOR_AWARE) - { - win->dpi_awareness = req->awareness; - win->dpi = req->dpi; - } + win->dpi_context = parent->dpi_context; + else if (!parent || !NTUSER_DPI_CONTEXT_IS_MONITOR_AWARE( req->dpi_context )) + win->dpi_context = req->dpi_context; + win->style = req->style; win->ex_style = req->ex_style;
- reply->handle = win->handle; - reply->parent = win->parent ? win->parent->handle : 0; - reply->owner = win->owner; - reply->extra = win->nb_extra_bytes; - reply->dpi = win->dpi; - reply->awareness = win->dpi_awareness; - reply->class_ptr = get_class_client_ptr( win->class ); + reply->handle = win->handle; + reply->parent = win->parent ? win->parent->handle : 0; + reply->owner = win->owner; + reply->extra = win->nb_extra_bytes; + reply->dpi_context = win->dpi_context; + reply->class_ptr = get_class_client_ptr( win->class ); }
@@ -2124,8 +2120,7 @@ DECL_HANDLER(set_parent) reply->old_parent = win->parent->handle; reply->full_parent = parent ? parent->handle : 0; set_parent_window( win, parent ); - reply->dpi = win->dpi; - reply->awareness = win->dpi_awareness; + reply->dpi_context = win->dpi_context; }
@@ -2220,8 +2215,8 @@ DECL_HANDLER(get_window_info) reply->full_handle = win->handle; reply->last_active = win->handle; reply->is_unicode = win->is_unicode; - reply->awareness = win->dpi_awareness; - reply->dpi = win->dpi ? win->dpi : get_monitor_dpi( win ); + reply->dpi_context = win->dpi_context; + if (get_user_object( win->last_active, USER_WINDOW )) reply->last_active = win->last_active; if (win->thread) { @@ -2532,8 +2527,8 @@ DECL_HANDLER(get_window_rectangles) set_error( STATUS_INVALID_PARAMETER ); break; } - map_dpi_rect( win, &reply->window, win->dpi, req->dpi ); - map_dpi_rect( win, &reply->client, win->dpi, req->dpi ); + map_dpi_rect( win, &reply->window, get_window_dpi( win ), req->dpi ); + map_dpi_rect( win, &reply->client, get_window_dpi( win ), req->dpi ); }
@@ -2580,7 +2575,7 @@ DECL_HANDLER(get_windows_offset) x = mirror_from ? win->client_rect.right - win->client_rect.left : 0; y = 0; client_to_screen( win, &x, &y ); - map_dpi_point( win, &x, &y, win->dpi, req->dpi ); + map_dpi_point( win, &x, &y, get_window_dpi( win ), req->dpi ); reply->x += x; reply->y += y; } @@ -2591,7 +2586,7 @@ DECL_HANDLER(get_windows_offset) x = mirror_to ? win->client_rect.right - win->client_rect.left : 0; y = 0; client_to_screen( win, &x, &y ); - map_dpi_point( win, &x, &y, win->dpi, req->dpi ); + map_dpi_point( win, &x, &y, get_window_dpi( win ), req->dpi ); reply->x -= x; reply->y -= y; } @@ -2790,7 +2785,7 @@ DECL_HANDLER(update_window_zorder) if (ptr->ex_style & WS_EX_TRANSPARENT) continue; if (ptr->is_layered && (ptr->layered_flags & LWA_COLORKEY)) continue; tmp = rect; - map_dpi_rect( win, &tmp, win->parent->dpi, win->dpi ); + map_dpi_rect( win, &tmp, get_window_dpi( win->parent ), get_window_dpi( win ) ); if (!intersect_rect( &tmp, &tmp, &ptr->visible_rect )) continue; if (ptr->win_region) {