Applied WM-kill patch from Matthew Riechers (slightly modified
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@274 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
0990f7d367
commit
aa8d6482b2
2
proto.h
2
proto.h
@ -84,7 +84,7 @@ void ui_deinit(void);
|
|||||||
BOOL ui_create_window(void);
|
BOOL ui_create_window(void);
|
||||||
void ui_destroy_window(void);
|
void ui_destroy_window(void);
|
||||||
void xwin_toggle_fullscreen(void);
|
void xwin_toggle_fullscreen(void);
|
||||||
void ui_select(int rdp_socket);
|
int ui_select(int rdp_socket);
|
||||||
void ui_move_pointer(int x, int y);
|
void ui_move_pointer(int x, int y);
|
||||||
HBITMAP ui_create_bitmap(int width, int height, uint8 * data);
|
HBITMAP ui_create_bitmap(int width, int height, uint8 * data);
|
||||||
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data);
|
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data);
|
||||||
|
4
tcp.c
4
tcp.c
@ -84,7 +84,9 @@ tcp_recv(int length)
|
|||||||
|
|
||||||
while (length > 0)
|
while (length > 0)
|
||||||
{
|
{
|
||||||
ui_select(sock);
|
if (!ui_select(sock))
|
||||||
|
/* User quit */
|
||||||
|
return NULL;
|
||||||
|
|
||||||
rcvd = recv(sock, in.end, length, 0);
|
rcvd = recv(sock, in.end, length, 0);
|
||||||
if (rcvd == -1)
|
if (rcvd == -1)
|
||||||
|
30
xwin.c
30
xwin.c
@ -47,6 +47,7 @@ static XIM IM;
|
|||||||
static XIC IC;
|
static XIC IC;
|
||||||
static XModifierKeymap *mod_map;
|
static XModifierKeymap *mod_map;
|
||||||
static Cursor current_cursor;
|
static Cursor current_cursor;
|
||||||
|
static Atom protocol_atom, kill_atom;
|
||||||
|
|
||||||
/* endianness */
|
/* endianness */
|
||||||
static BOOL host_be;
|
static BOOL host_be;
|
||||||
@ -436,6 +437,11 @@ ui_create_window(void)
|
|||||||
focused = False;
|
focused = False;
|
||||||
mouse_in_wnd = False;
|
mouse_in_wnd = False;
|
||||||
|
|
||||||
|
/* handle the WM_DELETE_WINDOW protocol */
|
||||||
|
protocol_atom = XInternAtom(display, "WM_PROTOCOLS", True);
|
||||||
|
kill_atom = XInternAtom(display, "WM_DELETE_WINDOW", True);
|
||||||
|
XSetWMProtocols(display, wnd, &kill_atom, 1);
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,8 +479,9 @@ xwin_toggle_fullscreen(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process all events in Xlib queue */
|
/* Process all events in Xlib queue
|
||||||
static void
|
Returns 0 after user quit, 1 otherwise */
|
||||||
|
static int
|
||||||
xwin_process_events(void)
|
xwin_process_events(void)
|
||||||
{
|
{
|
||||||
XEvent xevent;
|
XEvent xevent;
|
||||||
@ -502,6 +509,14 @@ xwin_process_events(void)
|
|||||||
|
|
||||||
switch (xevent.type)
|
switch (xevent.type)
|
||||||
{
|
{
|
||||||
|
case ClientMessage:
|
||||||
|
/* the window manager told us to quit */
|
||||||
|
if ((xevent.xclient.message_type == protocol_atom)
|
||||||
|
&& (xevent.xclient.data.l[0] == kill_atom))
|
||||||
|
/* Quit */
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
if (IC != NULL)
|
if (IC != NULL)
|
||||||
/* Multi_key compatible version */
|
/* Multi_key compatible version */
|
||||||
@ -645,9 +660,12 @@ xwin_process_events(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Keep going */
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/* Returns 0 after user quit, 1 otherwise */
|
||||||
|
int
|
||||||
ui_select(int rdp_socket)
|
ui_select(int rdp_socket)
|
||||||
{
|
{
|
||||||
int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;
|
int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;
|
||||||
@ -658,7 +676,9 @@ ui_select(int rdp_socket)
|
|||||||
while (True)
|
while (True)
|
||||||
{
|
{
|
||||||
/* Process any events already waiting */
|
/* Process any events already waiting */
|
||||||
xwin_process_events();
|
if (!xwin_process_events())
|
||||||
|
/* User quit */
|
||||||
|
return 0;
|
||||||
|
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(rdp_socket, &rfds);
|
FD_SET(rdp_socket, &rfds);
|
||||||
@ -674,7 +694,7 @@ ui_select(int rdp_socket)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET(rdp_socket, &rfds))
|
if (FD_ISSET(rdp_socket, &rfds))
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user