winex11: Support the startup notification fd.o spec.

This commit is contained in:
Damjan Jovanovic 2009-01-06 20:59:07 +02:00 committed by Alexandre Julliard
parent d751c2e5c1
commit 3613b15785
5 changed files with 68 additions and 1 deletions

View File

@ -82,6 +82,66 @@ static const char gl_drawable_prop[] = "__wine_x11_gl_drawable";
static const char pixmap_prop[] = "__wine_x11_pixmap";
static const char managed_prop[] = "__wine_x11_managed";
/***********************************************************************
* http://standards.freedesktop.org/startup-notification-spec
*/
static void remove_startup_notification(Display *display, Window window)
{
static LONG startup_notification_removed = 0;
char id[1024];
char message[1024];
int i;
int pos;
XEvent xevent;
const char *src;
int srclen;
if (InterlockedCompareExchange(&startup_notification_removed, 1, 0) != 0)
return;
if (GetEnvironmentVariableA("DESKTOP_STARTUP_ID", id, sizeof(id)) == 0)
return;
SetEnvironmentVariableA("DESKTOP_STARTUP_ID", NULL);
pos = snprintf(message, sizeof(message), "remove: ID=");
message[pos++] = '"';
for (i = 0; id[i] && pos < sizeof(message) - 2; i++)
{
if (id[i] == '"' || id[i] == '\\')
message[pos++] = '\\';
message[pos++] = id[i];
}
message[pos++] = '"';
message[pos++] = '\0';
xevent.xclient.type = ClientMessage;
xevent.xclient.message_type = x11drv_atom(_NET_STARTUP_INFO_BEGIN);
xevent.xclient.display = display;
xevent.xclient.window = window;
xevent.xclient.format = 8;
src = message;
srclen = strlen(src) + 1;
wine_tsx11_lock();
while (srclen > 0)
{
int msglen = srclen;
if (msglen > 20)
msglen = 20;
memset(&xevent.xclient.data.b[0], 0, 20);
memcpy(&xevent.xclient.data.b[0], src, msglen);
src += msglen;
srclen -= msglen;
XSendEvent( display, DefaultRootWindow( display ), False, PropertyChangeMask, &xevent );
xevent.xclient.message_type = x11drv_atom(_NET_STARTUP_INFO);
}
wine_tsx11_unlock();
}
/***********************************************************************
* is_window_managed
*
@ -1099,6 +1159,8 @@ static void map_window( Display *display, struct x11drv_win_data *data, DWORD ne
{
TRACE( "win %p/%lx\n", data->hwnd, data->whole_window );
remove_startup_notification( display, data->whole_window );
wait_for_withdrawn_state( display, data, TRUE );
if (!data->embedded)

View File

@ -595,6 +595,8 @@ enum x11drv_atoms
XATOM_DndSelection,
XATOM__ICC_PROFILE,
XATOM__MOTIF_WM_HINTS,
XATOM__NET_STARTUP_INFO_BEGIN,
XATOM__NET_STARTUP_INFO,
XATOM__NET_SUPPORTED,
XATOM__NET_SYSTEM_TRAY_OPCODE,
XATOM__NET_SYSTEM_TRAY_S0,

View File

@ -132,6 +132,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
"DndSelection",
"_ICC_PROFILE",
"_MOTIF_WM_HINTS",
"_NET_STARTUP_INFO_BEGIN",
"_NET_STARTUP_INFO",
"_NET_SUPPORTED",
"_NET_SYSTEM_TRAY_OPCODE",
"_NET_SYSTEM_TRAY_S0",

View File

@ -804,7 +804,7 @@ static BOOL write_desktop_entry(const char *location, const char *linkname, cons
fprintf(file, "Exec=env WINEPREFIX=\"%s\" wine \"%s\" %s\n",
wine_get_config_dir(), path, args);
fprintf(file, "Type=Application\n");
fprintf(file, "StartupWMClass=Wine\n");
fprintf(file, "StartupNotify=true\n");
if (descr && lstrlenA(descr))
fprintf(file, "Comment=%s\n", descr);
if (workdir && lstrlenA(workdir))

View File

@ -18,3 +18,4 @@ Name[nn]=Wine Programlaster for Windowsapplikasjoner
Exec=wine start /unix %f
MimeType=application/x-ms-dos-executable;application/x-msdos-program;application/x-msdownload;application/exe;application/x-exe;application/dos-exe;vms/exe;application/x-winexe;application/msdos-windows;application/x-zip-compressed;application/x-executable;application/x-msi;
NoDisplay=true
StartupNotify=true