diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-06-19 10:23:24 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-06-19 10:23:24 +0200 |
| commit | 02870242eea8b729b3dbd6d23eb77372f61c6318 (patch) | |
| tree | 1c754a9b01c71b3e68aa795469c30b6c32074e17 /src/drivers/Xlib | |
| parent | 232743c3a5d903be813f6c4445f3f96bab25cae0 (diff) | |
Move input method support to Fl_Screen_Driver from Fl_Graphics_Driver
Diffstat (limited to 'src/drivers/Xlib')
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx | 85 |
2 files changed, 0 insertions, 88 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H index e22d10691..9e3c44dce 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H @@ -205,9 +205,6 @@ protected: void color(uchar r, uchar g, uchar b); virtual float scale_font_for_PostScript(Fl_Font_Descriptor *desc, int s); virtual float scale_bitmap_for_PostScript(); - virtual void set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win); - virtual void reset_spot(); - virtual void set_status(int X, int Y, int W, int H); virtual const char* get_font_name(Fl_Font fnum, int* ap); virtual int get_font_sizes(Fl_Font fnum, int*& sizep); #if !USE_XFT diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx index 8a9380486..13a67f428 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx @@ -24,8 +24,6 @@ #include <string.h> #include <stdlib.h> -extern XIC fl_xim_ic; -extern char fl_is_over_the_spot; #if !USE_XFT extern char *fl_get_font_xfld(int fnum, int size); #endif @@ -100,89 +98,6 @@ void Fl_Xlib_Graphics_Driver::fixloop() { // remove equal points from closed pa while (n>2 && short_point[n-1].x == short_point[0].x && short_point[n-1].y == short_point[0].y) n--; } -// FIXME: should be members of Fl_Xlib_Graphics_Driver -XRectangle fl_spot; -int fl_spotf = -1; -int fl_spots = -1; - -void Fl_Xlib_Graphics_Driver::reset_spot(void) -{ - fl_spot.x = -1; - fl_spot.y = -1; - //if (fl_xim_ic) XUnsetICFocus(fl_xim_ic); -} - -void Fl_Xlib_Graphics_Driver::set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win) -{ - int change = 0; - XVaNestedList preedit_attr; - static XFontSet fs = NULL; - char **missing_list; - int missing_count; - char *def_string; - char *fnt = NULL; - bool must_free_fnt =true; - - static XIC ic = NULL; - - if (!fl_xim_ic || !fl_is_over_the_spot) return; - if (Fl::focus()) { // handle case when text widget is inside subwindow - Fl_Window *focuswin = Fl::focus()->window(); - while (focuswin && focuswin->parent()) { - X += focuswin->x(); Y += focuswin->y(); - focuswin = focuswin->window(); - } - } - //XSetICFocus(fl_xim_ic); - if (X != fl_spot.x || Y != fl_spot.y) { - fl_spot.x = X; - fl_spot.y = Y; - fl_spot.height = H; - fl_spot.width = W; - change = 1; - } - if (font != fl_spotf || size != fl_spots) { - fl_spotf = font; - fl_spots = size; - change = 1; - if (fs) { - XFreeFontSet(fl_display, fs); - } -#if USE_XFT - -#if defined(__GNUC__) - // FIXME: warning XFT support here -#endif /*__GNUC__*/ - - fnt = NULL; // fl_get_font_xfld(font, size); - if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;} - fs = XCreateFontSet(fl_display, fnt, &missing_list, - &missing_count, &def_string); -#else - fnt = fl_get_font_xfld(font, size); - if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;} - fs = XCreateFontSet(fl_display, fnt, &missing_list, - &missing_count, &def_string); -#endif - } - if (fl_xim_ic != ic) { - ic = fl_xim_ic; - change = 1; - } - - if (fnt && must_free_fnt) free(fnt); - if (!change) return; - - float s = scale(); - XRectangle fl_spot_unscaled = { short(fl_spot.x * s), short(fl_spot.y * s), - (unsigned short)(fl_spot.width * s), (unsigned short)(fl_spot.height * s) }; - preedit_attr = XVaCreateNestedList(0, - XNSpotLocation, &fl_spot_unscaled, - XNFontSet, fs, NULL); - XSetICValues(fl_xim_ic, XNPreeditAttributes, preedit_attr, NULL); - XFree(preedit_attr); -} - #if !USE_XFT unsigned Fl_Xlib_Graphics_Driver::font_desc_size() { return (unsigned)sizeof(Fl_Xlib_Fontdesc); |
