more g_ prefix for global vars
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@446 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
e88b67c9ef
commit
24d1be278a
20
rdesktop.c
20
rdesktop.c
@ -45,19 +45,19 @@ char g_username[16];
|
|||||||
char hostname[16];
|
char hostname[16];
|
||||||
char keymapname[16];
|
char keymapname[16];
|
||||||
int keylayout = 0x409; /* Defaults to US keyboard layout */
|
int keylayout = 0x409; /* Defaults to US keyboard layout */
|
||||||
int width = 800; /* If width or height are reset to zero, the geometry will
|
int g_width = 800; /* If width or height are reset to zero, the geometry will
|
||||||
be fetched from _NET_WORKAREA */
|
be fetched from _NET_WORKAREA */
|
||||||
int height = 600;
|
int g_height = 600;
|
||||||
int tcp_port_rdp = TCP_PORT_RDP;
|
int tcp_port_rdp = TCP_PORT_RDP;
|
||||||
int g_server_bpp = 8;
|
int g_server_bpp = 8;
|
||||||
int win_button_size = 0; /* If zero, disable single app mode */
|
int win_button_size = 0; /* If zero, disable single app mode */
|
||||||
BOOL g_bitmap_compression = True;
|
BOOL g_bitmap_compression = True;
|
||||||
BOOL sendmotion = True;
|
BOOL g_sendmotion = True;
|
||||||
BOOL g_orders = True;
|
BOOL g_orders = True;
|
||||||
BOOL g_encryption = True;
|
BOOL g_encryption = True;
|
||||||
BOOL packet_encryption = True;
|
BOOL packet_encryption = True;
|
||||||
BOOL g_desktop_save = True;
|
BOOL g_desktop_save = True;
|
||||||
BOOL fullscreen = False;
|
BOOL g_fullscreen = False;
|
||||||
BOOL grab_keyboard = True;
|
BOOL grab_keyboard = True;
|
||||||
BOOL hide_decorations = False;
|
BOOL hide_decorations = False;
|
||||||
BOOL g_use_rdp5 = False;
|
BOOL g_use_rdp5 = False;
|
||||||
@ -296,15 +296,15 @@ main(int argc, char *argv[])
|
|||||||
case 'g':
|
case 'g':
|
||||||
if (!strcmp(optarg, "workarea"))
|
if (!strcmp(optarg, "workarea"))
|
||||||
{
|
{
|
||||||
width = height = 0;
|
g_width = g_height = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = strtol(optarg, &p, 10);
|
g_width = strtol(optarg, &p, 10);
|
||||||
if (*p == 'x')
|
if (*p == 'x')
|
||||||
height = strtol(p + 1, NULL, 10);
|
g_height = strtol(p + 1, NULL, 10);
|
||||||
|
|
||||||
if ((width == 0) || (height == 0))
|
if ((g_width == 0) || (g_height == 0))
|
||||||
{
|
{
|
||||||
error("invalid geometry\n");
|
error("invalid geometry\n");
|
||||||
return 1;
|
return 1;
|
||||||
@ -312,7 +312,7 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
fullscreen = True;
|
g_fullscreen = True;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
@ -326,7 +326,7 @@ main(int argc, char *argv[])
|
|||||||
packet_encryption = False;
|
packet_encryption = False;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
sendmotion = False;
|
g_sendmotion = False;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
8
secure.c
8
secure.c
@ -34,8 +34,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char hostname[16];
|
extern char hostname[16];
|
||||||
extern int width;
|
extern int g_width;
|
||||||
extern int height;
|
extern int g_height;
|
||||||
extern int keylayout;
|
extern int keylayout;
|
||||||
extern BOOL g_encryption;
|
extern BOOL g_encryption;
|
||||||
extern BOOL g_licence_issued;
|
extern BOOL g_licence_issued;
|
||||||
@ -432,8 +432,8 @@ sec_out_mcs_data(STREAM s)
|
|||||||
out_uint16_le(s, 212); /* length */
|
out_uint16_le(s, 212); /* length */
|
||||||
out_uint16_le(s, g_use_rdp5 ? 4 : 1); /* RDP version. 1 == RDP4, 4 == RDP5. */
|
out_uint16_le(s, g_use_rdp5 ? 4 : 1); /* RDP version. 1 == RDP4, 4 == RDP5. */
|
||||||
out_uint16_le(s, 8);
|
out_uint16_le(s, 8);
|
||||||
out_uint16_le(s, width);
|
out_uint16_le(s, g_width);
|
||||||
out_uint16_le(s, height);
|
out_uint16_le(s, g_height);
|
||||||
out_uint16_le(s, 0xca01);
|
out_uint16_le(s, 0xca01);
|
||||||
out_uint16_le(s, 0xaa03);
|
out_uint16_le(s, 0xaa03);
|
||||||
out_uint32_le(s, keylayout);
|
out_uint32_le(s, keylayout);
|
||||||
|
@ -39,7 +39,7 @@ extern Display *display;
|
|||||||
extern char keymapname[16];
|
extern char keymapname[16];
|
||||||
extern int keylayout;
|
extern int keylayout;
|
||||||
extern int win_button_size;
|
extern int win_button_size;
|
||||||
extern BOOL enable_compose;
|
extern BOOL g_enable_compose;
|
||||||
|
|
||||||
static BOOL keymap_loaded;
|
static BOOL keymap_loaded;
|
||||||
static key_translation keymap[KEYMAP_SIZE];
|
static key_translation keymap[KEYMAP_SIZE];
|
||||||
@ -140,7 +140,7 @@ xkeymap_read(char *mapname)
|
|||||||
if (strncmp(line, "enable_compose", 15) == 0)
|
if (strncmp(line, "enable_compose", 15) == 0)
|
||||||
{
|
{
|
||||||
DEBUG_KBD(("Enabling compose handling\n"));
|
DEBUG_KBD(("Enabling compose handling\n"));
|
||||||
enable_compose = True;
|
g_enable_compose = True;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
92
xwin.c
92
xwin.c
@ -25,18 +25,18 @@
|
|||||||
#include "rdesktop.h"
|
#include "rdesktop.h"
|
||||||
#include "xproto.h"
|
#include "xproto.h"
|
||||||
|
|
||||||
extern int width;
|
extern int g_width;
|
||||||
extern int height;
|
extern int g_height;
|
||||||
extern BOOL sendmotion;
|
extern BOOL g_sendmotion;
|
||||||
extern BOOL fullscreen;
|
extern BOOL g_fullscreen;
|
||||||
extern BOOL grab_keyboard;
|
extern BOOL grab_keyboard;
|
||||||
extern BOOL hide_decorations;
|
extern BOOL hide_decorations;
|
||||||
extern char title[];
|
extern char title[];
|
||||||
extern int g_server_bpp;
|
extern int g_server_bpp;
|
||||||
extern int win_button_size;
|
extern int win_button_size;
|
||||||
BOOL enable_compose = False;
|
BOOL g_enable_compose = False;
|
||||||
BOOL focused;
|
BOOL g_focused;
|
||||||
BOOL mouse_in_wnd;
|
BOOL g_mouse_in_wnd;
|
||||||
|
|
||||||
Display *display;
|
Display *display;
|
||||||
Time last_gesturetime;
|
Time last_gesturetime;
|
||||||
@ -570,46 +570,46 @@ ui_init(void)
|
|||||||
host_be = !(BOOL) (*(uint8 *) (&test));
|
host_be = !(BOOL) (*(uint8 *) (&test));
|
||||||
xserver_be = (ImageByteOrder(display) == MSBFirst);
|
xserver_be = (ImageByteOrder(display) == MSBFirst);
|
||||||
|
|
||||||
if ((width == 0) || (height == 0))
|
if ((g_width == 0) || (g_height == 0))
|
||||||
{
|
{
|
||||||
/* Fetch geometry from _NET_WORKAREA */
|
/* Fetch geometry from _NET_WORKAREA */
|
||||||
uint32 x, y, cx, cy;
|
uint32 x, y, cx, cy;
|
||||||
|
|
||||||
if (get_current_workarea(&x, &y, &cx, &cy) == 0)
|
if (get_current_workarea(&x, &y, &cx, &cy) == 0)
|
||||||
{
|
{
|
||||||
width = cx;
|
g_width = cx;
|
||||||
height = cy;
|
g_height = cy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
warning("Failed to get workarea: probably your window manager does not support extended hints\n");
|
warning("Failed to get workarea: probably your window manager does not support extended hints\n");
|
||||||
width = 800;
|
g_width = 800;
|
||||||
height = 600;
|
g_height = 600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullscreen)
|
if (g_fullscreen)
|
||||||
{
|
{
|
||||||
width = WidthOfScreen(screen);
|
g_width = WidthOfScreen(screen);
|
||||||
height = HeightOfScreen(screen);
|
g_height = HeightOfScreen(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure width is a multiple of 4 */
|
/* make sure width is a multiple of 4 */
|
||||||
width = (width + 3) & ~3;
|
g_width = (g_width + 3) & ~3;
|
||||||
|
|
||||||
if (ownbackstore)
|
if (ownbackstore)
|
||||||
{
|
{
|
||||||
backstore =
|
backstore =
|
||||||
XCreatePixmap(display, RootWindowOfScreen(screen), width, height, depth);
|
XCreatePixmap(display, RootWindowOfScreen(screen), g_width, g_height, depth);
|
||||||
|
|
||||||
/* clear to prevent rubbish being exposed at startup */
|
/* clear to prevent rubbish being exposed at startup */
|
||||||
XSetForeground(display, gc, BlackPixelOfScreen(screen));
|
XSetForeground(display, gc, BlackPixelOfScreen(screen));
|
||||||
XFillRectangle(display, backstore, gc, 0, 0, width, height);
|
XFillRectangle(display, backstore, gc, 0, 0, g_width, g_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
mod_map = XGetModifierMapping(display);
|
mod_map = XGetModifierMapping(display);
|
||||||
|
|
||||||
if (enable_compose)
|
if (g_enable_compose)
|
||||||
IM = XOpenIM(display, NULL, NULL, NULL);
|
IM = XOpenIM(display, NULL, NULL, NULL);
|
||||||
|
|
||||||
xkeymap_init();
|
xkeymap_init();
|
||||||
@ -647,12 +647,12 @@ ui_create_window(void)
|
|||||||
long input_mask, ic_input_mask;
|
long input_mask, ic_input_mask;
|
||||||
XEvent xevent;
|
XEvent xevent;
|
||||||
|
|
||||||
wndwidth = fullscreen ? WidthOfScreen(screen) : width;
|
wndwidth = g_fullscreen ? WidthOfScreen(screen) : g_width;
|
||||||
wndheight = fullscreen ? HeightOfScreen(screen) : height;
|
wndheight = g_fullscreen ? HeightOfScreen(screen) : g_height;
|
||||||
|
|
||||||
attribs.background_pixel = BlackPixelOfScreen(screen);
|
attribs.background_pixel = BlackPixelOfScreen(screen);
|
||||||
attribs.backing_store = ownbackstore ? NotUseful : Always;
|
attribs.backing_store = ownbackstore ? NotUseful : Always;
|
||||||
attribs.override_redirect = fullscreen;
|
attribs.override_redirect = g_fullscreen;
|
||||||
|
|
||||||
wnd = XCreateWindow(display, RootWindowOfScreen(screen), 0, 0, wndwidth, wndheight,
|
wnd = XCreateWindow(display, RootWindowOfScreen(screen), 0, 0, wndwidth, wndheight,
|
||||||
0, CopyFromParent, InputOutput, CopyFromParent,
|
0, CopyFromParent, InputOutput, CopyFromParent,
|
||||||
@ -675,8 +675,8 @@ ui_create_window(void)
|
|||||||
if (sizehints)
|
if (sizehints)
|
||||||
{
|
{
|
||||||
sizehints->flags = PMinSize | PMaxSize;
|
sizehints->flags = PMinSize | PMaxSize;
|
||||||
sizehints->min_width = sizehints->max_width = width;
|
sizehints->min_width = sizehints->max_width = g_width;
|
||||||
sizehints->min_height = sizehints->max_height = height;
|
sizehints->min_height = sizehints->max_height = g_height;
|
||||||
XSetWMNormalHints(display, wnd, sizehints);
|
XSetWMNormalHints(display, wnd, sizehints);
|
||||||
XFree(sizehints);
|
XFree(sizehints);
|
||||||
}
|
}
|
||||||
@ -684,11 +684,11 @@ ui_create_window(void)
|
|||||||
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||||
VisibilityChangeMask | FocusChangeMask;
|
VisibilityChangeMask | FocusChangeMask;
|
||||||
|
|
||||||
if (sendmotion)
|
if (g_sendmotion)
|
||||||
input_mask |= PointerMotionMask;
|
input_mask |= PointerMotionMask;
|
||||||
if (ownbackstore)
|
if (ownbackstore)
|
||||||
input_mask |= ExposureMask;
|
input_mask |= ExposureMask;
|
||||||
if (fullscreen || grab_keyboard)
|
if (g_fullscreen || grab_keyboard)
|
||||||
input_mask |= EnterWindowMask;
|
input_mask |= EnterWindowMask;
|
||||||
if (grab_keyboard)
|
if (grab_keyboard)
|
||||||
input_mask |= LeaveWindowMask;
|
input_mask |= LeaveWindowMask;
|
||||||
@ -713,8 +713,8 @@ ui_create_window(void)
|
|||||||
}
|
}
|
||||||
while (xevent.type != VisibilityNotify);
|
while (xevent.type != VisibilityNotify);
|
||||||
|
|
||||||
focused = False;
|
g_focused = False;
|
||||||
mouse_in_wnd = False;
|
g_mouse_in_wnd = False;
|
||||||
|
|
||||||
/* handle the WM_DELETE_WINDOW protocol */
|
/* handle the WM_DELETE_WINDOW protocol */
|
||||||
protocol_atom = XInternAtom(display, "WM_PROTOCOLS", True);
|
protocol_atom = XInternAtom(display, "WM_PROTOCOLS", True);
|
||||||
@ -741,19 +741,19 @@ xwin_toggle_fullscreen(void)
|
|||||||
if (!ownbackstore)
|
if (!ownbackstore)
|
||||||
{
|
{
|
||||||
/* need to save contents of window */
|
/* need to save contents of window */
|
||||||
contents = XCreatePixmap(display, wnd, width, height, depth);
|
contents = XCreatePixmap(display, wnd, g_width, g_height, depth);
|
||||||
XCopyArea(display, wnd, contents, gc, 0, 0, width, height, 0, 0);
|
XCopyArea(display, wnd, contents, gc, 0, 0, g_width, g_height, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_destroy_window();
|
ui_destroy_window();
|
||||||
fullscreen = !fullscreen;
|
g_fullscreen = !g_fullscreen;
|
||||||
ui_create_window();
|
ui_create_window();
|
||||||
|
|
||||||
XDefineCursor(display, wnd, current_cursor);
|
XDefineCursor(display, wnd, current_cursor);
|
||||||
|
|
||||||
if (!ownbackstore)
|
if (!ownbackstore)
|
||||||
{
|
{
|
||||||
XCopyArea(display, contents, wnd, gc, 0, 0, width, height, 0, 0);
|
XCopyArea(display, contents, wnd, gc, 0, 0, g_width, g_height, 0, 0);
|
||||||
XFreePixmap(display, contents);
|
XFreePixmap(display, contents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,12 +877,12 @@ xwin_process_events(void)
|
|||||||
|
|
||||||
/* Check from right to left: */
|
/* Check from right to left: */
|
||||||
|
|
||||||
if (xevent.xbutton.x >= width - win_button_size)
|
if (xevent.xbutton.x >= g_width - win_button_size)
|
||||||
{
|
{
|
||||||
/* The close button, continue */
|
/* The close button, continue */
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else if (xevent.xbutton.x >= width - win_button_size * 2)
|
else if (xevent.xbutton.x >= g_width - win_button_size * 2)
|
||||||
{
|
{
|
||||||
/* The maximize/restore button. Do not send to
|
/* The maximize/restore button. Do not send to
|
||||||
server. It might be a good idea to change the
|
server. It might be a good idea to change the
|
||||||
@ -890,7 +890,7 @@ xwin_process_events(void)
|
|||||||
that rdesktop inhibited this click */
|
that rdesktop inhibited this click */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (xevent.xbutton.x >= width - win_button_size * 3)
|
else if (xevent.xbutton.x >= g_width - win_button_size * 3)
|
||||||
{
|
{
|
||||||
/* The minimize button. Iconify window. */
|
/* The minimize button. Iconify window. */
|
||||||
XIconifyWindow(display, wnd,
|
XIconifyWindow(display, wnd,
|
||||||
@ -905,7 +905,7 @@ xwin_process_events(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The title bar. */
|
/* The title bar. */
|
||||||
if ((xevent.type == ButtonPress) && !fullscreen
|
if ((xevent.type == ButtonPress) && !g_fullscreen
|
||||||
&& hide_decorations)
|
&& hide_decorations)
|
||||||
{
|
{
|
||||||
moving_wnd = True;
|
moving_wnd = True;
|
||||||
@ -930,7 +930,7 @@ xwin_process_events(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullscreen && !focused)
|
if (g_fullscreen && !g_focused)
|
||||||
XSetInputFocus(display, wnd, RevertToPointerRoot,
|
XSetInputFocus(display, wnd, RevertToPointerRoot,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
rdp_send_input(time(NULL), RDP_INPUT_MOUSE,
|
rdp_send_input(time(NULL), RDP_INPUT_MOUSE,
|
||||||
@ -940,11 +940,11 @@ xwin_process_events(void)
|
|||||||
case FocusIn:
|
case FocusIn:
|
||||||
if (xevent.xfocus.mode == NotifyGrab)
|
if (xevent.xfocus.mode == NotifyGrab)
|
||||||
break;
|
break;
|
||||||
focused = True;
|
g_focused = True;
|
||||||
XQueryPointer(display, wnd, &wdummy, &wdummy, &dummy, &dummy,
|
XQueryPointer(display, wnd, &wdummy, &wdummy, &dummy, &dummy,
|
||||||
&dummy, &dummy, &state);
|
&dummy, &dummy, &state);
|
||||||
reset_modifier_keys(state);
|
reset_modifier_keys(state);
|
||||||
if (grab_keyboard && mouse_in_wnd)
|
if (grab_keyboard && g_mouse_in_wnd)
|
||||||
XGrabKeyboard(display, wnd, True,
|
XGrabKeyboard(display, wnd, True,
|
||||||
GrabModeAsync, GrabModeAsync, CurrentTime);
|
GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
break;
|
break;
|
||||||
@ -952,7 +952,7 @@ xwin_process_events(void)
|
|||||||
case FocusOut:
|
case FocusOut:
|
||||||
if (xevent.xfocus.mode == NotifyUngrab)
|
if (xevent.xfocus.mode == NotifyUngrab)
|
||||||
break;
|
break;
|
||||||
focused = False;
|
g_focused = False;
|
||||||
if (xevent.xfocus.mode == NotifyWhileGrabbed)
|
if (xevent.xfocus.mode == NotifyWhileGrabbed)
|
||||||
XUngrabKeyboard(display, CurrentTime);
|
XUngrabKeyboard(display, CurrentTime);
|
||||||
break;
|
break;
|
||||||
@ -960,21 +960,21 @@ xwin_process_events(void)
|
|||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
/* we only register for this event when in fullscreen mode */
|
/* we only register for this event when in fullscreen mode */
|
||||||
/* or grab_keyboard */
|
/* or grab_keyboard */
|
||||||
mouse_in_wnd = True;
|
g_mouse_in_wnd = True;
|
||||||
if (fullscreen)
|
if (g_fullscreen)
|
||||||
{
|
{
|
||||||
XSetInputFocus(display, wnd, RevertToPointerRoot,
|
XSetInputFocus(display, wnd, RevertToPointerRoot,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (focused)
|
if (g_focused)
|
||||||
XGrabKeyboard(display, wnd, True,
|
XGrabKeyboard(display, wnd, True,
|
||||||
GrabModeAsync, GrabModeAsync, CurrentTime);
|
GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
/* we only register for this event when grab_keyboard */
|
/* we only register for this event when grab_keyboard */
|
||||||
mouse_in_wnd = False;
|
g_mouse_in_wnd = False;
|
||||||
XUngrabKeyboard(display, CurrentTime);
|
XUngrabKeyboard(display, CurrentTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1371,8 +1371,8 @@ ui_reset_clip(void)
|
|||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = width;
|
rect.width = g_width;
|
||||||
rect.height = height;
|
rect.height = g_height;
|
||||||
XSetClipRectangles(display, gc, 0, 0, &rect, 1, YXBanded);
|
XSetClipRectangles(display, gc, 0, 0, &rect, 1, YXBanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user