Skip to content
Snippets Groups Projects
Commit 3613fc76 authored by deuce's avatar deuce
Browse files

Add getfont() ciolib function.

parent 54ef826d
No related branches found
No related tags found
No related merge requests found
...@@ -138,6 +138,7 @@ int try_sdl_init(int mode) ...@@ -138,6 +138,7 @@ int try_sdl_init(int mode)
cio_api.getcliptext=sdl_getcliptext; cio_api.getcliptext=sdl_getcliptext;
#endif #endif
cio_api.setfont=sdl_setfont; cio_api.setfont=sdl_setfont;
cio_api.getfont=sdl_getfont;
return(1); return(1);
} }
return(0); return(0);
...@@ -170,6 +171,7 @@ int try_x_init(int mode) ...@@ -170,6 +171,7 @@ int try_x_init(int mode)
cio_api.copytext=x_copytext; cio_api.copytext=x_copytext;
cio_api.getcliptext=x_getcliptext; cio_api.getcliptext=x_getcliptext;
cio_api.setfont=x_setfont; cio_api.setfont=x_setfont;
cio_api.getfont=x_getfont;
return(1); return(1);
} }
return(0); return(0);
...@@ -967,3 +969,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_setfont(int font, int force) ...@@ -967,3 +969,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_setfont(int font, int force)
else else
return(-1); return(-1);
} }
CIOLIBEXPORT int CIOLIBCALL ciolib_getfont(void)
{
CIOLIB_INIT();
if(cio_api.getfont!=NULL)
return(cio_api.getfont());
else
return(-1);
}
...@@ -242,6 +242,7 @@ typedef struct { ...@@ -242,6 +242,7 @@ typedef struct {
void (*suspend) (void); void (*suspend) (void);
void (*resume) (void); void (*resume) (void);
int (*setfont) (int font, int force); int (*setfont) (int font, int force);
int (*getfont) (void);
} cioapi_t; } cioapi_t;
CIOLIBEXPORTVAR cioapi_t cio_api; CIOLIBEXPORTVAR cioapi_t cio_api;
...@@ -296,6 +297,7 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_hidemouse(void); ...@@ -296,6 +297,7 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_hidemouse(void);
CIOLIBEXPORT void CIOLIBCALL ciolib_copytext(const char *text, size_t buflen); CIOLIBEXPORT void CIOLIBCALL ciolib_copytext(const char *text, size_t buflen);
CIOLIBEXPORT char * CIOLIBCALL ciolib_getcliptext(void); CIOLIBEXPORT char * CIOLIBCALL ciolib_getcliptext(void);
CIOLIBEXPORT int CIOLIBCALL ciolib_setfont(int font, int force); CIOLIBEXPORT int CIOLIBCALL ciolib_setfont(int font, int force);
CIOLIBEXPORT int CIOLIBCALL ciolib_getfont(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
...@@ -343,6 +345,7 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_setfont(int font, int force); ...@@ -343,6 +345,7 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_setfont(int font, int force);
#define copytext(a,b) ciolib_copytext(a,b) #define copytext(a,b) ciolib_copytext(a,b)
#define getcliptext() ciolib_getcliptext() #define getcliptext() ciolib_getcliptext()
#define setfont(a,b) ciolib_setfont(a,b) #define setfont(a,b) ciolib_setfont(a,b)
#define getfont() ciolib_getfont()
#endif #endif
/* Special hackery for SDL */ /* Special hackery for SDL */
......
...@@ -130,7 +130,7 @@ sem_t copybuf_set; ...@@ -130,7 +130,7 @@ sem_t copybuf_set;
sem_t pastebuf_set; sem_t pastebuf_set;
sem_t pastebuf_request; sem_t pastebuf_request;
sem_t font_set; sem_t font_set;
int new_font; int new_font=-1;
int font_force; int font_force;
int setfont_return; int setfont_return;
pthread_mutex_t copybuf_mutex; pthread_mutex_t copybuf_mutex;
......
...@@ -864,6 +864,11 @@ int sdl_setfont(int font, int force) ...@@ -864,6 +864,11 @@ int sdl_setfont(int font, int force)
sdl_user_func(SDL_USEREVENT_UPDATERECT,0,0,0,0); sdl_user_func(SDL_USEREVENT_UPDATERECT,0,0,0,0);
} }
int sdl_getfont(void)
{
return(sdl_current_font);
}
/* Called from event thread only */ /* Called from event thread only */
void sdl_add_key(unsigned int keyval) void sdl_add_key(unsigned int keyval)
{ {
......
...@@ -36,6 +36,7 @@ int sdl_showmouse(void); ...@@ -36,6 +36,7 @@ int sdl_showmouse(void);
void sdl_copytext(const char *text, size_t buflen); void sdl_copytext(const char *text, size_t buflen);
char *sdl_getcliptext(void); char *sdl_getcliptext(void);
int sdl_setfont(int font, int force); int sdl_setfont(int font, int force);
int sdl_getfont(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -325,3 +325,8 @@ int x_setfont(int font, int force) ...@@ -325,3 +325,8 @@ int x_setfont(int font, int force)
sem_wait(&font_set); sem_wait(&font_set);
return(setfont_return); return(setfont_return);
} }
int x_getfont(void)
{
return(new_font);
}
...@@ -66,6 +66,7 @@ void x_settitle(const char *title); ...@@ -66,6 +66,7 @@ void x_settitle(const char *title);
void x_copytext(const char *text, size_t buflen); void x_copytext(const char *text, size_t buflen);
char *x_getcliptext(void); char *x_getcliptext(void);
int x_setfont(int font, int force); int x_setfont(int font, int force);
int x_getfont(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment