Commit graph

10443 commits

Author SHA1 Message Date
Bill Currie
243840daa7 [qwaq] Support sgr mouse reports
Now buttons 12+ work (in theory, I have only 12 so can't test higher),
and button release is no longer ambiguous.
2020-03-22 02:46:15 +09:00
Bill Currie
9ce64a5cfb [build] Fix curses.h header check 2020-03-22 01:14:57 +09:00
Bill Currie
d352749666 [qwaq] Bypass ncurses for input handling
For now, only 1003 mouse mode is supported, and function keys are not
yet supported, but the mouse is much more reliable: no lost events.
2020-03-22 01:00:05 +09:00
Bill Currie
88b4046632 [util] Pass a data pointer to shutdown functions
And clean up the mess.
2020-03-22 00:57:54 +09:00
Bill Currie
176cc7b9c1 [qwaq] Make some improvements to mouse handling
This doesn't fix the problem of lost events: that seems to be inside
ncurses. I've done some investigations, and it seems xterm sends
separate events for motion and pre/release (which have current coords),
in both 1003 and 1006 modes. No idea what ncurses is doing (does it even
handle 1003 properly?), and it requires the use of xterm-1006 for it to
use 1006 mode (which is nice in that it disambiguates button releases
and allows for huge terminals (not that I would use such normally)).
Guess I've got some side-work cut out for me :P
2020-03-21 21:05:34 +09:00
Bill Currie
ae70efcaf5 [qw] Clean up a comment 2020-03-21 16:27:53 +09:00
Bill Currie
fb6883851d [qwaq] Actually unlock the event queue mutex
And now everything works as well threaded as it did unthreaded.
2020-03-21 12:58:07 +09:00
Bill Currie
fb17f8093d [qwaq] Correct some queue test logic
This fixes the wedge during initial setup and drawing, but the program
deadlocks when processing input and there's an event.
2020-03-21 12:58:07 +09:00
Bill Currie
abedb465af [qwaq] Use separate conditions for queue read/write
While writing the code I suspected this would be necessary, but it's
nice to know. Now the window seems to be correctly fetched, but
get_event locks up.
2020-03-21 12:58:07 +09:00
Bill Currie
af137937bd [qwaq] Add missing mutex unlock 2020-03-21 12:58:07 +09:00
Bill Currie
5f887c4773 [qwaq] Fix missed logic conversion 2020-03-21 12:58:07 +09:00
Bill Currie
7beaa567e6 [qwaq] Pass resource data into the thread
Things have come crashing down, but no fire (ie, no deadlocks so far).
2020-03-21 12:58:07 +09:00
Bill Currie
ac3fef6dd8 [qwaq] Fix a harmless typo
Amusing, though... it was cursed (segaulted).
2020-03-21 12:58:07 +09:00
Bill Currie
cf9455293b [qwaq] Start threads for progs and curses
No idea if anything works, probably come crashing down in a flaming pile
of debris.
2020-03-21 12:58:07 +09:00
Bill Currie
6c1a026bf1 [qwaq] Change thread data array to pointers
I realized that with dynamic thread creation the arrays resizing could
cause them to move around in memory which would be bad for anything
holding a pointer to the data, and even using indices wouldn't help that
much as the array would need to be mutex protected.
2020-03-21 12:58:07 +09:00
Bill Currie
f14f2f518a [qwaq] Rename thread_args to thread_data 2020-03-21 12:58:07 +09:00
Bill Currie
93886d6cd7 [qwaq] Use main args non-options as progs files
If none are specified, default to qwaq-app.dat (for now, anyway). For
each progs file, an optional args set can be specified in the same order
(separated by --). Missing sets default to empty, excess sets are
ignored.
2020-03-21 12:58:07 +09:00
Bill Currie
0cc28c8641 [qwaq] Run main thread
And only thread, still, so things lock up still, but they're coming
together.
2020-03-21 12:58:07 +09:00
Bill Currie
4e739f6b36 Use dynamic array element type instead of __auto_type
This allows using 0 for pointer arrays.
2020-03-21 12:58:07 +09:00
Bill Currie
a5f57a8a4c [qwaq] Parse arguments into sets
The sets are separated by --, and the first set is passed to
getopt_long which currently recognizes only --qargs and non-options. The
--qargs options parses out a set (to -- or end of args) that is passed
to the qargs sub-system for standard qf command line parsing. Set 0 is
for the main qwaq application. Any additional sets (excluding --qargs)
will be used to spawn additional threads when that's working.
2020-03-21 12:58:07 +09:00
Bill Currie
9678eba59b Initialize array pointer in dynamic array
Oops. I guess I was using calloc in the vulkan branch.
2020-03-21 12:58:07 +09:00
Bill Currie
52a46f5d5c [qwaq] Use allocate progs instead of static 2020-03-21 12:58:07 +09:00
Bill Currie
74ed057a5f [qwaq] Begin move over to threading
Of course, it currently locks up, but there aren't any other threads as
of yet so the queues starve.
2020-03-21 12:58:07 +09:00
Bill Currie
d2f03e8a64 [util] Fix darray test for gcc purity 2020-03-20 12:59:25 +09:00
Bill Currie
38fc7459e4 Add DARRAY_INIT from the vulkan branch
Couldn't cherry-pick this one as it was a bigger commit.
2020-03-20 12:59:25 +09:00
Bill Currie
2966b035bf Add a fixed-array allocator
Turned out to be very convenient.
2020-03-20 12:59:25 +09:00
Bill Currie
0764df1276 Fix incorrect include protection 2020-03-20 12:59:25 +09:00
Bill Currie
966bd267c5 Add a set of macros for dynamic arrays
Includes docs and test cases.
2020-03-20 12:59:25 +09:00
Bill Currie
298fcbbf70 [qfcc] Add ExitCode support to quake-pascal
gcd now passes :)
2020-03-20 12:59:25 +09:00
Bill Currie
ed03eeb8d2 [qfcc] Resync qc and qp common symbols
Forgot I needed to remove PAS from pascal as well.
2020-03-20 12:59:25 +09:00
Bill Currie
f64038b872 [qfcc] Add gcd.pas to the tests 2020-03-20 12:59:25 +09:00
Bill Currie
ec12941fcb Move the ring buffer macros to their own header
They seem to have proven themselves to be robust.
2020-03-19 23:53:54 +09:00
Bill Currie
65538104bf [qwaq] Tweak listener message names
I didn't like the message:message bit
2020-03-19 23:18:01 +09:00
Bill Currie
ac23156ecd [qwaq] Clamp window motion to owner's bounds 2020-03-19 21:28:55 +09:00
Bill Currie
f329ca83b6 [qwaq] Ensure background color clearing works
Even with 0 for the character, colors should get into the buffer.
2020-03-19 20:41:29 +09:00
Bill Currie
3a28d84c3f [qwaq] Implement window dragging
Other than the stray panel_free, that was surprisingly easy. However, do
need to check that the window can be moved otherwise window pos and
panel pos will get out of sync.
2020-03-19 20:31:59 +09:00
Bill Currie
fe4f831512 [qwaq] Remove a pile of stray panel_free calls
C&P programming FTW :P
2020-03-19 20:31:01 +09:00
Bill Currie
f027a42e72 [qwaq] Treat 0 as transparent character 2020-03-19 19:53:32 +09:00
Bill Currie
14fbdc7df9 [qwaq] Clean up debug in TextContext 2020-03-19 19:35:19 +09:00
Bill Currie
e8d947ed8a [qwaq] Get click and drag reporting working 2020-03-19 19:25:57 +09:00
Bill Currie
95d20d67c7 [qwaq] Implement mouse grabbing
Button will need it for dragging.
2020-03-19 19:00:03 +09:00
Bill Currie
2c20a031e4 [qwaq] Do up a little button test "scene"
Hmm... "scene"... too much Unity?
2020-03-19 18:41:53 +09:00
Bill Currie
cce6837fe8 [qwaq] Offset event mouse coordinates
Each level of the object hierarchy has its own offset relative to the
level above, but mouse coordinates are absolute.
2020-03-19 18:40:21 +09:00
Bill Currie
28a9e041e6 [qwaq] Implement Group redraw 2020-03-19 18:39:11 +09:00
Bill Currie
8bd702ab1a [qwaq] Fetch View origin and size separately 2020-03-19 18:38:24 +09:00
Bill Currie
e49ba896aa [qwaq] Support background and clearing in DrawBuffer 2020-03-19 18:37:25 +09:00
Bill Currie
490f1ad4b8 [qwaq] Add wrappers for werase 2020-03-19 18:37:05 +09:00
Bill Currie
ec2409ceba [qwaq] Mention that Window knows addView 2020-03-19 17:34:29 +09:00
Bill Currie
1306d9fcdd [qwaq] Fix some issues in Listener* 2020-03-19 17:33:47 +09:00
Bill Currie
19161ea80a [qwaq] Clean things up in prep for button testing 2020-03-19 16:27:30 +09:00