xfreerdp: properly handle local Alt+F4 for RemoteApp windows

This commit is contained in:
Marc-André Moreau 2011-09-21 08:36:49 -04:00
parent c750fed989
commit 5207be87f6
5 changed files with 28 additions and 19 deletions

View File

@ -378,16 +378,26 @@ boolean xf_event_MappingNotify(xfInfo* xfi, XEvent* event, boolean app)
boolean xf_event_ClientMessage(xfInfo* xfi, XEvent* event, boolean app)
{
Atom kill_atom;
Atom protocol_atom;
protocol_atom = XInternAtom(xfi->display, "WM_PROTOCOLS", True);
kill_atom = XInternAtom(xfi->display, "WM_DELETE_WINDOW", True);
if ((event->xclient.message_type == protocol_atom)
&& ((Atom) event->xclient.data.l[0] == kill_atom))
if ((event->xclient.message_type == xfi->WM_PROTOCOLS)
&& ((Atom) event->xclient.data.l[0] == xfi->WM_DELETE_WINDOW))
{
return False;
if (app)
{
rdpWindow* window;
window = window_list_get_by_extra_id(xfi->rail->list, (void*) event->xclient.window);
if (window != NULL)
{
xf_rail_send_client_system_command(xfi, window->windowId, SC_CLOSE);
}
return True;
}
else
{
return False;
}
}
return True;

View File

@ -23,15 +23,10 @@
#include "xfreerdp.h"
void xf_rail_paint(xfInfo* xfi, rdpRail* rail, uint32 ileft, uint32 itop, uint32 iright, uint32 ibottom);
void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail);
void xf_rail_send_client_system_command(xfInfo* xfi, uint32 windowId, uint16 command);
void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled);
void xf_rail_send_windowmove(xfInfo* xfi, uint32 windowId, uint32 left, uint32 top, uint32 right, uint32 bottom);
void xf_process_rail_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event);
#endif /* __XF_RAIL_H */

View File

@ -333,6 +333,8 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, xfWindow* parent, int x, int y, int width
xfree(class);
}
XSetWMProtocols(xfi->display, window->handle, &(xfi->WM_DELETE_WINDOW), 1);
input_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
VisibilityChangeMask | FocusChangeMask | StructureNotifyMask |

View File

@ -347,6 +347,9 @@ boolean xf_pre_connect(freerdp* instance)
xfi->_NET_WM_MOVERESIZE = XInternAtom(xfi->display, "_NET_WM_MOVERESIZE", False);
xfi->WM_PROTOCOLS = XInternAtom(xfi->display, "WM_PROTOCOLS", False);
xfi->WM_DELETE_WINDOW = XInternAtom(xfi->display, "WM_DELETE_WINDOW", False);
xf_kbd_init(xfi);
xfi->clrconv = xnew(CLRCONV);
@ -381,8 +384,6 @@ boolean xf_post_connect(freerdp* instance)
xfInfo* xfi;
XEvent xevent;
XGCValues gcv;
Atom kill_atom;
Atom protocol_atom;
xfi = GET_XFI(instance);
SET_XFI(instance->update, xfi);
@ -432,9 +433,7 @@ boolean xf_post_connect(freerdp* instance)
xfi->unobscured = (xevent.xvisibility.state == VisibilityUnobscured);
protocol_atom = XInternAtom(xfi->display, "WM_PROTOCOLS", True);
kill_atom = XInternAtom(xfi->display, "WM_DELETE_WINDOW", True);
XSetWMProtocols(xfi->display, xfi->window->handle, &kill_atom, 1);
XSetWMProtocols(xfi->display, xfi->window->handle, &(xfi->WM_DELETE_WINDOW), 1);
}
memset(&gcv, 0, sizeof(gcv));

View File

@ -111,6 +111,9 @@ struct xf_info
Atom _NET_WM_WINDOW_TYPE_UTILITY;
Atom _NET_WM_MOVERESIZE;
Atom WM_PROTOCOLS;
Atom WM_DELETE_WINDOW;
};
void xf_toggle_fullscreen(xfInfo* xfi);