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
8b113549
Commit
8b113549
authored
20 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Added add_outevent() function to add a mouse event to the output queue.
parent
5d54c91a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/conio/mouse.c
+36
-4
36 additions, 4 deletions
src/conio/mouse.c
src/conio/mouse.h
+1
-0
1 addition, 0 deletions
src/conio/mouse.h
with
37 additions
and
4 deletions
src/conio/mouse.c
+
36
−
4
View file @
8b113549
...
...
@@ -4,7 +4,7 @@
#include
"mouse.h"
static
pthread_mutex_t
in_mutex
;
static
int
in_mutex_initialized
=
0
;
static
pthread_mutex_t
out_mutex
;
sem_t
in_sem
;
struct
in_mouse_event
{
...
...
@@ -39,6 +39,15 @@ struct mouse_state {
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 */
int
b1_currevent
;
/* Event that is currently being processed on button 1 */
int
b1_ce_sx
;
/* Start X for current b1 event */
int
b1_ce_sy
;
/* Start Y for current b1 event */
int
b2_currevent
;
int
b2_ce_sx
;
/* Start X for current b2 event */
int
b2_ce_sy
;
/* Start Y for current b2 event */
int
b3_currevent
;
int
b3_ce_sx
;
/* Start X for current b3 event */
int
b3_ce_sy
;
/* Start Y for current b3 event */
};
struct
mouse_state
state
;
...
...
@@ -55,6 +64,7 @@ void init_mouse(void)
state
.
events_in
=
(
struct
in_mouse_event
*
)
NULL
;
state
.
events_out
=
(
struct
out_mouse_event
*
)
NULL
;
pthread_mutex_init
(
&
in_mutex
,
NULL
);
pthread_mutex_init
(
&
out_mutex
,
NULL
);
sem_init
(
&
in_sem
,
0
,
0
);
}
...
...
@@ -102,6 +112,30 @@ static void ciomouse_gotevent(int event, int x, int y)
sem_post
(
&
in_sem
);
}
static
void
add_outevent
(
int
event
,
int
bstate
,
int
kbsm
,
sx
,
sy
,
ex
,
ey
)
{
struct
out_mouse_event
*
ome
;
struct
out_mouse_event
**
lastevent
;
ome
=
(
struct
out_mouse_event
*
)
malloc
(
sizeof
(
out_mouse_ecent
));
ome
->
event
=
event
;
ome
->
bstate
=
bstate
;
ome
->
kbsm
=
kbsm
;
ome
->
startx
=
sx
;
ome
->
starty
=
sy
;
ome
->
endx
=
ex
;
ome
->
endy
=
ey
;
ome
->
nextevent
=
(
struct
out_mouse_event
*
)
NULL
;
pthread_mutex_lock
(
&
out_mutex
);
for
(
lastevent
=&
state
.
events_out
;
*
lastevent
!=
NULL
;
lastevent
=&
(
lastevent
->
nextevent
));
*
lastevent
=
ome
;
pthread_mutex_unlock
(
&
in_mutex
);
}
static
void
coilib_mouse_thread
(
void
*
data
)
{
int
use_timeout
=
0
;
...
...
@@ -124,7 +158,7 @@ static void coilib_mouse_thread(void *data)
break
;
case
CIOLIB_BUTTON_1_PRESS
:
/*
No c
urrent
event should affect a
press event */
/*
C
urrent
ly
pr
oc
ess
ing a B1
event
?
*/
break
;
case
CIOLIB_BUTTON_1_RELEASE
:
...
...
@@ -132,7 +166,6 @@ static void coilib_mouse_thread(void *data)
break
;
case
CIOLIB_BUTTON_2_PRESS
:
/* No current event should affect a press event */
break
;
case
CIOLIB_BUTTON_2_RELEASE
:
...
...
@@ -140,7 +173,6 @@ static void coilib_mouse_thread(void *data)
break
;
case
CIOLIB_BUTTON_3_PRESS
:
/* No current event should affect a press event */
break
;
case
CIOLIB_BUTTON_3_RELEASE
:
...
...
This diff is collapsed.
Click to expand it.
src/conio/mouse.h
+
1
−
0
View file @
8b113549
...
...
@@ -4,6 +4,7 @@
struct
mouse_event
{
int
event
;
int
bstate
;
int
kbsm
;
int
startx
;
int
starty
;
int
endx
;
...
...
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