* key.c [HAVE_TEXTMODE_X11_SUPPORT]: Rename `display' to

`x11_display' and `w' to `x11_window'. Make them static.
(init_textmode_x11_support): Include into init_key().
(done_textmode_x11_support): Include into done_key().
(k_dispose): Make static.
(s_dispose): Likewise.
* key.h: Remove init_textmode_x11_support() and
done_textmode_x11_support().
* main.c: Don't call init_textmode_x11_support() and
done_textmode_x11_support().
This commit is contained in:
Pavel Roskin 2001-06-05 22:08:31 +00:00
parent 7b340a2af9
commit 72db8e927d
4 changed files with 29 additions and 39 deletions

View File

@ -1,5 +1,16 @@
2001-06-05 Pavel Roskin <proski@gnu.org> 2001-06-05 Pavel Roskin <proski@gnu.org>
* key.c [HAVE_TEXTMODE_X11_SUPPORT]: Rename `display' to
`x11_display' and `w' to `x11_window'. Make them static.
(init_textmode_x11_support): Include into init_key().
(done_textmode_x11_support): Include into done_key().
(k_dispose): Make static.
(s_dispose): Likewise.
* key.h: Remove init_textmode_x11_support() and
done_textmode_x11_support().
* main.c: Don't call init_textmode_x11_support() and
done_textmode_x11_support().
* achown.c: Make global variables static if possible. Remove now * achown.c: Make global variables static if possible. Remove now
useless preprocessor directives, since this file is now used in useless preprocessor directives, since this file is now used in
the text edition only. the text edition only.

View File

@ -223,17 +223,9 @@ define_sequences (key_define_t *kd)
} }
#ifdef HAVE_TEXTMODE_X11_SUPPORT #ifdef HAVE_TEXTMODE_X11_SUPPORT
Display *display; static Display *x11_display;
Window w; static Window x11_window;
#endif /* HAVE_TEXTMODE_X11_SUPPORT */
void
init_textmode_x11_support (void)
{
display = XOpenDisplay (0);
if (display)
w = DefaultRootWindow (display);
}
#endif
/* This has to be called before slang_init or whatever routine /* This has to be called before slang_init or whatever routine
calls any define_sequence */ calls any define_sequence */
@ -272,6 +264,12 @@ void init_key (void)
use_8th_bit_as_meta = 0; use_8th_bit_as_meta = 0;
} }
#endif /* __QNX__ */ #endif /* __QNX__ */
#ifdef HAVE_TEXTMODE_X11_SUPPORT
x11_display = XOpenDisplay (0);
if (x11_display)
x11_window = DefaultRootWindow (x11_display);
#endif /* HAVE_TEXTMODE_X11_SUPPORT */
} }
/* This has to be called after SLang_init_tty/slint_init */ /* This has to be called after SLang_init_tty/slint_init */
@ -943,7 +941,7 @@ int
get_modifier (void) get_modifier (void)
{ {
#ifdef HAVE_TEXTMODE_X11_SUPPORT #ifdef HAVE_TEXTMODE_X11_SUPPORT
if (display) { if (x11_display) {
Window root, child; Window root, child;
int root_x, root_y; int root_x, root_y;
int win_x, win_y; int win_x, win_y;
@ -951,7 +949,7 @@ get_modifier (void)
Bool b; Bool b;
int result = 0; int result = 0;
b = XQueryPointer(display, w, &root, &child, b = XQueryPointer(x11_display, x11_window, &root, &child,
&root_x, &root_y, &root_x, &root_y,
&win_x, &win_y, &win_x, &win_y,
&mask); &mask);
@ -990,8 +988,7 @@ ctrl_pressed ()
} }
#ifdef HAVE_MAD #ifdef HAVE_MAD
static void k_dispose (key_def *k)
void k_dispose (key_def *k)
{ {
if (!k) if (!k)
return; return;
@ -1000,7 +997,7 @@ void k_dispose (key_def *k)
g_free (k); g_free (k);
} }
void s_dispose (SelectList *sel) static void s_dispose (SelectList *sel)
{ {
if (!sel) if (!sel)
return; return;
@ -1008,25 +1005,17 @@ void s_dispose (SelectList *sel)
s_dispose (sel->next); s_dispose (sel->next);
g_free (sel); g_free (sel);
} }
#endif /* HAVE_MAD */
void done_key () void done_key ()
{ {
#ifdef HAVE_MAD
k_dispose (keys); k_dispose (keys);
s_dispose (select_list); s_dispose (select_list);
}
#else
void done_key ()
{
}
#endif /* HAVE_MAD */ #endif /* HAVE_MAD */
#ifdef HAVE_TEXTMODE_X11_SUPPORT #ifdef HAVE_TEXTMODE_X11_SUPPORT
void if (x11_display)
done_textmode_x11_support (void) XCloseDisplay (x11_display);
{
if (display)
XCloseDisplay (display);
}
#endif /* HAVE_TEXTMODE_X11_SUPPORT */ #endif /* HAVE_TEXTMODE_X11_SUPPORT */
}

View File

@ -4,8 +4,6 @@
void init_key (void); void init_key (void);
void init_key_input_fd (void); void init_key_input_fd (void);
void done_key (void); void done_key (void);
void init_textmode_x11_support (void);
void done_textmode_x11_support (void);
int get_event (Gpm_Event *event, int redo_event, int block); int get_event (Gpm_Event *event, int redo_event, int block);
int is_idle (void); int is_idle (void);

View File

@ -3051,10 +3051,6 @@ main (int argc, char *argv [])
calls any define_sequence */ calls any define_sequence */
init_key (); init_key ();
#ifdef HAVE_TEXTMODE_X11_SUPPORT
init_textmode_x11_support ();
#endif
handle_args (argc, argv); handle_args (argc, argv);
#endif /* HAVE_X */ #endif /* HAVE_X */
@ -3244,10 +3240,6 @@ main (int argc, char *argv [])
done_key (); done_key ();
#endif #endif
#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X)
done_textmode_x11_support ();
#endif
mad_finalize (__FILE__, __LINE__); mad_finalize (__FILE__, __LINE__);
#ifdef HAVE_X #ifdef HAVE_X
xtoolkit_end (); xtoolkit_end ();