summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Graphics_Driver.cxx9
-rw-r--r--src/Fl_cocoa.mm8
-rw-r--r--src/Fl_porting.cxx10
-rw-r--r--src/Fl_win32.cxx26
-rw-r--r--src/Fl_x.cxx73
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.H5
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx28
-rw-r--r--src/drivers/Pico/Fl_Pico_Window_Driver.cxx2
-rw-r--r--src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx13
-rw-r--r--src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx1
-rw-r--r--src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx30
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H2
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx75
-rw-r--r--src/fl_font.cxx11
14 files changed, 147 insertions, 146 deletions
diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx
index fbe0d7712..6b7609ac7 100644
--- a/src/Fl_Graphics_Driver.cxx
+++ b/src/Fl_Graphics_Driver.cxx
@@ -69,6 +69,15 @@ void Fl_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen
delete[] img;
}
+void Fl_Graphics_Driver::set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
+{
+ // nothing to do
+}
+
+void Fl_Graphics_Driver::reset_spot()
+{
+ // nothing to do
+}
//
// End of "$Id$".
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index fe224206e..6de963cdf 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -147,14 +147,6 @@ static KeyScript_type KeyScript;
/* fltk-utf8 placekeepers */
-void fl_reset_spot()
-{
-}
-
-void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
-{
-}
-
void fl_set_status(int x, int y, int w, int h)
{
}
diff --git a/src/Fl_porting.cxx b/src/Fl_porting.cxx
index 825a88e3c..60bf9eb2d 100644
--- a/src/Fl_porting.cxx
+++ b/src/Fl_porting.cxx
@@ -40,16 +40,6 @@ void *fl_gc = NULL;
Window fl_window = NULL;
-void fl_reset_spot()
-{
-# pragma message "FL_PORTING: implement fl_reset_spot"
-}
-
-void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
-{
-# pragma message "FL_PORTING: implement fl_set_spot"
-}
-
void fl_set_status(int x, int y, int w, int h)
{
# pragma message "FL_PORTING: implement fl_set_status"
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 2baec35e0..c3ea187bf 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -290,32 +290,6 @@ static struct FD {
extern unsigned int fl_codepage;
-void fl_reset_spot()
-{
-}
-
-void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
-{
- if (!win) return;
- Fl_Window* tw = win;
- while (tw->parent()) tw = tw->window(); // find top level window
-
- if (!tw->shown())
- return;
-
- HIMC himc = flImmGetContext(fl_xid(tw));
-
- if (himc) {
- COMPOSITIONFORM cfs;
- cfs.dwStyle = CFS_POINT;
- cfs.ptCurrentPos.x = X;
- cfs.ptCurrentPos.y = Y - tw->labelsize();
- MapWindowPoints(fl_xid(win), fl_xid(tw), &cfs.ptCurrentPos, 1);
- flImmSetCompositionWindow(himc, &cfs);
- flImmReleaseContext(fl_xid(tw), himc);
- }
-}
-
void fl_set_status(int x, int y, int w, int h)
{
}
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 376f230fb..1978545d9 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -489,79 +489,6 @@ static void fl_new_ic()
}
-static XRectangle spot;
-static int spotf = -1;
-static int spots = -1;
-
-void fl_reset_spot(void)
-{
- spot.x = -1;
- spot.y = -1;
- //if (fl_xim_ic) XUnsetICFocus(fl_xim_ic);
-}
-
-void fl_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;
- //XSetICFocus(fl_xim_ic);
- if (X != spot.x || Y != spot.y) {
- spot.x = X;
- spot.y = Y;
- spot.height = H;
- spot.width = W;
- change = 1;
- }
- if (font != spotf || size != spots) {
- spotf = font;
- 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;
-
-
- preedit_attr = XVaCreateNestedList(0,
- XNSpotLocation, &spot,
- XNFontSet, fs, NULL);
- XSetICValues(fl_xim_ic, XNPreeditAttributes, preedit_attr, NULL);
- XFree(preedit_attr);
-}
-
void fl_set_status(int x, int y, int w, int h)
{
XVaNestedList status_attr;
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
index 4d4a50bd1..bbda02bc2 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
@@ -127,8 +127,11 @@ protected:
void color(Fl_Color c);
Fl_Color color() { return color_; }
void color(uchar r, uchar g, uchar b);
+ void set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win);
+ void reset_spot();
};
+
/**
The graphics driver used when printing on MSWindows.
*
@@ -142,6 +145,7 @@ public:
int draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP);
};
+
class Fl_Translated_GDI_Graphics_Driver : public Fl_GDI_Graphics_Driver {
unsigned depth;
POINT origins[10];
@@ -151,6 +155,7 @@ public:
virtual void untranslate_all(void);
};
+
#endif // FL_GDI_GRAPHICS_DRIVER_H
//
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
index 7da208573..817c7e154 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
@@ -179,6 +179,34 @@ void Fl_Graphics_Driver::XDestroyRegion(Fl_Region r) {
}
+void Fl_Graphics_Driver::reset_spot()
+{
+}
+
+void Fl_Graphics_Driver::set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
+{
+ if (!win) return;
+ Fl_Window* tw = win;
+ while (tw->parent()) tw = tw->window(); // find top level window
+
+ if (!tw->shown())
+ return;
+
+ HIMC himc = flImmGetContext(fl_xid(tw));
+
+ if (himc) {
+ COMPOSITIONFORM cfs;
+ cfs.dwStyle = CFS_POINT;
+ cfs.ptCurrentPos.x = X;
+ cfs.ptCurrentPos.y = Y - tw->labelsize();
+ MapWindowPoints(fl_xid(win), fl_xid(tw), &cfs.ptCurrentPos, 1);
+ flImmSetCompositionWindow(himc, &cfs);
+ flImmReleaseContext(fl_xid(tw), himc);
+ }
+}
+
+
+
//
// End of "$Id$".
//
diff --git a/src/drivers/Pico/Fl_Pico_Window_Driver.cxx b/src/drivers/Pico/Fl_Pico_Window_Driver.cxx
index da8be8097..cdd5eed27 100644
--- a/src/drivers/Pico/Fl_Pico_Window_Driver.cxx
+++ b/src/drivers/Pico/Fl_Pico_Window_Driver.cxx
@@ -36,8 +36,6 @@ Fl_Pico_Window_Driver::~Fl_Pico_Window_Driver()
}
-// --- window data
-
int Fl_Pico_Window_Driver::decorated_w()
{
return w();
diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx
index 30377c0a9..c1a96e2cc 100644
--- a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx
+++ b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx
@@ -38,6 +38,7 @@ Fl_PicoSDL_Screen_Driver::Fl_PicoSDL_Screen_Driver()
{
}
+
Fl_PicoSDL_Screen_Driver::~Fl_PicoSDL_Screen_Driver()
{
}
@@ -118,12 +119,22 @@ double Fl_PicoSDL_Screen_Driver::wait(double time_to_wait)
break;
case SDL_MOUSEWHEEL:
break;
+ case SDL_KEYDOWN: // full keyboard support is a lot more complex
+ case SDL_KEYUP:
+ if (e.type==SDL_KEYDOWN) Fl::e_number = FL_KEYDOWN; else Fl::e_number = FL_KEYUP;
+ if (!window) break;
+ if (e.key.keysym.sym==SDLK_ESCAPE) {
+ Fl::e_keysym = FL_Escape;
+ Fl::handle(Fl::e_number, window);
+ }
+ break;
}
}
return 0.0;
}
+// FIXME: remove the stuff below
#include <FL/x.H>
#include <FL/Fl.H>
@@ -147,8 +158,6 @@ double Fl_PicoSDL_Screen_Driver::wait(double time_to_wait)
#if !defined(FL_DOXYGEN) // FIXME silence Doxygen warnings
-void fl_set_spot(int, int, int, int, int, int, Fl_Window*) { }
-void fl_reset_spot() { }
//const char *fl_filename_name(char const*) { return 0; }
void fl_clipboard_notify_change() { }
diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx
index 7b3b9e4fb..6122ff5f1 100644
--- a/src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx
+++ b/src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx
@@ -29,7 +29,6 @@
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
{
return new Fl_System_Driver();
-// return new Fl_PicoSDL_System_Driver();
}
diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx
index 531e697d8..1c56b42b5 100644
--- a/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx
+++ b/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx
@@ -24,7 +24,7 @@
#include <FL/Fl.H>
#include <FL/Fl_WIndow.H>
-void Fl_Window_Driver::default_icons(Fl_RGB_Image const**, int) { }
+
const char *fl_local_alt = "alt";
const char *fl_local_ctrl = "ctrl";
@@ -38,6 +38,10 @@ Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *win)
}
+void Fl_Window_Driver::default_icons(Fl_RGB_Image const**, int) {
+}
+
+
Fl_PicoSDL_Window_Driver::Fl_PicoSDL_Window_Driver(Fl_Window *win)
: Fl_Pico_Window_Driver(win)
{
@@ -88,32 +92,9 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
}
-#if 0
-void Fl_PicoSDL_Window_Driver::flush_single()
-{
- if (!shown()) return;
- pWindow->make_current();
- Fl_X *i = Fl_X::i(pWindow);
- if (!i) return;
- fl_clip_region(i->region);
- i->region = 0;
- // SDL_RenderClear((SDL_Renderer*)i->xid);
- pWindow->draw();
- SDL_RenderPresent((SDL_Renderer*)i->xid);
-}
-#endif
-
-
void Fl_PicoSDL_Window_Driver::draw_end()
{
-// if (!shown()) return;
-// pWindow->make_current();
Fl_X *i = Fl_X::i(pWindow);
-// if (!i) return;
-// fl_clip_region(i->region);
-// i->region = 0;
-// // SDL_RenderClear((SDL_Renderer*)i->xid);
-// pWindow->draw();
SDL_RenderPresent((SDL_Renderer*)i->xid);
}
@@ -123,6 +104,7 @@ void Fl_PicoSDL_Window_Driver::make_current()
fl_window = pWindow->i->xid;
}
+
void Fl_PicoSDL_Window_Driver::show() {
if (!shown()) {
makeWindow();
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
index 808900677..ff037c3e1 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
@@ -129,6 +129,8 @@ 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();
};
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
index 44d0ad1a5..717718cb4 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
@@ -118,6 +118,81 @@ void Fl_Xlib_Graphics_Driver::fixloop() { // remove equal points from closed pa
while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
}
+// FIXME: should be members of Fl_Xlib_Graphics_Driver
+static XRectangle spot;
+static int spotf = -1;
+static int spots = -1;
+
+void Fl_Xlib_Graphics_Driver::reset_spot(void)
+{
+ spot.x = -1;
+ 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;
+ //XSetICFocus(fl_xim_ic);
+ if (X != spot.x || Y != spot.y) {
+ spot.x = X;
+ spot.y = Y;
+ spot.height = H;
+ spot.width = W;
+ change = 1;
+ }
+ if (font != spotf || size != spots) {
+ spotf = font;
+ 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;
+
+
+ preedit_attr = XVaCreateNestedList(0,
+ XNSpotLocation, &spot,
+ XNFontSet, fs, NULL);
+ XSetICValues(fl_xim_ic, XNPreeditAttributes, preedit_attr, NULL);
+ XFree(preedit_attr);
+}
+
+
//
// End of "$Id$".
//
diff --git a/src/fl_font.cxx b/src/fl_font.cxx
index 727eda493..530030874 100644
--- a/src/fl_font.cxx
+++ b/src/fl_font.cxx
@@ -50,6 +50,17 @@ void fl_text_extents(const char *c, int &dx, int &dy, int &w, int &h) {
void fl_draw(const char* str, int l, float x, float y) {
fl_graphics_driver->draw(str, l, x, y);
}
+
+void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
+{
+ fl_graphics_driver->set_spot(font, size, X, Y, W, H, win);
+}
+
+void fl_reset_spot()
+{
+ fl_graphics_driver->reset_spot();
+}
+
//
// End of "$Id$".
//