mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-03-10 02:01:57 +00:00
Apply most of Bruce Momjian's BSD/OS 4.2 patches. I didn't include his sound
stoping code because I don't like the way it was done, I'll work on implementing a better version next. * Use of poll() is not standard. I replaced it with usleep(), which I think is more portable. I know linux supports usleep() and all BSD's. Another option would be to use select(), which is much more widely supported than poll(). * Modified in_x11.c to stop sound and turn on keyboard repeat when the Quake window loses focus. It turns them back on/off when the window gains focus. I often play quake and leave the window to do something else, and the lack of repeat and quake sounds were annoying. * Fix the -nomouse option so it still allows keyboard actions. The current code skips keyboard setup when -nomouse is used. * Fix so config.cfg option "confirm_quit" works under X11.
This commit is contained in:
parent
f3f427bf4b
commit
a823912075
5 changed files with 37 additions and 19 deletions
|
@ -84,8 +84,8 @@ AC_CHECK_HEADERS(
|
|||
libc.h limits.h linux/cdrom.h linux/joystick.h linux/soundcard.h \
|
||||
machine/soundcard.h malloc.h math.h mgraph.h mme/mmsystem.h \
|
||||
mme/mme_public.h _mingw.h netdb.h \
|
||||
netinet/in.h pwd.h setjmp.h signal.h stdarg.h stdio.h stdlib.h \
|
||||
string.h strings.h sys/asoundlib.h sys/audioio.h sys/filio.h \
|
||||
netinet/in.h pwd.h rpc/types.h setjmp.h signal.h stdarg.h stdio.h \
|
||||
stdlib.h string.h strings.h sys/asoundlib.h sys/audioio.h sys/filio.h \
|
||||
sys/ioctl.h sys/io.h sys/ipc.h sys/mman.h sys/param.h sys/poll.h \
|
||||
sys/shm.h sys/signal.h sys/socket.h sys/soundcard.h sys/stat.h \
|
||||
sys/time.h sys/types.h sys/wait.h time.h unistd.h vga.h \
|
||||
|
|
|
@ -55,6 +55,9 @@
|
|||
#ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
#endif
|
||||
#ifdef HAVE_RPC_TYPES_H
|
||||
# include <rpc/types.h>
|
||||
#endif
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include <X11/extensions/XShm.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#ifdef HAVE_VIDMODE
|
||||
# include <X11/extensions/xf86vmode.h>
|
||||
|
@ -440,7 +439,7 @@ X11_ForceViewPort (void)
|
|||
if (vidmode_active && vid_fullscreen->int_val) {
|
||||
do {
|
||||
XF86VidModeSetViewPort (x_disp, x_screen, 0, 0);
|
||||
poll (0, 0, 50);
|
||||
usleep (50);
|
||||
XF86VidModeGetViewPort (x_disp, x_screen, &x, &y);
|
||||
} while (x || y);
|
||||
}
|
||||
|
|
|
@ -343,6 +343,17 @@ event_button (XEvent * event)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
event_focusout (XEvent * event)
|
||||
{
|
||||
XAutoRepeatOn (x_disp);
|
||||
}
|
||||
|
||||
static void
|
||||
event_focusin (XEvent * event)
|
||||
{
|
||||
XAutoRepeatOff (x_disp);
|
||||
}
|
||||
|
||||
static void
|
||||
center_pointer (void)
|
||||
|
@ -522,23 +533,22 @@ IN_Init (void)
|
|||
|
||||
JOY_Init ();
|
||||
|
||||
if (COM_CheckParm ("-nomouse"))
|
||||
return;
|
||||
|
||||
dga_avail = VID_CheckDGA (x_disp, NULL, NULL, NULL);
|
||||
if (vid_fullscreen->int_val) {
|
||||
Cvar_Set (_windowed_mouse, "1");
|
||||
_windowed_mouse->flags |= CVAR_ROM;
|
||||
}
|
||||
|
||||
mouse_x = mouse_y = 0.0;
|
||||
mouse_avail = 1;
|
||||
|
||||
X11_AddEvent (KeyPress, &event_key);
|
||||
X11_AddEvent (KeyRelease, &event_key);
|
||||
X11_AddEvent (ButtonPress, &event_button);
|
||||
X11_AddEvent (ButtonRelease, &event_button);
|
||||
X11_AddEvent (MotionNotify, &event_motion);
|
||||
X11_AddEvent (FocusIn, &event_focusin);
|
||||
X11_AddEvent (FocusOut, &event_focusout);
|
||||
|
||||
if (!COM_CheckParm ("-nomouse")) {
|
||||
dga_avail = VID_CheckDGA (x_disp, NULL, NULL, NULL);
|
||||
if (vid_fullscreen->int_val) {
|
||||
Cvar_Set (_windowed_mouse, "1");
|
||||
_windowed_mouse->flags |= CVAR_ROM;
|
||||
}
|
||||
|
||||
X11_AddEvent (ButtonPress, &event_button);
|
||||
X11_AddEvent (ButtonRelease, &event_button);
|
||||
X11_AddEvent (MotionNotify, &event_motion);
|
||||
}
|
||||
|
||||
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "Force view of player to center");
|
||||
}
|
||||
|
|
|
@ -154,6 +154,8 @@ cvar_t *contrast;
|
|||
|
||||
void M_ConfigureNetSubsystem (void);
|
||||
|
||||
extern cvar_t *confirm_quit;
|
||||
|
||||
//=============================================================================
|
||||
/* Support Routines */
|
||||
|
||||
|
@ -997,6 +999,10 @@ M_Menu_Quit_f (void)
|
|||
{
|
||||
if (m_state == m_quit)
|
||||
return;
|
||||
if (!confirm_quit->int_val) {
|
||||
CL_Disconnect ();
|
||||
Sys_Quit ();
|
||||
}
|
||||
wasInMenus = (key_dest == key_menu);
|
||||
key_dest = key_menu;
|
||||
m_quit_prevstate = m_state;
|
||||
|
|
Loading…
Reference in a new issue