Bill Currie
e80344c58e
[qwaq] Use full file path for loading source files
2020-04-04 14:34:18 +09:00
Bill Currie
6291a3c503
[qwaq] Hold the editor filename
...
It may be an ephemeral string.
2020-04-04 14:33:56 +09:00
Bill Currie
63714c7c55
[qwaq] Add builtin to get a file's full path
...
If the file's base directory cannot be found, the file name is returned
as-is.
2020-04-04 12:51:42 +09:00
Bill Currie
686fc4c43e
[qwaq] Guard qwaq_debug_data with a pthread cond
...
I should have realized this would be prone to races.
2020-04-04 12:23:28 +09:00
Bill Currie
9b1ce44fda
[qwaq] Fix some issues with fetching type encodings
...
Now struct defs show FIXME instead of void data.
2020-04-02 19:31:11 +09:00
Bill Currie
63caa5794d
[qwaq] Implement step-over tracing
...
I decided that stopping in between function calls that are on the same
line is a good thing as it gives a chance to skip over the first but
step into the second.
2020-04-02 17:44:53 +09:00
Bill Currie
c09f57c39e
[gamecode] Delay .ctor calls if debugging
...
This allows a debugger to do any symbol lookups and other preparations
between loading progs and the first code execution. .ctors are called as
per normal if debug_handler is not set.
2020-04-02 17:39:11 +09:00
Bill Currie
ea1e85905c
[qwaq] Implement source-level stepping
...
Now the debugger stops only when the source line has changed or the
statement address is stuck.
2020-04-02 13:07:50 +09:00
Bill Currie
7e51f26b10
[qwaq] Move all the def views into a subdirectory
...
More declutter.
2020-04-02 13:06:31 +09:00
Bill Currie
6d8bc395f4
[qwaq] Make debug event data available
2020-04-02 12:30:59 +09:00
Bill Currie
118fba8df5
[qwaq] Cope with functions that don't have locals
...
In this case, .ctor functions.
2020-04-02 00:51:22 +09:00
Bill Currie
1d5058d267
[qwaq] Move progs create and load into the threads
...
While this does answer the question of how I'll go about restarting the
target progs (when I get to that point), it was required just to start
full-on ruamoko progs because .ctor was getting run in the main thread
and blocking due to trace.
2020-04-02 00:11:47 +09:00
Bill Currie
d9668a1185
[qwaq] Silence some more debug
...
I was wondering where those sprintfs were going
2020-04-02 00:11:34 +09:00
Bill Currie
154da7653d
[qwaq] Quote the string value before display
2020-04-01 21:29:42 +09:00
Bill Currie
0e7c7640f4
[qwaq] Right-justify def value display
...
Now that *printf("%*.*s") works :)
2020-04-01 19:57:24 +09:00
Bill Currie
535a2363bb
[ruamoko] Create a va_copy for progs
...
In testing variable fw/precision in PR_Sprintf, I got a nasty reminder
of the limitations of the current progs ABI: passing @args to another QC
function does not work because the args list gets trampled but the
called function's locals. Thus, the need for a va_copy. It's not quite
the same as C's as it returns the destination args instead of copying
like memcpy, but it does copy the list from the source args to a
temporary buffer that is freed when the calling function returns.
2020-04-01 19:48:05 +09:00
Bill Currie
bd7212a411
[qwaq] Pass debug target into the def views
...
Needed for any views that have to fetch additional data (strings,
fields, etc).
2020-04-01 00:03:53 +09:00
Bill Currie
c515d63d97
[qwaq] Get the locals view working
...
All because I forgot I went the unixy way for qdb_get_data.
2020-03-31 23:23:18 +09:00
Bill Currie
beecdcadbf
[qwaq] Support resizing the table view
2020-03-31 22:03:56 +09:00
Bill Currie
0da92e33f6
[qwaq] Use TableView to show locals
...
This is much nicer (even though things aren't quite right yet)
2020-03-31 21:15:57 +09:00
Bill Currie
7ca3dc9db1
[qwaq] Fix some missed retain/release messages
2020-03-31 14:40:22 +09:00
Bill Currie
a1f67b5d6f
[qwaq] Implement a very simple table view class
...
It's nowhere near as sophisticated as NSTableView, but this is text, not
graphics.
2020-03-31 14:40:22 +09:00
Bill Currie
e15f2097df
[qwaq] Move scroll bar management into View
...
Putting it in Editor worked as a proof of concept, but it seems those
always turn out to need tweaking like this because the concept proves
itself to be generally worthwhile :P
2020-03-31 14:28:38 +09:00
Bill Currie
4bc6aab7ec
[qwaq] Resize the scrollbar's draw buffer
2020-03-31 14:28:38 +09:00
Bill Currie
34706906f5
[qwaq] Allow views to be moved/resized without redraw
...
The move is to a specified point and resize to a specified size rather
than a delta.
2020-03-31 14:28:38 +09:00
Bill Currie
17da19b979
[qwaq] Set view owner when setting proxy view
...
This fixes the debug editor's redraw issues.
2020-03-31 01:22:54 +09:00
Bill Currie
5bb71c2089
[qwaq] Clean up some debug prints
2020-03-31 01:18:16 +09:00
Bill Currie
af64e36653
[qwaq] Get the scrollbar working nicely
2020-03-30 23:42:06 +09:00
Bill Currie
655ec3e02b
[qwaq] Set event.when for mouseauto events
2020-03-30 23:41:20 +09:00
Bill Currie
2e1bddb94c
[qwaq] Catch adding bad messages to listeners
...
Better an informative error than a "null function" error.
2020-03-30 22:51:18 +09:00
Bill Currie
1a34f3663a
[qwaq] Hook up the scroll bar
...
It's mostly working now, just some issues with clicking on the bar and
the thumb tab doesn't work.
2020-03-30 22:50:29 +09:00
Bill Currie
b8005a99c9
[qwaq] Add a scroll bar to the debug source window
...
It's not quite hooked up properly yet (Editor ignores the message), but
it did help get ScrollBar displaying properly.
2020-03-30 22:02:58 +09:00
Bill Currie
02f8cc9760
[qwaq] Fix a bunch of issues with the scrollbar
...
Leaking memory. And worse, it wasn't drawing its buttons (group wasn't
setting view contexts) and then the buttons were in the wrong place, so
had to add a backing buffer for the buttons.
2020-03-30 22:01:17 +09:00
Bill Currie
dbbdb31cb1
[qwaq] Add a synchronous printf command
...
This puts a print command (to Sys_Printf) into the queue making it
easier to check command sequences since regular printf is asynchronous
with the stream.
2020-03-30 21:58:06 +09:00
Bill Currie
5bc57518b7
[qwaq] Add a scrollbar view
2020-03-30 20:29:48 +09:00
Bill Currie
101574e697
[qwaq] Pretend to call super init in edit buffer
...
This fixes the early deallocation of the edit buffer.
2020-03-30 16:58:36 +09:00
Bill Currie
8a7fbdfc9f
[qwaq] Rework allocation to use retain/release
...
It currently dies when single stepping or exiting due to EditBuffer's
retain count not getting incremented when initialized. This is because
EditBuffer is initialized in C and thus does not call Object's -init.
2020-03-30 16:58:36 +09:00
Bill Currie
d7df2fa63d
[qwaq] Fix library dependencies
...
Forgot to add them.
2020-03-30 16:27:47 +09:00
Bill Currie
6d3fadfe6e
[qwaq] Move local defs viewer to its own class
...
While trying to build a view without deriving from it was a neat idea,
it doesn't work so well because a view really needs to know how to draw
itself. This even fixes the segfault when stepping past the end of the
program.
2020-03-30 13:42:31 +09:00
Bill Currie
1c13339bbe
[qwaq] Create a type encoding class
...
For now it just manages type encodings via their encoding string,
ensuring types are fetched from the target only once, if at all (may
already have the type due to it being common).
2020-03-30 12:43:02 +09:00
Bill Currie
eccf1cb962
[qwaq] Move the debug builtin bindings
2020-03-30 09:38:22 +09:00
Bill Currie
6ff5b5c101
[qwaq] Clean up the qwaq directory
...
Things were getting rather cluttered with everything being qwaq-* and
all in one directory. Now most have lost the qwaq- prefix and have been
moved into subdirectories (non-recursive make).
2020-03-30 02:34:08 +09:00
Bill Currie
4c5ab07347
[qwaq] Remove obsolete screen class
2020-03-30 00:58:25 +09:00
Bill Currie
8997c81bd1
[qwaq] Implement rectangular region clearing
...
You'd think ncurses would have this, but I guess it's too
window-oriented.
2020-03-28 09:41:54 +09:00
Bill Currie
09d3e1b59f
[qwaq] Remove extern from function prototypes
...
Yay.
2020-03-27 18:17:24 +09:00
Bill Currie
b2de2a9f3b
[qwaq] Display values for simple defs
...
Mostly works, but need to sort out clearing the view without clearing
the window (silly curses and its full-line clears)
2020-03-26 21:01:39 +09:00
Bill Currie
8dcb3fefb3
[qwaq] Offset position when forwardning mvaddstr
2020-03-26 20:31:14 +09:00
Bill Currie
adb7b018d9
[qwaq] Improve focus setting
...
The view is recorded as having focus but is not given focus until the
parent view is actually in focus. This fixes the locals view not having
focus at startup and thus blocking F7.
2020-03-26 18:27:02 +09:00
Bill Currie
b2814700b9
[qwaq] Hook up locals view for events
...
The same debugger method is used because the idea is that all the
window in a group respond to the same commands in general.
2020-03-26 18:25:26 +09:00
Bill Currie
bd8d09479f
[qwaq] Start work on displaying local defs
...
The names show for the first function, but there are problems after
that.
2020-03-26 18:25:26 +09:00
Bill Currie
6ec7b96693
[qwaq] Initialize onEvent
...
sigh
2020-03-26 18:25:26 +09:00
Bill Currie
48f41142f5
[qwaq] Add function to get a string from the target
2020-03-26 18:14:20 +09:00
Bill Currie
90d89e8874
[qwaq] Move onEvent into View
...
In the end, it did make sense since it seems to facilitate MVC nicely.
2020-03-26 17:28:38 +09:00
Bill Currie
91c5283af5
[build] Fix ruamoko/gui's auto dependencies
...
Changing str_free's return type highlighted that I'd missed an edit when
I did the big ruamoko build cleanup.
Also silence the sed/mv noise now that things are working nicely.
2020-03-26 16:53:53 +09:00
Bill Currie
e893421dba
[qwaq] Get context from owner instead of prev view
...
The previous view might be nil, which would result in the new view not
getting a context.
2020-03-26 14:46:48 +09:00
Bill Currie
e018f5cf71
[qwaq] Clean up Editor's event forwarding
...
Much less clunky with that container object. With this, I think it will
be useful moving the forwarding into View. Still unsure on that, though.
2020-03-26 14:16:58 +09:00
Bill Currie
aac732fc63
[qwaq] Support an actual parameter for listeners
2020-03-26 14:16:07 +09:00
Bill Currie
6e74f2a03f
[qwaq] remove @ from externs
...
I had forgotten that extern worked and that @extern was for headers that
might be compiled in traditional or extended modes.
2020-03-26 13:30:33 +09:00
Bill Currie
a28e7417e6
[qwaq] Make traceon and traceoff always available
...
Tired of adding and removing them all the time.
2020-03-26 13:27:53 +09:00
Bill Currie
30b97af65a
[qwaq] Actually send on receive/release focus messages
...
Noticed while tracking down the proxy view switch issue.
2020-03-26 13:21:05 +09:00
Bill Currie
dbb3802740
[qwaq] Transfer context to new view in proxy
...
This fixes the broken source window on file change.
2020-03-26 13:20:10 +09:00
Bill Currie
2d5df34234
[gamecode] Add VM enter/exit events
...
And rename prd_exit to prd_terminate (the idea is the host will
terminate the VM). This makes it possible for the debugger to pause the
VM before any code, even a builtin function, is executed. Breaks the
debugger source window, but only because it's not updating on file
change (I think).
2020-03-26 12:30:32 +09:00
Bill Currie
1bd8e2ee85
[gamecode] Add a param pointer to debug_handler
...
I decided I want events for VM enter/exit but enter needs to somehow
pass the function which will be executed (even if a builtin). A generic
void * param seemed the best idea, which meant the error string could be
passed via the param instead of a "global" string in the progs struct.
2020-03-26 11:44:02 +09:00
Bill Currie
35bb3a3854
[qwaq] Raise windows when clicked
2020-03-26 11:18:00 +09:00
Bill Currie
af0333a172
[qwaq] Ensure super's handleEvent is called
...
This fixes the inability to single-step (debug window couldn't regain
focus).
2020-03-26 11:04:57 +09:00
Bill Currie
1f8301774c
[qwaq] Fix over-consumption of editor events
...
This lets the window scroll again.
2020-03-26 09:19:22 +09:00
Bill Currie
fd73daea4b
[qwaq] Correct mangled params to qwaq_mvwvprintf
2020-03-26 09:11:56 +09:00
Bill Currie
22d173068b
[qwaq] Make a start on a locals viewer
...
It's just a data dump for now. Also, found a bug...
2020-03-26 09:11:39 +09:00
Bill Currie
e579ffcb00
[qwaq] Add functions to get functions by number
2020-03-26 09:03:44 +09:00
Bill Currie
115541877a
[qwaq] Set up an application color palette
...
Nothing special, just all the combinations of the 8 colors
2020-03-26 09:01:39 +09:00
Bill Currie
3ea16c2764
[qwaq] Add support for getting data, defs and functions
...
This will allow for really probing the target progs.
2020-03-25 22:39:17 +09:00
Bill Currie
513bb868fc
[qfcc] Remove unsigned define
...
I had forgotten that qfcc supports the keyword, just not the type yet.
2020-03-25 22:37:38 +09:00
Bill Currie
6f7ddf52ac
[gamecode] Add an exit debug event type
...
The VM never sends it because it cannot know if its exit is program exit
or just sub-program exit, but it's available for host systems to send.
2020-03-25 18:28:28 +09:00
Bill Currie
7b9177ec56
[qwaq] Extract the double-clicked word
...
The plan is to use it for variable lookups etc.
2020-03-25 17:29:08 +09:00
Bill Currie
585b33c111
[qwaq] Close up race-condition hole
...
After a lot of thought, I have come to the conclusion that the weird
crash the other day was caused by a race while the command ring buffer
had just been emptied: the command submission code opened up space for
writing, threads switched, and command processing saw the available data
and pounced on it before the submit code could write valid data. Thus
include the while header in the lock, and move the loop-end release
outside the lock. It may be a little confusing, but it seems to work.
2020-03-25 16:23:36 +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
ee6b078f18
[qwaq] Fix last window drag-resize corner case
...
I think I got distracted by the HoM bug while testing corners. Anyway,
with this, window resize by dragging seems to work well.
2020-03-25 14:45:55 +09:00
Bill Currie
e554202c24
[qwaq] Add combined move and resize method
...
This fixes the hall of mirrors bug (needed to move, resize, then move
the window).
2020-03-25 14:41:40 +09:00
Bill Currie
42f20f200d
[qwaq] Fix window resize bounds logic
...
Have a lot of HoM going on, though :(
2020-03-25 11:18:07 +09:00
Bill Currie
257b658059
[qfcc] Implement single-stepping
...
That... worked nicely. Program exit needs some work because exiting
terminates the thread and the debugger has no clue about it, but I was
able to single-step through gcd.r quite nicely.
2020-03-25 10:00:18 +09:00
Bill Currie
16bd047022
[qwaq] Add a key event listener to Editor
...
This will allow for easy expansion of editor functionality without
messing with the editor itself. In particularly, an editor normally
doesn't need to know anything about debugger hot keys.
2020-03-25 09:41:56 +09:00
Bill Currie
d96059c70e
[qwaq] Change listener respond param to void *
...
Avoids writing another method for Array, so probably only for now.
2020-03-25 09:20:40 +09:00
Bill Currie
9a2ea54e78
[qwaq] Highlight the current line
2020-03-25 08:28:12 +09:00
Bill Currie
1c3e503ad2
[qwaq] Set the window title to the file name
2020-03-25 01:39:56 +09:00
Bill Currie
0d8815f274
[qwaq] Handle debug events at the app level
...
The debugger displays the source file but doesn't highlight the current
line yet.
2020-03-25 01:32:52 +09:00
Bill Currie
c7597b94d2
[qwaq] Create a debugger class
...
Each debugger manages a single target.
2020-03-25 01:07:58 +09:00
Bill Currie
e69c430abc
[qwaq] Clean up QwaqApplication
...
It doesn't need to be fun little tests any more.
2020-03-25 01:06:20 +09:00
Bill Currie
1e56a8efbc
[qwaq] Fix a silly that caused qwaq-app to spawn twice
...
progs_t is very much most definitely NOT thread-safe (ie, two threads
using the same progs_t). It was actually rather funny when I figured out
what was going on to cause qwaq's universe to explode.
2020-03-25 00:44:04 +09:00
Bill Currie
48c65b3363
[qwaq] Move builtin printf to main.c
...
and add traceon/traceoff defs (that don't need PF_Cmds). This lets
gcd.dat load in the second progs thread.
2020-03-25 00:41:14 +09:00
Bill Currie
9bfd14b687
[qwaq] Bring in qc gcd to use for debugger testing
...
It was even recent enough to compile first try.
2020-03-24 23:02:19 +09:00
Bill Currie
fd0700f9ae
[qwaq] Add a proxy view class
...
The idea is that the view can be switched out readily: the proxy simply
passes all messages to its view object.
2020-03-24 21:02:54 +09:00
Bill Currie
05e377c3ac
[qwaq] Make a View protocol
2020-03-24 21:02:26 +09:00
Bill Currie
d73f380ba4
[qwaq] Add -hide to View's interface
...
Missed it somehow.
2020-03-24 21:01:48 +09:00
Bill Currie
32d77eabac
[qwaq] Hook up the debugger modules
...
Now to write all the high level stuff. Wheeeee
2020-03-24 20:15:35 +09:00
Bill Currie
12f7b52fff
[qwaq] Add initial qwaq debugger system
...
It's not hooked up yet, and only very basic functionality is
implemented, but I think this approach will work.
2020-03-24 19:52:35 +09:00
Bill Currie
e56d00f27f
[qwaq] Make qwaq_message_t more useful
...
Couldn't use @param because of its use in gcc as well as qfcc.
2020-03-24 19:52:00 +09:00
Bill Currie
0bbef18786
[qwaq] Make qwaq_add_event public
2020-03-24 19:50:05 +09:00
Bill Currie
60f9f4815a
[qwaq] Make qwaq_cond_init public
2020-03-24 19:48:57 +09:00
Bill Currie
baff891345
[qwaq] Rename cond_t to rwcond_t
2020-03-24 19:48:20 +09:00
Bill Currie
148a351e94
[qwaq] Offset event coords only when positional
...
This fixes pgup/pgdn not working in the editor.
2020-03-24 13:46:26 +09:00
Bill Currie
995074269b
[qwaq] Handle some keys in the editor
...
Doesn't work yet, though.
2020-03-24 13:38:20 +09:00
Bill Currie
a75eeb6955
[qwaq] Remove unnecessary options flag
...
I don't think it will be necessary.
2020-03-24 13:36:54 +09:00
Bill Currie
d022c6c4bd
[qwaq] Disable updateScreenCursor
...
It's wrong for the current hierarchy and corrupts the view's owning
group. Thought is needed for how to proceed with cursor handling.
2020-03-24 13:34:45 +09:00
Bill Currie
77651dbcba
[qwaq] Implement focus handling
...
Sort of works (when not segfaulting due to problem fixed in next
commit).
2020-03-24 13:33:28 +09:00
Bill Currie
47b8f8dd6a
[qwaq] Remove useless protocols
...
The HandleEvent protocols wound up being unnecessary.
2020-03-24 13:27:35 +09:00
Bill Currie
30519e93fb
[qwaq] Move mouse event offsetting to Window
...
This way, Group doesn't need to query its owner's position.
2020-03-23 23:59:54 +09:00
Bill Currie
8707ac0d57
[qwaq] Add a guard to formatLine
...
I got really weird error (invalid panel passed to top_panel) when there
was no such call, so I guess there was some memory corruption.
formatLine is the only suspect, but when I put in the guard, the error
wasn't reproduced (just scrolling through qwaq's makefile in a big
window).
2020-03-23 23:18:02 +09:00
Bill Currie
52722b73c1
[qwaq] Adjust edge window control lengths
...
I'd forgotten them when adjusting the corner control sizes
2020-03-23 23:03:35 +09:00
Bill Currie
622b5f4c45
[qwaq] Fix the handling of overlapping views
...
This even simplifies the logic for mouse enter/leave handling, a nice
bonus.
2020-03-23 22:35:30 +09:00
Bill Currie
8b193c6b6c
[qwaq] Remove some debug prints
2020-03-23 22:28:18 +09:00
Bill Currie
ba3efca8e5
[qwaq] Make the corner window controls 2x2
...
This makes them a little easier to grab but exposes a bug in Group
handleEvent when views partially overlap.
2020-03-23 22:27:08 +09:00
Bill Currie
1479880954
[qwaq] Add window control buttons
...
With this, windows can be resized using any of the corners or the three
sides other than top (top side is move-only, otherwise moving a window
without resizing would be impossible).
2020-03-23 22:10:03 +09:00
Bill Currie
467115429e
[qwaq] Add gfGrowNone and a grow mode setter
...
gfGrowNone is just to allow not growing with the owner to be explicitly
stated.
2020-03-23 22:08:30 +09:00
Bill Currie
731a123b79
[qwaq] Add a title bar
...
The title bar is special in that it is always centered at the top of its
owner, thus it takes no rect.
2020-03-23 22:01:13 +09:00
Bill Currie
19a4efed16
[qwaq] Add support for invisible buttons
...
Useful for window controls.
2020-03-23 22:00:05 +09:00
Bill Currie
afda214487
Adjust some whitespace
2020-03-23 20:18:12 +09:00
Bill Currie
9bc91cd7d1
[qwaq] Implement resizing
...
Terminal resize is detected and the views adjust appropriately (well,
those for which I've set grow flags: the window title bar doesn't adjust
yet).
2020-03-23 20:14:32 +09:00
Bill Currie
1dd05a8ac9
[qwaq] Fix an uninitialized var warning
2020-03-22 23:58:58 +09:00
Bill Currie
bde3124533
[qwaq] Fix some more formatLine cases
...
I think this is all of them. Scrolling around in a file, including
having the end of file visible in the window, seems to work well.
2020-03-22 23:50:27 +09:00
Bill Currie
16c60655e7
[qwaq] Implement scrolling via mouse wheel
...
Line formatting segs when scrolling horizontally through a tab, but...
things ware working nicely.
2020-03-22 22:42:56 +09:00
Bill Currie
8694798943
[qwaq] Fix line formatting for the simple case
...
That is, known to be working for the simple case (no tabs, no horizontal
scroll).
2020-03-22 22:13:35 +09:00
Bill Currie
10adb116ef
[qwaq] Start working on the source view/editor
...
Line formatting is a bit messed up, but other than non-virtual text
being double-counted, things seem to be ok (view only).
2020-03-22 22:03:34 +09:00
Bill Currie
ee9d3a36ab
[qwaq] Add an editor buffer
...
It's a fairly high-level wrapper for TextBuffer in that it implements
file ops (load/save), searching, navigation, and formatting (simple
line-oriented with tab stops (currently at 4 spaces)).
2020-03-22 21:31:30 +09:00
Bill Currie
63a2204fa5
[qwaq] Fix incorrect mouse wheel bits
...
I thought I fixed that already (mistreating mouse 3 as part of the wheel
group).
2020-03-22 14:24:12 +09:00
Bill Currie
f3c68eaada
Implement mouse auto events
...
These are for when a button is held down: good for scroll bar arrows
etc.
2020-03-22 14:06:27 +09:00
Bill Currie
5cdd1931b7
[qwaq] Remove some debug
2020-03-22 13:56:31 +09:00
Bill Currie
50290baf04
[qwaq] Add missing part of commit
2020-03-22 13:54:54 +09:00
Bill Currie
75f38f456b
[qwaq] Fix a linker warning that had been hiding
2020-03-22 13:49:42 +09:00
Bill Currie
fc44582726
[qwaq] Parse function keys
...
While the key escape sequences are xterm-specific, they are only the
default and preliminary provision has been made for overriding them.
However, no override mechanism has been implemented beyond using dynamic
table lookup.
2020-03-22 13:47:44 +09:00
Bill Currie
275ed22362
[qwaq] Actually ensure tv_nsec is valid
...
While typing the previous message I thought to check my "carry" logic.
Sure enough, it was wrong... out by 1. I guess I won the threading
lottery :P
2020-03-22 08:40:51 +09:00
Bill Currie
486728a4bd
[qwaq] Be a little paranoid about cond wait timeouts
...
I'd left qwaq-curses running overnight and found it locked up: both
threads were looping because pthread_cond_timedwait was returning
EINVAL. Thus bail if anything other than 0 is returned, and try to
ensure tv_nsec is in the range 0..999999999
2020-03-22 08:35:37 +09:00
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
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
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
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
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
1a7add3f6d
Merge branch 'master' into vulkan
2020-03-20 13:04:41 +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
Bill Currie
23e6b49845
[qwaq] Implement mouse enter/leave events
2020-03-19 15:55:57 +09:00
Bill Currie
3e9977c272
[qwaq] Give up on pass-by-reference for now
...
It's too much hassle to ensure the passed variable isn't a local. It's
just not worth the grief right now.
2020-03-19 15:54:10 +09:00
Bill Currie
db39f7ed3e
[qwaq] Add hover listener to button
...
Forgot about this (very useful for tooltips etc).
2020-03-19 13:57:10 +09:00
Bill Currie
bd3884f6fa
[qwaq] Add a button class
...
It may or may not work just yet, but I think it's the right direction.
2020-03-19 13:52:14 +09:00
Bill Currie
6a18b1dd55
[qwaq] Add function to merge extents
...
It's pretty much the union of two rectangles with the same origin.
2020-03-19 13:51:14 +09:00
Bill Currie
03f87d6f27
[qwaq] Add pos Point alias
2020-03-19 13:50:35 +09:00
Bill Currie
8c3cf83f02
[qwaq] Add Listener and ListenerGroup delegates
...
Simple single parameter (caller) direct messages.
2020-03-19 13:49:27 +09:00
Bill Currie
01835cbd94
[qwaq] Add blitFromBuffer to TextContext protocol
2020-03-19 13:48:48 +09:00
Bill Currie
2f3ca9d9e4
[qwaq] Clean up the hierarchy
...
I think I've finally figured out what I want the core hierarchy to be.
Right now, it's just the two classes: View and Window (derived from
View). Window has a Group, and Group is just a collection of Views that
it manages. QwaqApplication is just an object but like a Window, it has
a Group of views.
View
Window has a Group
Group contains Views
QwaqApplication has a group
More work needs to be done on drawing and event handling, but things are
working again.
2020-03-19 11:32:44 +09:00
Bill Currie
b16093a533
[qwaq] Split out Array(Group) interface
2020-03-19 11:04:02 +09:00
Bill Currie
f6f6b2cba3
[qwaq] Doc the issue number for blit slug
2020-03-18 01:40:58 +09:00
Bill Currie
affadc3d25
[qwaq] Create protocols for DrawBuffer and TextContext
...
Plenty of flaws at the moment (casts to id :/), but the basic idea seems
to be ok.
2020-03-18 01:40:41 +09:00
Bill Currie
e5bc6dd8b6
[qwaq] Split Array(Group) into its own file
2020-03-18 01:12:23 +09:00
Bill Currie
28a8c1fda7
[qwaq] Implement more curses wrappers
2020-03-17 14:05:31 +09:00
Bill Currie
877ad35a82
[qwaq] Rework the hierarchy again
...
It doesn't work right now because View unconditionally sends refresh to
its textContext, but textContext can be a draw buffer which does not
respond to refresh. Still, these changes (notably the assignment chain
in qwaq-group.r really pushed qfcc).
2020-03-14 19:45:07 +09:00
Bill Currie
6001abbfdb
[qwaq] Use the now working compound init more
2020-03-13 10:00:05 +09:00
Bill Currie
45acbddb79
[qwaq] Make DrawBuffer and TextContext sizes available
2020-03-13 03:09:42 +09:00
Bill Currie
1d3c8d8a6c
[qwaq] Sort out mess around placement of getwrect
2020-03-13 03:09:42 +09:00
Bill Currie
d0f21ec2b4
[qwaq] Add -refresh to TextContext
...
This does the right thing in the presence of panels and dealing with
stdscr.
2020-03-13 03:09:42 +09:00
Bill Currie
3defe50be6
[qwaq] Add printf builtin to ease debugging
2020-03-13 02:41:08 +09:00
Bill Currie
7f9a415cbc
[qwaq] Get DrawBuffer and TextContext working
...
Especially blitting whole regions. Partial regions not tested yet.
2020-03-13 02:36:53 +09:00
Bill Currie
ce67d9b202
[qwaq] Flesh out DrawBuffer's methods
2020-03-10 19:27:26 +09:00
Bill Currie
b3850bbc69
[qwaq] Implement blitting from draw buffer to text
...
Sending the data out to curses.
2020-03-10 19:23:51 +09:00
Bill Currie
f91fb4f840
[qwaq] Add an mvwblit_line builtin
...
I had to do my own thing with curses as the function I had planned to
use turned out to be quite different from what I wanted (misread the man
page).
2020-03-10 18:21:06 +09:00
Bill Currie
fb92ee12d6
[qwaq] Set event type to none when no events
...
Fixes the endless looping on the last event.
2020-03-10 03:11:21 +09:00
Bill Currie
f9d798c314
[qwaq] Use forwarding for some text methods
...
refresh won't be in the drawing buffer protocol, and the move commands
need to be offset by the view's position in its window, but it works as
intended.
2020-03-10 02:58:30 +09:00
Bill Currie
e9eab68366
[qwaq] Begin work on local drawing buffers
2020-03-10 02:39:18 +09:00
Bill Currie
0780cca496
[qwaq] Fixed swapped method implementations
...
That was fun
2020-03-08 22:21:15 +09:00
Bill Currie
8fc007648c
[qwaq] Add missed command enum string
2020-03-08 22:20:46 +09:00
Bill Currie
89cf9f9523
[qwaq] Use Sys_Printf for load error messages
...
It gets them into the log file.
2020-03-08 22:19:37 +09:00