Author: matt
Date: 2010-11-16 14:17:40 -0800 (Tue, 16 Nov 2010)
New Revision: 7863
Log:
Fixed xclass support for Fl_Window (STR #2053)
Modified:
branches/branch-1.3/CHANGES
branches/branch-1.3/FL/Fl_Window.H
branches/branch-1.3/src/Fl.cxx
branches/branch-1.3/src/Fl_Window.cxx
Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2010-11-16 21:15:27 UTC (rev 7862)
+++ branches/branch-1.3/CHANGES 2010-11-16 22:17:40 UTC (rev 7863)
@@ -1,5 +1,6 @@
CHANGES IN FLTK 1.3.0
+ - Fixed xclass support for Fl_Window (STR #2053)
- Fixed Caps Lock handling in X11/XIM (STR #2366)
- Fixed handling of missing fonts in Xft (STR #2355)
- Added alternative Xft font names (STR #2215)
Modified: branches/branch-1.3/FL/Fl_Window.H
===================================================================
--- branches/branch-1.3/FL/Fl_Window.H 2010-11-16 21:15:27 UTC (rev 7862)
+++ branches/branch-1.3/FL/Fl_Window.H 2010-11-16 22:17:40 UTC (rev 7863)
@@ -57,11 +57,13 @@
*/
class FL_EXPORT Fl_Window : public Fl_Group {
+ static char *default_xclass_;
+
friend class Fl_X;
Fl_X *i; // points at the system-specific stuff
const char* iconlabel_;
- const char* xclass_;
+ char* xclass_;
const void* icon_;
// size_range stuff:
int minw, minh, maxw, maxh;
@@ -323,8 +325,10 @@
/** Sets the icon label. */
void label(const char* label, const char* iconlabel); // platform dependent
void copy_label(const char* a);
- /** See void Fl_Window::xclass(const char*) */
- const char* xclass() const {return xclass_;}
+
+ static void default_xclass(const char*);
+ static const char *default_xclass();
+ const char* xclass() const;
/**
A string used to tell the system what type of window this is. Mostly
this identifies the picture to draw in the icon. <I>Under X, this is
@@ -339,7 +343,7 @@
visible effect. The passed pointer is stored unchanged. The string
is not copied.
*/
- void xclass(const char* c) {xclass_ = c;}
+ void xclass(const char* c);
/** Gets the current icon window target dependent data. */
const void* icon() const {return icon_;}
/** Sets the current icon window target dependent data. */
Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx 2010-11-16 21:15:27 UTC (rev 7862)
+++ branches/branch-1.3/src/Fl.cxx 2010-11-16 22:17:40 UTC (rev 7863)
@@ -1292,6 +1292,9 @@
Fl_Window::~Fl_Window() {
hide();
+ if (xclass_) {
+ free(xclass_);
+ }
}
// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
Modified: branches/branch-1.3/src/Fl_Window.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Window.cxx 2010-11-16 21:15:27 UTC (rev
7862)
+++ branches/branch-1.3/src/Fl_Window.cxx 2010-11-16 22:17:40 UTC (rev
7863)
@@ -40,6 +40,8 @@
#include <FL/fl_draw.H>
#endif
+char *Fl_Window::default_xclass_ = 0L;
+
void Fl_Window::_Fl_Window() {
type(FL_WINDOW);
box(FL_FLAT_BOX);
@@ -178,7 +180,54 @@
return current_;
}
+/** Returns the default xclass */
+const char *Fl_Window::default_xclass()
+{
+ if (default_xclass_) {
+ return default_xclass_;
+ } else {
+ return "FLTK";
+ }
+}
+/** Sets the defaul xclass */
+void Fl_Window::default_xclass(const char *xc)
+{
+ if (default_xclass_) {
+ free(default_xclass_);
+ default_xclass_ = 0L;
+ }
+ if (xc) {
+ default_xclass_ = strdup(xc);
+ }
+}
+
+/** Set the xclass for this window */
+void Fl_Window::xclass(const char *xc)
+{
+ if (xclass_) {
+ free(xclass_);
+ xclass_ = 0L;
+ }
+ if (xc) {
+ xclass_ = strdup(xc);
+ if (!default_xclass_) {
+ default_xclass(xc);
+ }
+ }
+}
+
+/** Return the XClass for this window, or a default. */
+const char *Fl_Window::xclass() const
+{
+ if (xclass_) {
+ return xclass_;
+ } else {
+ return default_xclass();
+ }
+}
+
+
//
// End of "$Id$".
//
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit