FLTK logo

[master] 713d1bf - Revert parts of and fix other 'constness' changes (#239, #181)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 713d1bf - Revert parts of and fix other 'constness' changes (#239, #181) "Albrecht Schlosser" Jun 18, 2021  
 
commit 713d1bfd7c4a538b7bd3625a5f521f5911a9f500
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Fri Jun 18 18:46:17 2021 +0200
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Fri Jun 18 18:46:17 2021 +0200

    Revert parts of and fix other 'constness' changes (#239, #181)
    
    Some of the previous constness changes turned out to be incomplete,
    others had to be reverted because some other driver methods could
    not be made 'const' - particularly those calling open_display() to
    get the requested information.

 src/Fl_Screen_Driver.H                       | 16 ++++++++--------
 src/Fl_Screen_Driver.cxx                     |  2 +-
 src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H   |  2 +-
 src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx |  4 ++--
 src/drivers/X11/Fl_X11_Screen_Driver.H       |  2 +-
 src/drivers/X11/Fl_X11_Screen_Driver.cxx     |  2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git src/Fl_Screen_Driver.H src/Fl_Screen_Driver.H
index 7c19c35..c160f8a 100644
--- src/Fl_Screen_Driver.H
+++ src/Fl_Screen_Driver.H
@@ -69,7 +69,7 @@ public:
   static char bg2_set;
   static char fg_set;
 
-  virtual float scale(int n) const { return 1; }
+  virtual float scale(int n) { return 1; }
   virtual void scale(int n, float f) {}
   static Fl_Screen_Driver *newScreenDriver();
   // --- display management
@@ -77,13 +77,13 @@ public:
   virtual int visual(int flags);
   // --- screen configuration
   virtual void init() {}
-  virtual int x() const { return 0; }
-  virtual int y() const { return 0; }
-  virtual int w() const { return 800; } // default, override in driver!
-  virtual int h() const { return 600; } // default, override in driver!
+  virtual int x() { return 0; }
+  virtual int y() { return 0; }
+  virtual int w() { return 800; } // default, override in driver!
+  virtual int h() { return 600; } // default, override in driver!
   virtual int screen_count();
   void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
-  virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n) const {
+  virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n) {
     X = 0;
     Y = 0;
     W = 800;
@@ -109,14 +109,14 @@ public:
   virtual void grab(Fl_Window *win) {}
   // --- global colors
   /* the default implementation of parse_color() may be enough */
-  virtual int parse_color(const char *p, uchar &r, uchar &g, uchar &b) const;
+  virtual int parse_color(const char *p, uchar &r, uchar &g, uchar &b);
   virtual void get_system_colors() {}
   /* the default implementation of get_system_scheme() may be enough */
   virtual const char *get_system_scheme();
   // --- global timers
   virtual void add_timeout(double time, Fl_Timeout_Handler cb, void *argp) {}
   virtual void repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) {}
-  virtual int has_timeout(Fl_Timeout_Handler cb, void *argp) const { return 0; }
+  virtual int has_timeout(Fl_Timeout_Handler cb, void *argp) { return 0; }
   virtual void remove_timeout(Fl_Timeout_Handler cb, void *argp) {}
 
   static int secret_input_character;
diff --git src/Fl_Screen_Driver.cxx src/Fl_Screen_Driver.cxx
index 93d1800..de925ba 100644
--- src/Fl_Screen_Driver.cxx
+++ src/Fl_Screen_Driver.cxx
@@ -488,7 +488,7 @@ void Fl_Screen_Driver::open_display()
 
 
 // simulation of XParseColor:
-int Fl_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b) const
+int Fl_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b)
 {
   if (*p == '#') p++;
   size_t n = strlen(p);
diff --git src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
index 4ea0067..9c20b3b 100644
--- src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
+++ src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
@@ -85,7 +85,7 @@ public:
   virtual void repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp);
   virtual int has_timeout(Fl_Timeout_Handler cb, void *argp);
   virtual void remove_timeout(Fl_Timeout_Handler cb, void *argp);
-  virtual int has_marked_text();
+  virtual int has_marked_text() const;
   virtual void reset_marked_text();
   virtual void insertion_point_location(int x, int y, int height);
   int insertion_point_location(int *px, int *py, int *pheight);
diff --git src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
index 651da1f..1838a73 100644
--- src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
+++ src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
@@ -210,8 +210,8 @@ void Fl_Cocoa_Screen_Driver::get_system_colors()
 }
 
 
-int Fl_Cocoa_Screen_Driver::has_marked_text() {
-  return true;
+int Fl_Cocoa_Screen_Driver::has_marked_text() const {
+  return 1;
 }
 
 
diff --git src/drivers/X11/Fl_X11_Screen_Driver.H src/drivers/X11/Fl_X11_Screen_Driver.H
index c25337e..6fb8330 100644
--- src/drivers/X11/Fl_X11_Screen_Driver.H
+++ src/drivers/X11/Fl_X11_Screen_Driver.H
@@ -92,7 +92,7 @@ public:
   virtual int dnd(int unused);
   virtual int compose(int &del);
   virtual void compose_reset();
-  virtual int text_display_can_leak();
+  virtual int text_display_can_leak() const;
   virtual Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win, bool may_capture_subwins, bool *did_capture_subwins);
   virtual int get_mouse(int &x, int &y);
   virtual void enable_im();
diff --git src/drivers/X11/Fl_X11_Screen_Driver.cxx src/drivers/X11/Fl_X11_Screen_Driver.cxx
index 22aa7e6..1dbd521 100644
--- src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ src/drivers/X11/Fl_X11_Screen_Driver.cxx
@@ -701,7 +701,7 @@ void Fl_X11_Screen_Driver::compose_reset()
   if (fl_xim_ic) XmbResetIC(fl_xim_ic);
 }
 
-int Fl_X11_Screen_Driver::text_display_can_leak() {
+int Fl_X11_Screen_Driver::text_display_can_leak() const {
 #if USE_XFT
   return 1;
 #else
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.