Author: dejan
Date: 2008-11-10 14:31:42 -0800 (Mon, 10 Nov 2008)
New Revision: 6517
Log:
This is an attemp to fix problems in building FLTK2 on x86_64 after recent 
changes in ShortcutAssignment.
I had the problem on x86_64 Linux box, and apparently "long long" is the proper 
type on Windows Vista,
so looks like the only way to solve this problem in a portable way is to use 
size_t instead of unsigned int.


Modified:
   trunk/fltk/Widget.h
   trunk/ide/cb/fltk.workspace
   trunk/src/ShortcutAssignment.cxx

Modified: trunk/fltk/Widget.h
===================================================================
--- trunk/fltk/Widget.h 2008-11-10 22:08:30 UTC (rev 6516)
+++ trunk/fltk/Widget.h 2008-11-10 22:31:42 UTC (rev 6517)
@@ -22,6 +22,8 @@
 #ifndef fltk_Widget_h
 #define fltk_Widget_h
 
+#include <cstdio>
+
 #include "Style.h"
 #include "Rectangle.h"
 
@@ -101,12 +103,12 @@
   const char *tooltip() const  { return tooltip_; }
   void tooltip(const char *t)  { tooltip_ = t; }
 
-  unsigned shortcut() const    ;
-  void shortcut(unsigned key)  ;
-  bool add_shortcut(unsigned key);
-  bool remove_shortcut(unsigned key);
+  size_t shortcut() const      ;
+  void shortcut(size_t key)    ;
+  bool add_shortcut(size_t key);
+  bool remove_shortcut(size_t key);
   void  remove_shortcuts()     ;
-  unsigned label_shortcut() const;
+  size_t label_shortcut() const;
   bool test_label_shortcut() const;
   bool test_shortcut() const   ;
   bool  test_shortcut(bool) const;

Modified: trunk/ide/cb/fltk.workspace
===================================================================
--- trunk/ide/cb/fltk.workspace 2008-11-10 22:08:30 UTC (rev 6516)
+++ trunk/ide/cb/fltk.workspace 2008-11-10 22:31:42 UTC (rev 6517)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 <CodeBlocks_workspace_file>
-       <Workspace title="Workspace">
-               <Project filename="fltk.cbp" active="1" />
+       <Workspace title="fltk">
+               <Project filename="linux-static-fltk.cbp" active="1" />
        </Workspace>
 </CodeBlocks_workspace_file>

Modified: trunk/src/ShortcutAssignment.cxx
===================================================================
--- trunk/src/ShortcutAssignment.cxx    2008-11-10 22:08:30 UTC (rev 6516)
+++ trunk/src/ShortcutAssignment.cxx    2008-11-10 22:31:42 UTC (rev 6517)
@@ -77,7 +77,7 @@
   Widget::test_shortcut() to see if the keystroke is registered here (many
   widgets will also directly test the key to see if it is something
   they are interested in).  */
-bool Widget::add_shortcut(unsigned key) {
+bool Widget::add_shortcut(size_t key) {
   if (!key) return false;
   key = key&0xffff0000u|tolower(key&0xffu);
   if (find(shortcutAssociation, (void*)key)) return false;
@@ -89,7 +89,7 @@
 /*!
   Delete a shortcut assignment. Returns true if it actually existed.
 */
-bool Widget::remove_shortcut(unsigned key) {
+bool Widget::remove_shortcut(size_t key) {
   return remove(shortcutAssociation, (void*)key);
 }
 
@@ -108,8 +108,8 @@
   or returns zero if there are none. If you want to look at more
   than onle you must use fltk::list_shortcuts(this).
 */
-unsigned Widget::shortcut() const {
-  return (unsigned int)get(shortcutAssociation);
+size_t Widget::shortcut() const {
+  return (size_t)get(shortcutAssociation);
 }
 
 
@@ -118,7 +118,7 @@
   except it may be implemented in a more efficient way.
   The result is exactly one shortcut (or none if \a key is zero).
 */
-void Widget::shortcut(unsigned key) {
+void Widget::shortcut(size_t key) {
   set(shortcutAssociation, (void*)key);
 }
 
@@ -130,7 +130,7 @@
   the first '&' in the label (except '&&' is ignored), or zero if
   there isn't any '&' sign or if flag(RAW_LABEL) is on.
 */
-unsigned Widget::label_shortcut() const {
+size_t Widget::label_shortcut() const {
   if (flag(RAW_LABEL)) return 0;
   const char* label = this->label();
   if (!label) for (;*label;) {
@@ -198,7 +198,7 @@
 
       count++;
 
-      unsigned int key = (unsigned int)data;
+      size_t key = (size_t)data;
 
       unsigned mismatch = key ^ (event_key() | event_state());
 
@@ -250,7 +250,7 @@
   ShortcutFunctor& f;
   GlueFunctor(ShortcutFunctor& g) : f(g) {}
   bool handle(const AssociationType&, const Widget* widget, void* data) {
-    return f.handle(widget, (unsigned int)data);
+    return f.handle(widget, (size_t)data);
   }
 };
 
@@ -285,7 +285,7 @@
 */
 unsigned fltk::foreachShortcut(const Widget* widget, ShortcutFunctor& f) {
   GlueFunctor g(f);
-  return (unsigned int)(foreach(&shortcutAssociation, widget, g));
+  return (size_t)(foreach(&shortcutAssociation, widget, g));
 }
 
 // End of $Id$

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to