Commit d07019e4 authored by Gopal Prasad's avatar Gopal Prasad Committed by Alexandre Julliard

winewayland.drv: Implement SetWindowText.

parent dbc00aec
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "config.h" #include "config.h"
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
...@@ -902,3 +903,29 @@ void wayland_surface_ensure_contents(struct wayland_surface *surface) ...@@ -902,3 +903,29 @@ void wayland_surface_ensure_contents(struct wayland_surface *surface)
if (damage) NtGdiDeleteObjectApp(damage); if (damage) NtGdiDeleteObjectApp(damage);
} }
/**********************************************************************
* wayland_surface_set_title
*/
void wayland_surface_set_title(struct wayland_surface *surface, LPCWSTR text)
{
DWORD text_len;
DWORD utf8_count;
char *utf8 = NULL;
assert(surface->xdg_toplevel);
TRACE("surface=%p hwnd=%p text='%s'\n",
surface, surface->hwnd, wine_dbgstr_w(text));
text_len = (lstrlenW(text) + 1) * sizeof(WCHAR);
if (!RtlUnicodeToUTF8N(NULL, 0, &utf8_count, text, text_len) &&
(utf8 = malloc(utf8_count)))
{
RtlUnicodeToUTF8N(utf8, utf8_count, &utf8_count, text, text_len);
xdg_toplevel_set_title(surface->xdg_toplevel, utf8);
}
free(utf8);
}
...@@ -258,6 +258,7 @@ void wayland_surface_coords_to_window(struct wayland_surface *surface, ...@@ -258,6 +258,7 @@ void wayland_surface_coords_to_window(struct wayland_surface *surface,
struct wayland_client_surface *wayland_surface_get_client(struct wayland_surface *surface); struct wayland_client_surface *wayland_surface_get_client(struct wayland_surface *surface);
BOOL wayland_client_surface_release(struct wayland_client_surface *client); BOOL wayland_client_surface_release(struct wayland_client_surface *client);
void wayland_surface_ensure_contents(struct wayland_surface *surface); void wayland_surface_ensure_contents(struct wayland_surface *surface);
void wayland_surface_set_title(struct wayland_surface *surface, LPCWSTR title);
/********************************************************************** /**********************************************************************
* Wayland SHM buffer * Wayland SHM buffer
...@@ -329,6 +330,7 @@ BOOL WAYLAND_ClipCursor(const RECT *clip, BOOL reset); ...@@ -329,6 +330,7 @@ BOOL WAYLAND_ClipCursor(const RECT *clip, BOOL reset);
LRESULT WAYLAND_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); LRESULT WAYLAND_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
void WAYLAND_DestroyWindow(HWND hwnd); void WAYLAND_DestroyWindow(HWND hwnd);
void WAYLAND_SetCursor(HWND hwnd, HCURSOR hcursor); void WAYLAND_SetCursor(HWND hwnd, HCURSOR hcursor);
void WAYLAND_SetWindowText(HWND hwnd, LPCWSTR text);
LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam);
BOOL WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manager, BOOL WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manager,
BOOL force, void *param); BOOL force, void *param);
......
...@@ -41,6 +41,7 @@ static const struct user_driver_funcs waylanddrv_funcs = ...@@ -41,6 +41,7 @@ static const struct user_driver_funcs waylanddrv_funcs =
.pKbdLayerDescriptor = WAYLAND_KbdLayerDescriptor, .pKbdLayerDescriptor = WAYLAND_KbdLayerDescriptor,
.pReleaseKbdTables = WAYLAND_ReleaseKbdTables, .pReleaseKbdTables = WAYLAND_ReleaseKbdTables,
.pSetCursor = WAYLAND_SetCursor, .pSetCursor = WAYLAND_SetCursor,
.pSetWindowText = WAYLAND_SetWindowText,
.pSysCommand = WAYLAND_SysCommand, .pSysCommand = WAYLAND_SysCommand,
.pUpdateDisplayDevices = WAYLAND_UpdateDisplayDevices, .pUpdateDisplayDevices = WAYLAND_UpdateDisplayDevices,
.pWindowMessage = WAYLAND_WindowMessage, .pWindowMessage = WAYLAND_WindowMessage,
......
...@@ -195,6 +195,7 @@ static void wayland_win_data_update_wayland_surface(struct wayland_win_data *dat ...@@ -195,6 +195,7 @@ static void wayland_win_data_update_wayland_surface(struct wayland_win_data *dat
HWND parent = NtUserGetAncestor(data->hwnd, GA_PARENT); HWND parent = NtUserGetAncestor(data->hwnd, GA_PARENT);
BOOL visible, xdg_visible; BOOL visible, xdg_visible;
RECT clip; RECT clip;
WCHAR text[1024];
TRACE("hwnd=%p\n", data->hwnd); TRACE("hwnd=%p\n", data->hwnd);
...@@ -223,7 +224,16 @@ static void wayland_win_data_update_wayland_surface(struct wayland_win_data *dat ...@@ -223,7 +224,16 @@ static void wayland_win_data_update_wayland_surface(struct wayland_win_data *dat
/* If the window is a visible toplevel make it a wayland /* If the window is a visible toplevel make it a wayland
* xdg_toplevel. Otherwise keep it role-less to avoid polluting the * xdg_toplevel. Otherwise keep it role-less to avoid polluting the
* compositor with empty xdg_toplevels. */ * compositor with empty xdg_toplevels. */
if (visible) wayland_surface_make_toplevel(surface); if (visible)
{
wayland_surface_make_toplevel(surface);
if (surface->xdg_toplevel)
{
if (!NtUserInternalGetWindowText(data->hwnd, text, ARRAY_SIZE(text)))
text[0] = 0;
wayland_surface_set_title(surface, text);
}
}
} }
wayland_win_data_get_config(data, &surface->window); wayland_win_data_get_config(data, &surface->window);
...@@ -669,6 +679,22 @@ static enum xdg_toplevel_resize_edge hittest_to_resize_edge(WPARAM hittest) ...@@ -669,6 +679,22 @@ static enum xdg_toplevel_resize_edge hittest_to_resize_edge(WPARAM hittest)
} }
} }
/*****************************************************************
* WAYLAND_SetWindowText
*/
void WAYLAND_SetWindowText(HWND hwnd, LPCWSTR text)
{
struct wayland_surface *surface = wayland_surface_lock_hwnd(hwnd);
TRACE("hwnd=%p text=%s\n", hwnd, wine_dbgstr_w(text));
if (surface)
{
if (surface->xdg_toplevel) wayland_surface_set_title(surface, text);
pthread_mutex_unlock(&surface->mutex);
}
}
/*********************************************************************** /***********************************************************************
* WAYLAND_SysCommand * WAYLAND_SysCommand
*/ */
......
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