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
25f8ab20
Commit
25f8ab20
authored
7 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Only use the ufunc_rec semaphore when we're going to need it... fixes
long delays on Win32.
parent
e5a7ba60
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/conio/sdl_con.c
+25
-13
25 additions, 13 deletions
src/conio/sdl_con.c
with
25 additions
and
13 deletions
src/conio/sdl_con.c
+
25
−
13
View file @
25f8ab20
...
@@ -79,6 +79,11 @@ static unsigned int sdl_pending_mousekeys=0;
...
@@ -79,6 +79,11 @@ static unsigned int sdl_pending_mousekeys=0;
static
SDL_Color
*
sdl_co
=
NULL
;
static
SDL_Color
*
sdl_co
=
NULL
;
static
Uint32
*
sdl_dac_default
=
NULL
;
static
Uint32
*
sdl_dac_default
=
NULL
;
static
size_t
sdl_dac_defaultsz
=
0
;
static
size_t
sdl_dac_defaultsz
=
0
;
static
int
sdl_using_directx
=
0
;
static
int
sdl_using_quartz
=
0
;
static
int
sdl_using_x11
=
0
;
static
int
sdl_x11available
=
0
;
static
struct
video_stats
cvstat
;
static
struct
video_stats
cvstat
;
...
@@ -246,8 +251,6 @@ void sdl_setscaling(int new_value);
...
@@ -246,8 +251,6 @@ void sdl_setscaling(int new_value);
#define CONSOLE_CLIPBOARD XA_PRIMARY
#define CONSOLE_CLIPBOARD XA_PRIMARY
int
sdl_x11available
=
0
;
/* X functions */
/* X functions */
struct
x11
{
struct
x11
{
int
(
*
XFree
)
(
void
*
data
);
int
(
*
XFree
)
(
void
*
data
);
...
@@ -411,6 +414,7 @@ void sdl_user_func(int func, ...)
...
@@ -411,6 +414,7 @@ void sdl_user_func(int func, ...)
va_start
(
argptr
,
func
);
va_start
(
argptr
,
func
);
sdl
.
mutexP
(
sdl_ufunc_mtx
);
sdl
.
mutexP
(
sdl_ufunc_mtx
);
/* Drain the swamp */
/* Drain the swamp */
if
(
sdl_x11available
&&
sdl_using_x11
)
while
(
sdl
.
SemWaitTimeout
(
sdl_ufunc_rec
,
0
)
==
0
);
while
(
sdl
.
SemWaitTimeout
(
sdl_ufunc_rec
,
0
)
==
0
);
while
(
1
)
{
while
(
1
)
{
switch
(
func
)
{
switch
(
func
)
{
...
@@ -446,6 +450,7 @@ void sdl_user_func(int func, ...)
...
@@ -446,6 +450,7 @@ void sdl_user_func(int func, ...)
while
((
rv
=
sdl
.
PeepEvents
(
&
ev
,
1
,
SDL_ADDEVENT
,
0xffffffff
))
!=
1
)
while
((
rv
=
sdl
.
PeepEvents
(
&
ev
,
1
,
SDL_ADDEVENT
,
0xffffffff
))
!=
1
)
YIELD
();
YIELD
();
if
(
func
!=
SDL_USEREVENT_FLUSH
)
{
if
(
func
!=
SDL_USEREVENT_FLUSH
)
{
if
(
sdl_x11available
&&
sdl_using_x11
)
if
((
rv
=
sdl
.
SemWaitTimeout
(
sdl_ufunc_rec
,
2000
))
!=
0
)
if
((
rv
=
sdl
.
SemWaitTimeout
(
sdl_ufunc_rec
,
2000
))
!=
0
)
continue
;
continue
;
}
}
...
@@ -469,6 +474,7 @@ int sdl_user_func_ret(int func, ...)
...
@@ -469,6 +474,7 @@ int sdl_user_func_ret(int func, ...)
va_start
(
argptr
,
func
);
va_start
(
argptr
,
func
);
sdl
.
mutexP
(
sdl_ufunc_mtx
);
sdl
.
mutexP
(
sdl_ufunc_mtx
);
/* Drain the swamp */
/* Drain the swamp */
if
(
sdl_x11available
&&
sdl_using_x11
)
while
(
sdl
.
SemWaitTimeout
(
sdl_ufunc_rec
,
0
)
==
0
);
while
(
sdl
.
SemWaitTimeout
(
sdl_ufunc_rec
,
0
)
==
0
);
while
(
1
)
{
while
(
1
)
{
switch
(
func
)
{
switch
(
func
)
{
...
@@ -488,6 +494,7 @@ int sdl_user_func_ret(int func, ...)
...
@@ -488,6 +494,7 @@ int sdl_user_func_ret(int func, ...)
* we need for copy/paste on X11.
* we need for copy/paste on X11.
* This hack can be removed for SDL2
* This hack can be removed for SDL2
*/
*/
if
(
sdl_x11available
&&
sdl_using_x11
)
if
((
rv
=
sdl
.
SemWaitTimeout
(
sdl_ufunc_rec
,
2000
))
!=
0
)
if
((
rv
=
sdl
.
SemWaitTimeout
(
sdl_ufunc_rec
,
2000
))
!=
0
)
continue
;
continue
;
rv
=
sdl
.
SemWait
(
sdl_ufunc_ret
);
rv
=
sdl
.
SemWait
(
sdl_ufunc_ret
);
...
@@ -504,10 +511,6 @@ void exit_sdl_con(void)
...
@@ -504,10 +511,6 @@ void exit_sdl_con(void)
sdl_user_func_ret
(
SDL_USEREVENT_QUIT
);
sdl_user_func_ret
(
SDL_USEREVENT_QUIT
);
}
}
int
sdl_using_directx
=
0
;
int
sdl_using_quartz
=
0
;
int
sdl_using_x11
=
0
;
void
sdl_copytext
(
const
char
*
text
,
size_t
buflen
)
void
sdl_copytext
(
const
char
*
text
,
size_t
buflen
)
{
{
#if (defined(__MACH__) && defined(__APPLE__))
#if (defined(__MACH__) && defined(__APPLE__))
...
@@ -773,6 +776,8 @@ int sdl_init(int mode)
...
@@ -773,6 +776,8 @@ int sdl_init(int mode)
sdl_x11available
=
FALSE
;
sdl_x11available
=
FALSE
;
}
}
}
}
#else
sdl_x11available
=
FALSE
;
#endif
#endif
cio_api
.
options
|=
CONIO_OPT_PALETTE_SETTING
|
CONIO_OPT_SET_TITLE
|
CONIO_OPT_SET_NAME
|
CONIO_OPT_SET_ICON
;
cio_api
.
options
|=
CONIO_OPT_PALETTE_SETTING
|
CONIO_OPT_SET_TITLE
|
CONIO_OPT_SET_NAME
|
CONIO_OPT_SET_ICON
;
return
(
0
);
return
(
0
);
...
@@ -1613,16 +1618,22 @@ int sdl_video_event_thread(void *data)
...
@@ -1613,16 +1618,22 @@ int sdl_video_event_thread(void *data)
#if defined(_WIN32)
#if defined(_WIN32)
if
(
!
strcmp
(
driver
,
"directx"
))
if
(
!
strcmp
(
driver
,
"directx"
))
sdl_using_directx
=
TRUE
;
sdl_using_directx
=
TRUE
;
#else
sdl_using_directx
=
FALSE
;
#endif
#endif
#if (defined(__MACH__) && defined(__APPLE__))
#if (defined(__MACH__) && defined(__APPLE__))
if
(
!
strcmp
(
driver
,
"Quartz"
))
if
(
!
strcmp
(
driver
,
"Quartz"
))
sdl_using_quartz
=
TRUE
;
sdl_using_quartz
=
TRUE
;
#else
sdl_using_quartz
=
FALSE
;
#endif
#endif
#if !defined(NO_X) && defined(__unix__)
#if !defined(NO_X) && defined(__unix__)
if
(
!
strcmp
(
driver
,
"x11"
))
if
(
!
strcmp
(
driver
,
"x11"
))
sdl_using_x11
=
TRUE
;
sdl_using_x11
=
TRUE
;
if
(
!
strcmp
(
driver
,
"dga"
))
if
(
!
strcmp
(
driver
,
"dga"
))
sdl_using_x11
=
TRUE
;
sdl_using_x11
=
TRUE
;
#else
sdl_using_x11
=
FALSE
;
#endif
#endif
}
}
...
@@ -1730,6 +1741,7 @@ int sdl_video_event_thread(void *data)
...
@@ -1730,6 +1741,7 @@ int sdl_video_event_thread(void *data)
struct
update_rect
*
old_next
;
struct
update_rect
*
old_next
;
/* Tell SDL to do various stuff... */
/* Tell SDL to do various stuff... */
if
(
ev
.
user
.
code
!=
SDL_USEREVENT_FLUSH
)
if
(
ev
.
user
.
code
!=
SDL_USEREVENT_FLUSH
)
if
(
sdl_x11available
&&
sdl_using_x11
)
sdl
.
SemPost
(
sdl_ufunc_rec
);
sdl
.
SemPost
(
sdl_ufunc_rec
);
switch
(
ev
.
user
.
code
)
{
switch
(
ev
.
user
.
code
)
{
case
SDL_USEREVENT_QUIT
:
case
SDL_USEREVENT_QUIT
:
...
...
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