Commit graph

700 commits

Author SHA1 Message Date
Bill Currie
6dc90c5497 [x11] Remove key focus and destination handling
I'm undecided on how to handle application focus (probably gain/lose
events), and the destination handler has been a stub for a while. One less
dependency on the "old" key handling code.
2021-11-05 14:56:27 +09:00
Bill Currie
31c1eae1ec [x11] Send key events for pasted text
I'm undecided if the pasted text should be sent as a string rather than
individual key events, but this will do the job for now as it gets me
closer to being able to test everything.
2021-11-05 14:54:33 +09:00
Bill Currie
0c8fbf0ce4 [x11] Don't use select for checking for events
It seems that under certain circumstances (window managers?), select is not
reliable for getting key events, so use of select has been disabled until I
figure out what's going on and how to fix it.
2021-11-05 13:30:01 +09:00
Bill Currie
63f5c738ca [x11] Send cooked keyboard and mouse events
For the mouse in x11, I'm not sure which is more cooked: deltas or
window-relative coordinates, but I don't imagine that really matters too
much. However, keyboard and mouse events suitable for 2D user interfaces
are sent at the same time as the more game oriented button and axis events.
2021-11-05 13:26:44 +09:00
Bill Currie
0a885fe704 [x11] Rename x11 input devices to core
The x11 keyboard and mouse devices are really core input devices rather
than x11 input devices in that keyboard and mouse will be present on most
systems and thus not specific to the main user interface (x11, windows,
etc).
2021-11-05 10:02:21 +09:00
Bill Currie
af56e9242b [x11] Clean up duplicate code in software updates
The actual x11 update code was identical between all versions, so it was
moved into the one function.
2021-11-03 22:22:37 +09:00
Bill Currie
16d1232b91 [x11] Connect the X11 input driver to input events
Now nothing works at all ;) However, that's only because the binding
system is incomplete: the X11 input events are getting through to the
binding system, so now it's just a matter of getting that to work.
2021-11-03 22:20:17 +09:00
Bill Currie
665790f562 [video] Remove libQFjs
It is now redundant with the libQFinput, though nothing actually works yet.
2021-11-01 12:30:45 +09:00
Bill Currie
c6a073c1f3 [win] Hook up windows input
Not sure it actually works yet (can't test right now), but since the x11
switch-over worked, it should.
2021-09-28 12:48:47 +09:00
Bill Currie
cacf0be7f6 [util] Wrap fd_set
While select itself is reasonably portable, it turns out that including
the declaration for fd_set makes a bit of a mess for QF's clean headers.
2021-09-28 10:53:51 +09:00
Bill Currie
29f8ed388e [x11] Clean up some formatting 2021-09-27 19:54:08 +09:00
Bill Currie
9732952709 [x11] Use select for checking input
It seems that there's always some incoming event anyway (possibly due to
the constant screen updates) so it doesn't make much difference
currently.
2021-09-27 11:24:35 +09:00
Bill Currie
b39b6031e8 [input] Give input drivers a private data pointer
The pointer can be updated at any time using the driver handle (returned
by IN_RegisterData).
2021-08-30 09:54:36 +09:00
Bill Currie
a91dac60d9 [input] Start work on improved input system
The common input code (input outer loop and event handling) has been
moved into libQFinput, and modified to have the concept of input drivers
that are registered by the appropriate system-level code (x11, win,
etc).

As well, my evdev input library code (with hotplug support) has been
added, but is not yet fully functional. However, the idea is that it
will be available on all systems that support evdev (Linux, and from
what I've read, FreeBSD).
2021-08-27 09:10:21 +09:00
Bill Currie
c81f2d4b52 [video] Mark dga funcs as const when dga not available
Fixes a compile issue (warning about attribute const) when dga is not
available, thanks to spiritiit for finding it :)
2021-08-11 12:09:07 +09:00
Bill Currie
ec54c54226 [build] Fix some windows bitrot 2021-08-02 14:02:41 +09:00
Bill Currie
3b586fc0a6 [console] Untangle console and menu toggling
The recent changes to key handling broke using escape to get out of the
console (escape would toggle between console and menu). Thus take care
of the menu (escape) part of the coupling FIXME by implementing a
callback for the escape key (and removing key_togglemenu) and sorting
out the escape key handling in console. Seems to work nicely
2021-07-23 02:28:37 +09:00
Bill Currie
12450fe6b8 [vid] Remove redundant direct, conbuffer and conrowbytes 2021-07-11 13:44:00 +09:00
Bill Currie
6db6f8f0e2 [win] Fix a pile of bitrot
Man, those bits rot quickly. Must be stored with a rotfish.
2021-07-11 13:30:52 +09:00
Bill Currie
a05210d864 [video] Get 16 and 32 bit sw32 mostly working in x11
Lighting on alias models seems to be borked, and skies are borked in
both sw renderers (seems to be nothing to do with this commit, though).
2021-07-11 00:09:41 +09:00
Bill Currie
755ef524e4 [video] Use views instead of conwidth and conheight
conwidth and conheight have been moved into vid.conview (probably change
the name at some time), and scr_vrect has been replaced by a view as
well. This makes it much easier to create 2d elements that follow the
screen size (taking advantage of a view's gravity) which will, in the
end, make changing the window size easier.
2021-07-10 18:04:34 +09:00
Bill Currie
e81d690b51 [input] Create QF input library using keys.c
This refactors (as such) keys.c so that it no longer depends on console
or gib, and pulls keys out of video targets. The eventual plan is to
move all high-level general input handling into libQFinput, and probably
low-level (eg, /dev/input handling for joysticks etc on Linux).

Fixes #8
2021-07-05 16:26:07 +09:00
Bill Currie
37d35811e3 [vid,render] Clean up fov and aspect
vid.aspect is removed (for now) as it was not really the right idea (I
really didn't know what I was doing at the time). Nicely, this *almost*
fixes the fov bug on fresh installs: the view is now properly
upside-down rather than just flipped vertically (ie, it's now rotated
180 degrees).
2021-04-01 19:17:19 +09:00
Bill Currie
f13af65b32 [vulkan] Move viewport and scissor into vulkan_ctx
Not only does it makes sense to centralize the setting of viewport and
scissor, but it's actually necessary in order to fix the upside-down
rendering on windows.
2021-04-01 11:44:30 +09:00
Bill Currie
92859b7c2e [input] Set up default bindings for other imts
Now ` and F10 work by default in all contexts.
2021-03-31 17:52:47 +09:00
Bill Currie
bc785ab2c2 [input] Make unbindall less aggressive
As it is a legacy command, it should affect only the legacy bindings
(imt_drop_all is available for aggressively unbinding all keys).
2021-03-31 17:49:26 +09:00
Bill Currie
55d3193b5f [vid] Set pixel format for OpenGL
This gets the GL and GLSL renderers working for the -win targets... sort
of: they are upside down and GLSL's bsp surfaces are black (same as
Vulkan). However, with this, all 5 renderers at least limp along for
-win, 4/5 work for -sdl.
2021-03-31 16:25:19 +09:00
Bill Currie
6f56f98714 [vid] Make windows vid init conform to QF's method
Ie, respecting cvars.
2021-03-31 15:50:10 +09:00
Bill Currie
8e363d424f [vid] Remove redundant call to VID_InitBuffers 2021-03-31 15:11:31 +09:00
Bill Currie
38e7a63cef [vid] Clean up sdl some more
Ugh, its fullscreen is annoying, but later.
2021-03-31 15:10:51 +09:00
Bill Currie
3eb28000de [vid] Clean up windows video code a bit
It turns out the dd and dib "driver" code is very specific to the
software renderer. This does not fix the segfault on changing video
mode, but I do know where the problem lies: the window is being
destroyed and recreated without recreating the buffers. I suspect a
clean solution to this will allow for window resizing in X as well.
2021-03-31 15:10:35 +09:00
Bill Currie
8ec781a434 [vid] Fix some naming inconsistencies 2021-03-31 13:05:50 +09:00
Bill Currie
81a837da0f [win] Clean up a pile of messy externs 2021-03-31 10:36:30 +09:00
Bill Currie
596cd164a3 [win] Handle focus in/out events
This fixes the errant console behavior (cursor wasn't showing because QF
thought it had never received focus).
2021-03-31 02:48:25 +09:00
Bill Currie
63e30e6ae0 [win] Fix a handful of small bugs for windows
Only 64-bit windows is tested, and there are still various failures, but
QF is limping along in windows again.

nq-sdl works for sw, and sw32, gl and glsl are mostly black (but not
entirely for gl?),  vulkan is not supported with sdl.

nq-win works for sw and sw32, and sort of for vulkan (very dark and
upside-down?). gl and glsl complain about vid mode,

qw-client-[sdl,win] seem to be the same, but something is wrong with the
console (reading keyboard input).
2021-03-30 20:19:20 +09:00
Bill Currie
dac9166339 [nq] Sort out some of the issues with keydest
Switches to "game" properly when starting a new game after playing
menus. Of course, basic bindings are still broken in "demo".
2021-03-29 22:39:43 +09:00
Bill Currie
5f93c115ff [util] Make developer flag names easier to manage
They're now an enum, and the flag part of the name is all lowercase, but
now the flag definitions and names list will never get out of sync.
2021-03-29 22:38:47 +09:00
Bill Currie
2e1f3cda89 [vulkan] Flesh out known required windows functions
It looks like choosing a visual is not necessary (at least for normal
apps, VR might be another matter). Still no idea if anything works (for
-win support in general, let alone vulkan).
2021-03-29 12:03:07 +09:00
Bill Currie
88ff254f42 Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
2021-03-27 20:09:37 +09:00
Bill Currie
a9bd436837 [build] Autoconfiscate printf format attribute
I don't know if gnu_printf is appropriate for all cases, but it is
needed for mingw32.
2021-03-27 19:52:59 +09:00
Bill Currie
a32e2319e2 Merge branch 'master' into win-merge 2021-03-25 22:42:16 +09:00
Bill Currie
cc4167668c Fix a pile of leaks and uninit errors
Still "some" more to go: a pile to do with transforms and temporary
entities, and a nasty one with host_cbuf. There's also all the static
block-alloc lists :/
2021-03-21 19:56:17 +09:00
Bill Currie
7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +09:00
Bill Currie
f523f6ba80 [vid] Disable X11 repeat control
For now, at least. It is a royal pain in the neck when doing a lot of
development work and I'm not sure it's worthwhile on modern CPUs.
2021-01-30 14:49:42 +09:00
Bill Currie
145e7478a7 [vid] Create a 32-bit version of the palette
The 32-bit palette includes the alpha channel, with color 255's alpha
set to 0.
2021-01-23 23:56:33 +09:00
Bill Currie
86b5b30b45 Merge branch 'master' into vulkan 2020-06-25 14:03:52 +09:00
Bill Currie
6d5ffa9f8e [build] Move to non-recursive make
There's still some cleanup to do, but everything seems to be working
nicely: `make -j` works, `make distcheck` passes. There is probably
plenty of bitrot in the package directories (RPM, debian), though.

The vc project files have been removed since those versions are way out
of date and quakeforge is pretty much dependent on gcc now anyway.

Most of the old Makefile.am files  are now Makemodule.am.  This should
allow for new Makefile.am files that allow local building (to be added
on an as-needed bases).  The current remaining Makefile.am files are for
standalone sub-projects.a

The installable bins are currently built in the top-level build
directory. This may change if the clutter gets to be too much.

While this does make a noticeable difference in build times, the main
reason for the switch was to take care of the growing dependency issues:
now it's possible to build tools for code generation (eg, using qfcc and
ruamoko programs for code-gen).
2020-06-25 11:35:37 +09:00
Bill Currie
4cef9792f4 [util] Make hash-tables semi-thread-safe
They take a pointer to a free-list used for hashlinks so the hashlink
pools can be per-thread. However, hash tables that are not updated are
always thread-safe, so this affects only updates. progs_t has been set
up such that it is easy for multiple progs within one thread can share
hashlinks.
2020-03-25 15:43:16 +09:00
Bill Currie
28f50d2719 Add function key defs up to F48
This allows for the four combinations of shift and control. Not
bothering with alt because alt-f4 closes my xterm (bbkeys from the looks
of it: it grabs a bunch of Mod1-* keys).
2020-03-22 13:46:27 +09:00
Bill Currie
1a7add3f6d Merge branch 'master' into vulkan 2020-03-20 13:04:41 +09:00