more g_ prefix for global vars

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@449 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Jay Sorg 2003-08-27 22:51:33 +00:00
parent d097a9e44a
commit fb2ce8bcf4
5 changed files with 325 additions and 325 deletions

View File

@ -24,7 +24,7 @@
#include <X11/Xlib.h>
#include "rdesktop.h"
extern Display *display;
extern Display *g_display;
/*
Get window property value (32 bit format)
@ -40,14 +40,14 @@ get_property_value(char *propname, long max_length,
int actual_format_return;
unsigned long bytes_after_return;
property = XInternAtom(display, propname, True);
property = XInternAtom(g_display, propname, True);
if (property == None)
{
fprintf(stderr, "Atom %s does not exist\n", propname);
return (-1);
}
result = XGetWindowProperty(display, DefaultRootWindow(display), property, 0, /* long_offset */
result = XGetWindowProperty(g_display, DefaultRootWindow(g_display), property, 0, /* long_offset */
max_length, /* long_length */
False, /* delete */
AnyPropertyType, /* req_type */

View File

@ -40,7 +40,7 @@
#include "crypto/md5.h"
#endif
char title[32] = "";
char g_title[32] = "";
char g_username[16];
char hostname[16];
char keymapname[16];
@ -50,7 +50,7 @@ int g_width = 800; /* If width or height are reset to zero, the geometry will
int g_height = 600;
int tcp_port_rdp = TCP_PORT_RDP;
int g_server_bpp = 8;
int win_button_size = 0; /* If zero, disable single app mode */
int g_win_button_size = 0; /* If zero, disable single app mode */
BOOL g_bitmap_compression = True;
BOOL g_sendmotion = True;
BOOL g_orders = True;
@ -58,10 +58,10 @@ BOOL g_encryption = True;
BOOL packet_encryption = True;
BOOL g_desktop_save = True;
BOOL g_fullscreen = False;
BOOL grab_keyboard = True;
BOOL hide_decorations = False;
BOOL g_grab_keyboard = True;
BOOL g_hide_decorations = False;
BOOL g_use_rdp5 = False;
extern BOOL owncolmap;
extern BOOL g_owncolmap;
#ifdef RDP2VNC
extern int rfb_port;
@ -251,11 +251,11 @@ main(int argc, char *argv[])
case 'S':
if (!strcmp(optarg, "standard"))
{
win_button_size = 18;
g_win_button_size = 18;
break;
}
win_button_size = strtol(optarg, &p, 10);
g_win_button_size = strtol(optarg, &p, 10);
if (*p)
{
@ -330,19 +330,19 @@ main(int argc, char *argv[])
break;
case 'C':
owncolmap = True;
g_owncolmap = True;
break;
case 'K':
grab_keyboard = False;
g_grab_keyboard = False;
break;
case 'T':
STRNCPY(title, optarg, sizeof(title));
STRNCPY(g_title, optarg, sizeof(g_title));
break;
case 'D':
hide_decorations = True;
g_hide_decorations = True;
break;
case 'a':
@ -405,10 +405,10 @@ main(int argc, char *argv[])
if (prompt_password && read_password(password, sizeof(password)))
flags |= RDP_LOGON_AUTO;
if (title[0] == 0)
if (g_title[0] == 0)
{
strcpy(title, "rdesktop - ");
strncat(title, server, sizeof(title) - sizeof("rdesktop - "));
strcpy(g_title, "rdesktop - ");
strncat(g_title, server, sizeof(g_title) - sizeof("rdesktop - "));
}
#ifdef RDP2VNC

96
xclip.c
View File

@ -25,9 +25,9 @@
#define NUM_TARGETS 6
extern Display *display;
extern Window wnd;
extern Time last_gesturetime;
extern Display *g_display;
extern Window g_wnd;
extern Time g_last_gesturetime;
static Atom clipboard_atom, primary_atom, targets_atom, timestamp_atom;
static Atom rdesktop_clipboard_target_atom, rdesktop_clipboard_formats_atom, incr_atom;
@ -42,7 +42,7 @@ xclip_provide_selection(XSelectionRequestEvent * req, Atom type, unsigned int fo
{
XEvent xev;
XChangeProperty(display, req->requestor, req->property,
XChangeProperty(g_display, req->requestor, req->property,
type, format, PropModeReplace, data, length);
xev.xselection.type = SelectionNotify;
@ -53,7 +53,7 @@ xclip_provide_selection(XSelectionRequestEvent * req, Atom type, unsigned int fo
xev.xselection.target = req->target;
xev.xselection.property = req->property;
xev.xselection.time = req->time;
XSendEvent(display, req->requestor, False, NoEventMask, &xev);
XSendEvent(g_display, req->requestor, False, NoEventMask, &xev);
}
void
@ -69,15 +69,15 @@ xclip_handle_SelectionNotify(XSelectionEvent * event)
goto fail;
DEBUG_CLIPBOARD(("xclip_handle_SelectionNotify: selection=%s, target=%s, property=%s\n",
XGetAtomName(display, event->selection),
XGetAtomName(display, event->target),
XGetAtomName(display, event->property)));
XGetAtomName(g_display, event->selection),
XGetAtomName(g_display, event->target),
XGetAtomName(g_display, event->property)));
if (event->property == None)
goto fail;
res = XGetWindowProperty(display, wnd, rdesktop_clipboard_target_atom,
0, XMaxRequestSize(display), True, AnyPropertyType,
res = XGetWindowProperty(g_display, g_wnd, rdesktop_clipboard_target_atom,
0, XMaxRequestSize(g_display), True, AnyPropertyType,
&type, &format, &nitems, &bytes_left, &data);
if (res != Success)
@ -93,11 +93,11 @@ xclip_handle_SelectionNotify(XSelectionEvent * event)
if (type != None)
{
supported_targets = (Atom *) data;
text_target = XInternAtom(display, "TEXT", False);
text_target = XInternAtom(g_display, "TEXT", False);
for (i = 0; i < nitems; i++)
{
DEBUG_CLIPBOARD(("Target %d: %s\n", i,
XGetAtomName(display, supported_targets[i])));
XGetAtomName(g_display, supported_targets[i])));
if (supported_targets[i] == text_target)
{
DEBUG_CLIPBOARD(("Other party supports TEXT, choosing that as best_target\n"));
@ -107,8 +107,8 @@ xclip_handle_SelectionNotify(XSelectionEvent * event)
XFree(data);
}
XConvertSelection(display, primary_atom, best_target,
rdesktop_clipboard_target_atom, wnd, event->time);
XConvertSelection(g_display, primary_atom, best_target,
rdesktop_clipboard_target_atom, g_wnd, event->time);
return;
}
@ -138,9 +138,9 @@ xclip_handle_SelectionRequest(XSelectionRequestEvent * event)
Atom type;
DEBUG_CLIPBOARD(("xclip_handle_SelectionRequest: selection=%s, target=%s, property=%s\n",
XGetAtomName(display, event->selection),
XGetAtomName(display, event->target),
XGetAtomName(display, event->property)));
XGetAtomName(g_display, event->selection),
XGetAtomName(g_display, event->target),
XGetAtomName(g_display, event->property)));
if (event->target == targets_atom)
{
@ -149,12 +149,12 @@ xclip_handle_SelectionRequest(XSelectionRequestEvent * event)
}
else if (event->target == timestamp_atom)
{
xclip_provide_selection(event, XA_INTEGER, 32, (uint8 *) & last_gesturetime, 1);
xclip_provide_selection(event, XA_INTEGER, 32, (uint8 *) & g_last_gesturetime, 1);
return;
}
else if (event->target == rdesktop_clipboard_formats_atom)
{
res = XGetWindowProperty(display, event->requestor,
res = XGetWindowProperty(g_display, event->requestor,
rdesktop_clipboard_target_atom, 0, 1, True, XA_INTEGER,
&type, &format, &nitems, &bytes_left,
(unsigned char **) &wanted_format);
@ -175,7 +175,7 @@ xclip_handle_SelectionClear(void)
{
DEBUG_CLIPBOARD(("xclip_handle_SelectionClear\n"));
have_primary = 0;
XDeleteProperty(display, DefaultRootWindow(display), rdesktop_clipboard_formats_atom);
XDeleteProperty(g_display, DefaultRootWindow(g_display), rdesktop_clipboard_formats_atom);
cliprdr_send_text_format_announce();
}
@ -195,9 +195,9 @@ xclip_handle_PropertyNotify(XPropertyEvent * event)
if (event->state == PropertyNewValue)
{
res = XGetWindowProperty(display, DefaultRootWindow(display),
res = XGetWindowProperty(g_display, DefaultRootWindow(g_display),
rdesktop_clipboard_formats_atom, 0,
XMaxRequestSize(display), False, XA_STRING, &type, &format,
XMaxRequestSize(g_display), False, XA_STRING, &type, &format,
&nitems, &bytes_left, &data);
if ((res == Success) && (nitems > 0))
@ -217,20 +217,20 @@ xclip_handle_PropertyNotify(XPropertyEvent * event)
void
ui_clip_format_announce(char *data, uint32 length)
{
XSetSelectionOwner(display, primary_atom, wnd, last_gesturetime);
if (XGetSelectionOwner(display, primary_atom) != wnd)
XSetSelectionOwner(g_display, primary_atom, g_wnd, g_last_gesturetime);
if (XGetSelectionOwner(g_display, primary_atom) != g_wnd)
{
warning("Failed to aquire ownership of PRIMARY clipboard\n");
return;
}
have_primary = 1;
XChangeProperty(display, DefaultRootWindow(display),
XChangeProperty(g_display, DefaultRootWindow(g_display),
rdesktop_clipboard_formats_atom, XA_STRING, 8, PropModeReplace, data,
length);
XSetSelectionOwner(display, clipboard_atom, wnd, last_gesturetime);
if (XGetSelectionOwner(display, clipboard_atom) != wnd)
XSetSelectionOwner(g_display, clipboard_atom, g_wnd, g_last_gesturetime);
if (XGetSelectionOwner(g_display, clipboard_atom) != g_wnd)
warning("Failed to aquire ownership of CLIPBOARD clipboard\n");
}
@ -250,28 +250,28 @@ ui_clip_request_data(uint32 format)
if (rdesktop_is_selection_owner)
{
XChangeProperty(display, wnd, rdesktop_clipboard_target_atom,
XChangeProperty(g_display, g_wnd, rdesktop_clipboard_target_atom,
XA_INTEGER, 32, PropModeReplace, (unsigned char *) &format, 1);
XConvertSelection(display, primary_atom, rdesktop_clipboard_formats_atom,
rdesktop_clipboard_target_atom, wnd, CurrentTime);
XConvertSelection(g_display, primary_atom, rdesktop_clipboard_formats_atom,
rdesktop_clipboard_target_atom, g_wnd, CurrentTime);
return;
}
selectionowner = XGetSelectionOwner(display, primary_atom);
selectionowner = XGetSelectionOwner(g_display, primary_atom);
if (selectionowner != None)
{
XConvertSelection(display, primary_atom, targets_atom,
rdesktop_clipboard_target_atom, wnd, CurrentTime);
XConvertSelection(g_display, primary_atom, targets_atom,
rdesktop_clipboard_target_atom, g_wnd, CurrentTime);
return;
}
/* No PRIMARY, try CLIPBOARD */
selectionowner = XGetSelectionOwner(display, clipboard_atom);
selectionowner = XGetSelectionOwner(g_display, clipboard_atom);
if (selectionowner != None)
{
XConvertSelection(display, clipboard_atom, targets_atom,
rdesktop_clipboard_target_atom, wnd, CurrentTime);
XConvertSelection(g_display, clipboard_atom, targets_atom,
rdesktop_clipboard_target_atom, g_wnd, CurrentTime);
return;
}
@ -292,22 +292,22 @@ xclip_init(void)
if (!cliprdr_init())
return;
primary_atom = XInternAtom(display, "PRIMARY", False);
clipboard_atom = XInternAtom(display, "CLIPBOARD", False);
targets_atom = XInternAtom(display, "TARGETS", False);
timestamp_atom = XInternAtom(display, "TIMESTAMP", False);
rdesktop_clipboard_target_atom = XInternAtom(display, "_RDESKTOP_CLIPBOARD_TARGET", False);
incr_atom = XInternAtom(display, "INCR", False);
primary_atom = XInternAtom(g_display, "PRIMARY", False);
clipboard_atom = XInternAtom(g_display, "CLIPBOARD", False);
targets_atom = XInternAtom(g_display, "TARGETS", False);
timestamp_atom = XInternAtom(g_display, "TIMESTAMP", False);
rdesktop_clipboard_target_atom = XInternAtom(g_display, "_RDESKTOP_CLIPBOARD_TARGET", False);
incr_atom = XInternAtom(g_display, "INCR", False);
targets[0] = targets_atom;
targets[1] = XInternAtom(display, "TEXT", False);
targets[2] = XInternAtom(display, "UTF8_STRING", False);
targets[3] = XInternAtom(display, "text/unicode", False);
targets[4] = XInternAtom(display, "TIMESTAMP", False);
targets[1] = XInternAtom(g_display, "TEXT", False);
targets[2] = XInternAtom(g_display, "UTF8_STRING", False);
targets[3] = XInternAtom(g_display, "text/unicode", False);
targets[4] = XInternAtom(g_display, "TIMESTAMP", False);
targets[5] = XA_STRING;
/* rdesktop sets _RDESKTOP_CLIPBOARD_FORMATS on the root window when acquiring the clipboard.
Other interested rdesktops can use this to notify their server of the available formats. */
rdesktop_clipboard_formats_atom =
XInternAtom(display, "_RDESKTOP_CLIPBOARD_FORMATS", False);
XSelectInput(display, DefaultRootWindow(display), PropertyChangeMask);
XInternAtom(g_display, "_RDESKTOP_CLIPBOARD_FORMATS", False);
XSelectInput(g_display, DefaultRootWindow(g_display), PropertyChangeMask);
}

View File

@ -35,10 +35,10 @@
#define KEYMAP_MASK 0xffff
#define KEYMAP_MAX_LINE_LENGTH 80
extern Display *display;
extern Display *g_display;
extern char keymapname[16];
extern int keylayout;
extern int win_button_size;
extern int g_win_button_size;
extern BOOL g_enable_compose;
static BOOL keymap_loaded;
@ -236,7 +236,7 @@ xkeymap_init(void)
keymap_loaded = True;
}
XDisplayKeycodes(display, &min_keycode, (int *) &max_keycode);
XDisplayKeycodes(g_display, &min_keycode, (int *) &max_keycode);
}
/* Handles, for example, multi-scancode keypresses (which is not
@ -316,7 +316,7 @@ handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, BOOL pres
case XK_space:
/* Prevent access to the Windows system menu in single app mode */
if (win_button_size
if (g_win_button_size
&& (get_key_state(state, XK_Alt_L) || get_key_state(state, XK_Alt_R)))
return True;

512
xwin.c

File diff suppressed because it is too large Load Diff