Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
030d5c62
Commit
030d5c62
authored
20 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Add stupid little wrapper function to stop atexit() warning.
parent
458e8ae6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/conio/curs_cio.c
+6
-1
6 additions, 1 deletion
src/conio/curs_cio.c
src/conio/mouse.c
+37
-41
37 additions, 41 deletions
src/conio/mouse.c
src/conio/mouse.h
+4
-0
4 additions, 0 deletions
src/conio/mouse.h
with
47 additions
and
42 deletions
src/conio/curs_cio.c
+
6
−
1
View file @
030d5c62
...
...
@@ -606,6 +606,11 @@ void curs_gotoxy(int x, int y)
refresh
();
}
void
call_endwin
(
void
)
{
endwin
();
}
int
curs_initciolib
(
long
inmode
)
{
short
fg
,
bg
,
pair
=
0
;
...
...
@@ -634,7 +639,7 @@ int curs_initciolib(long inmode)
keypad
(
stdscr
,
TRUE
);
scrollok
(
stdscr
,
FALSE
);
raw
();
atexit
(
endwin
);
atexit
(
call_
endwin
);
/* Set up color pairs */
for
(
bg
=
0
;
bg
<
8
;
bg
++
)
{
...
...
This diff is collapsed.
Click to expand it.
src/conio/mouse.c
+
37
−
41
View file @
030d5c62
...
...
@@ -3,6 +3,18 @@
#include
"mouse.h"
enum
{
MOUSE_NOSTATE
,
MOUSE_SINGLEPRESSED
,
MOUSE_CLICKED
,
MOUSE_DOUBLEPRESSED
,
MOUSE_DOUBLECLICKED
,
MOUSE_TRIPLEPRESSED
,
MOUSE_TRIPLECLICKED
,
MOUSE_QUADPRESSED
,
MOUSE_QUADCLICKED
};
static
pthread_mutex_t
in_mutex
;
static
pthread_mutex_t
out_mutex
;
sem_t
in_sem
;
...
...
@@ -38,19 +50,21 @@ struct curr_event {
}
struct
mouse_state
{
int
buttonstate
;
/* Current state of all buttons */
int
knownbuttonstatemask
;
/* Mask of buttons that have done something since */
*
We
started
watching
...
the
rest
are
actually
in
*
an
unknown
state
*/
int
curx
;
/* Current X position */
int
cury
;
/* Current Y position */
int
events
;
/* Currently enabled events */
int
click_timeout
;
/* Timeout between press and release events for a click (ms) */
int
multi_timeout
;
/* Timeout after a click for detection of multi clicks (ms) */
int
click_drift
;
/* Allowed "drift" during a click event */
struct
in_mouse_event
*
events_in
;
/* Pointer to recevied events stack */
int
buttonstate
;
/* Current state of all buttons - bitmap */
int
knownbuttonstatemask
;
/* Mask of buttons that have done something since
* We started watching... the rest are actually in
* an unknown state */
int
button_states
[
3
];
/* Expanded state of each button */
int
button_x
[
3
];
/* Start X/Y position of the current state */
int
button_y
[
3
];
int
curx
;
/* Current X position */
int
cury
;
/* Current Y position */
int
events
;
/* Currently enabled events */
int
click_timeout
;
/* Timeout between press and release events for a click (ms) */
int
multi_timeout
;
/* Timeout after a click for detection of multi clicks (ms) */
int
click_drift
;
/* Allowed "drift" during a click event */
struct
in_mouse_event
*
events_in
;
/* Pointer to recevied events stack */
struct
out_mouse_event
*
events_out
;
/* Pointer to output events stack */
struct
curr_event
pending
[
3
];
/* Per-button pending events */
};
struct
mouse_state
state
;
...
...
@@ -144,6 +158,7 @@ static void ciolib_mouse_thread(void *data)
int
use_timeout
=
0
;
struct
timespec
timeout
;
init_mouse
();
struct
in_mouse_event
*
old_in_event
;
while
(
1
)
{
if
(
use_timeout
)
...
...
@@ -152,35 +167,16 @@ static void ciolib_mouse_thread(void *data)
sem_wait
(
&
in_sem
);
/* Check for a timeout rather than a sem_post() */
switch
(
state
.
events_in
->
event
)
{
case
CIOLIB_MOUSE_MOVE
:
/* Needs to check if currently dragging/clicking/etc */
/* This can result in MULTIPLE events hitting the output */
/* Stack */
break
;
case
CIOLIB_BUTTON_1_PRESS
:
/* Currently processing a B1 event? */
break
;
case
CIOLIB_BUTTON_1_RELEASE
:
/* Needs to check if currently dragging/clicking/etc */
break
;
case
CIOLIB_BUTTON_2_PRESS
:
break
;
case
CIOLIB_BUTTON_2_RELEASE
:
/* Needs to check if currently dragging/clicking/etc */
break
;
case
CIOLIB_BUTTON_3_PRESS
:
break
;
case
CIOLIB_BUTTON_3_RELEASE
:
/* Needs to check if currently dragging/clicking/etc */
break
;
if
(
!
validate_pending
(
state
.
events_in
->
event
))
{
add_eventsfor
(
state
.
events_in
->
event
);
}
use_timeout
=
get_timeout
(
&
timeout
);
pthread_mutex_lock
(
&
in_mutex
);
old_in_event
=
state
.
events_in
;
state
.
events_in
=
state
.
events_in
->
nextevent
;
free
(
old_in_event
);
pthread_mutes_unlock
(
&
in_mutex
);
}
}
This diff is collapsed.
Click to expand it.
src/conio/mouse.h
+
4
−
0
View file @
030d5c62
...
...
@@ -58,4 +58,8 @@ enum {
#define CIOLIB_BUTTON_DRAG_MOVE(x) ((x-1)*9+8)
#define CIOLIB_BUTTON_DRAG_END(x) ((x-1)*9+9)
#define CIOLIB_BUTTON_NUMBER(x) ((x-1)/9+1)
#define CIOLIB_BUTTON_BASE(x) (x-9*CIOLIB_BUTTON_NUMBER(x))
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment