aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/FbPixmap.cc11
-rw-r--r--src/FbTk/FbPixmap.hh12
-rw-r--r--src/FbTk/Menu.hh2
-rw-r--r--src/FbTk/Text.hh3
-rw-r--r--src/FbTk/TextBox.cc36
-rw-r--r--src/FbTk/TextBox.hh4
6 files changed, 35 insertions, 33 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index 0df087d..675e838 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -73,7 +73,7 @@ FbPixmap::FbPixmap(Pixmap pm):m_pm(0),
73 73
74FbPixmap::FbPixmap(const FbDrawable &src, 74FbPixmap::FbPixmap(const FbDrawable &src,
75 unsigned int width, unsigned int height, 75 unsigned int width, unsigned int height,
76 int depth):m_pm(0), 76 unsigned int depth):m_pm(0),
77 m_width(0), m_height(0), 77 m_width(0), m_height(0),
78 m_depth(0) { 78 m_depth(0) {
79 79
@@ -82,7 +82,7 @@ FbPixmap::FbPixmap(const FbDrawable &src,
82 82
83FbPixmap::FbPixmap(Drawable src, 83FbPixmap::FbPixmap(Drawable src,
84 unsigned int width, unsigned int height, 84 unsigned int width, unsigned int height,
85 int depth):m_pm(0), 85 unsigned int depth):m_pm(0),
86 m_width(0), m_height(0), 86 m_width(0), m_height(0),
87 m_depth(0) { 87 m_depth(0) {
88 88
@@ -157,7 +157,7 @@ void FbPixmap::copy(const FbPixmap &the_copy) {
157} 157}
158 158
159// screen doesn't count if depth is "zero"... 159// screen doesn't count if depth is "zero"...
160void FbPixmap::copy(Pixmap pm, int depth, int screen_num) { 160void FbPixmap::copy(Pixmap pm, unsigned int depth, int screen_num) {
161 free(); 161 free();
162 if (pm == 0) 162 if (pm == 0)
163 return; 163 return;
@@ -248,6 +248,8 @@ void FbPixmap::rotate(FbTk::Orientation orient) {
248 dirx = 1; 248 dirx = 1;
249 diry = -1; 249 diry = -1;
250 break; 250 break;
251 default: // kill warning
252 break;
251 } 253 }
252 254
253 255
@@ -365,7 +367,6 @@ void FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) {
365 unsigned long items_read, items_left; 367 unsigned long items_read, items_left;
366 unsigned long *data; 368 unsigned long *data;
367 369
368 unsigned int prop = 0;
369 if (XGetWindowProperty(display(), 370 if (XGetWindowProperty(display(),
370 RootWindow(display(), i), 371 RootWindow(display(), i),
371 root_prop_atoms[i], 372 root_prop_atoms[i],
@@ -474,7 +475,7 @@ void FbPixmap::free() {
474 475
475void FbPixmap::create(Drawable src, 476void FbPixmap::create(Drawable src,
476 unsigned int width, unsigned int height, 477 unsigned int width, unsigned int height,
477 int depth) { 478 unsigned int depth) {
478 if (src == 0) 479 if (src == 0)
479 return; 480 return;
480 481
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh
index 33a64d2..2935978 100644
--- a/src/FbTk/FbPixmap.hh
+++ b/src/FbTk/FbPixmap.hh
@@ -41,15 +41,15 @@ public:
41 explicit FbPixmap(Pixmap pm); 41 explicit FbPixmap(Pixmap pm);
42 FbPixmap(const FbDrawable &src, 42 FbPixmap(const FbDrawable &src,
43 unsigned int width, unsigned int height, 43 unsigned int width, unsigned int height,
44 int depth); 44 unsigned int depth);
45 FbPixmap(Drawable src, 45 FbPixmap(Drawable src,
46 unsigned int width, unsigned int height, 46 unsigned int width, unsigned int height,
47 int depth); 47 unsigned int depth);
48 48
49 virtual ~FbPixmap(); 49 virtual ~FbPixmap();
50 50
51 void copy(const FbPixmap &the_copy); 51 void copy(const FbPixmap &the_copy);
52 void copy(Pixmap pixmap, int depth_convert, int screen_num); 52 void copy(Pixmap pixmap, unsigned int depth_convert, int screen_num);
53 /// rotates the pixmap to specified orientation (assumes ROT0 now) 53 /// rotates the pixmap to specified orientation (assumes ROT0 now)
54 void rotate(FbTk::Orientation orient); 54 void rotate(FbTk::Orientation orient);
55 /// scales the pixmap to specified size 55 /// scales the pixmap to specified size
@@ -67,7 +67,7 @@ public:
67 inline Drawable drawable() const { return m_pm; } 67 inline Drawable drawable() const { return m_pm; }
68 inline unsigned int width() const { return m_width; } 68 inline unsigned int width() const { return m_width; }
69 inline unsigned int height() const { return m_height; } 69 inline unsigned int height() const { return m_height; }
70 inline int depth() const { return m_depth; } 70 inline unsigned int depth() const { return m_depth; }
71 71
72 static Pixmap getRootPixmap(int screen_num, bool force_update=false); 72 static Pixmap getRootPixmap(int screen_num, bool force_update=false);
73 static void setRootPixmap(int screen_num, Pixmap pm); 73 static void setRootPixmap(int screen_num, Pixmap pm);
@@ -75,13 +75,13 @@ public:
75 75
76 void create(Drawable src, 76 void create(Drawable src,
77 unsigned int width, unsigned int height, 77 unsigned int width, unsigned int height,
78 int depth); 78 unsigned int depth);
79 79
80private: 80private:
81 void free(); 81 void free();
82 Pixmap m_pm; 82 Pixmap m_pm;
83 unsigned int m_width, m_height; 83 unsigned int m_width, m_height;
84 int m_depth; 84 unsigned int m_depth;
85 85
86 /// Functions relating to the maintenance of root window pixmap caching 86 /// Functions relating to the maintenance of root window pixmap caching
87 static void checkAtoms(); 87 static void checkAtoms();
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index fceec67..2f098d7 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -207,7 +207,7 @@ private:
207 Menuitems menuitems; 207 Menuitems menuitems;
208 208
209 int m_screen_x, m_screen_y; 209 int m_screen_x, m_screen_y;
210 int m_screen_width, m_screen_height; 210 unsigned int m_screen_width, m_screen_height;
211 bool m_moving; ///< if we're moving/draging or not 211 bool m_moving; ///< if we're moving/draging or not
212 bool m_visible; ///< menu visibility 212 bool m_visible; ///< menu visibility
213 bool m_torn; ///< torn from parent 213 bool m_torn; ///< torn from parent
diff --git a/src/FbTk/Text.hh b/src/FbTk/Text.hh
index 01ee26e..745102f 100644
--- a/src/FbTk/Text.hh
+++ b/src/FbTk/Text.hh
@@ -106,9 +106,6 @@ inline void untranslateCoords(Orientation orient, int &orig_x, int &orig_y, unsi
106// relocate the x,y coordinates 106// relocate the x,y coordinates
107inline void translatePosition(Orientation orient, int &x, int &y, unsigned int w, unsigned int h, unsigned int bw) { 107inline void translatePosition(Orientation orient, int &x, int &y, unsigned int w, unsigned int h, unsigned int bw) {
108 108
109 int orig_x = x;
110 int orig_y = y;
111
112 switch(orient) { 109 switch(orient) {
113 case ROT0: 110 case ROT0:
114 break; 111 break;
diff --git a/src/FbTk/TextBox.cc b/src/FbTk/TextBox.cc
index a912775..7c91621 100644
--- a/src/FbTk/TextBox.cc
+++ b/src/FbTk/TextBox.cc
@@ -247,21 +247,25 @@ void TextBox::keyPressEvent(XKeyEvent &event) {
247 m_end_pos = 0; 247 m_end_pos = 0;
248 break; 248 break;
249 case XK_Left: { 249 case XK_Left: {
250 int pos = findEmptySpaceLeft(); 250 unsigned int pos = findEmptySpaceLeft();
251 if (pos < m_start_pos){ 251 if (pos < m_start_pos){
252 m_start_pos = pos; 252 m_start_pos = pos;
253 m_cursor_pos = 0; 253 m_cursor_pos = 0;
254 } else if (m_start_pos > 0) { 254 } else if (m_start_pos > 0) {
255 m_cursor_pos = pos - m_start_pos; 255 m_cursor_pos = pos - m_start_pos;
256 } else { 256 } else {
257 m_cursor_pos = pos; 257 m_cursor_pos = pos;
258 }
259 adjustPos();
260 } 258 }
259 adjustPos();
260 }
261 break; 261 break;
262 case XK_Right: 262 case XK_Right:
263 if (m_text.size() && m_cursor_pos < m_text.size()){ 263 if (m_text.size() && m_cursor_pos < m_text.size()){
264 int pos = findEmptySpaceRight() - m_start_pos; 264 unsigned int pos = findEmptySpaceRight();
265 if (pos > m_start_pos)
266 pos -= m_start_pos;
267 else
268 pos = 0;
265 if (m_start_pos + pos <= m_end_pos) 269 if (m_start_pos + pos <= m_end_pos)
266 m_cursor_pos = pos; 270 m_cursor_pos = pos;
267 else if (m_end_pos < text().size()) { 271 else if (m_end_pos < text().size()) {
@@ -275,7 +279,7 @@ void TextBox::keyPressEvent(XKeyEvent &event) {
275 break; 279 break;
276 280
277 case XK_BackSpace: { 281 case XK_BackSpace: {
278 int pos = findEmptySpaceLeft(); 282 unsigned int pos = findEmptySpaceLeft();
279 m_text.erase(pos, m_cursor_pos - pos + m_start_pos); 283 m_text.erase(pos, m_cursor_pos - pos + m_start_pos);
280 284
281 if (pos < m_start_pos){ 285 if (pos < m_start_pos){
@@ -292,7 +296,7 @@ void TextBox::keyPressEvent(XKeyEvent &event) {
292 case XK_Delete: { 296 case XK_Delete: {
293 if (!m_text.size() || m_cursor_pos >= m_text.size()) 297 if (!m_text.size() || m_cursor_pos >= m_text.size())
294 break; 298 break;
295 int pos = findEmptySpaceRight(); 299 unsigned int pos = findEmptySpaceRight();
296 m_text.erase(m_cursor_pos + m_start_pos, pos - (m_cursor_pos + m_start_pos)); 300 m_text.erase(m_cursor_pos + m_start_pos, pos - (m_cursor_pos + m_start_pos));
297 adjustPos(); 301 adjustPos();
298 } 302 }
@@ -406,7 +410,7 @@ void TextBox::adjustStartPos() {
406 m_start_pos = start_pos; 410 m_start_pos = start_pos;
407} 411}
408 412
409int TextBox::findEmptySpaceLeft(){ 413unsigned int TextBox::findEmptySpaceLeft(){
410 414
411 // found the first left space symbol 415 // found the first left space symbol
412 int pos = m_text.rfind(' ', (m_start_pos + m_cursor_pos) > 0 ? 416 int pos = m_text.rfind(' ', (m_start_pos + m_cursor_pos) > 0 ?
@@ -425,14 +429,14 @@ int TextBox::findEmptySpaceLeft(){
425 return pos; 429 return pos;
426 430
427} 431}
428int TextBox::findEmptySpaceRight(){ 432unsigned int TextBox::findEmptySpaceRight(){
429 433
430 // found the first right space symbol 434 // found the first right space symbol
431 int pos = m_text.find(' ', m_start_pos + m_cursor_pos); 435 int pos = m_text.find(' ', m_start_pos + m_cursor_pos);
432 436
433 // do we have one more space symbol near? 437 // do we have one more space symbol near?
434 int next_pos = -1; 438 int next_pos = -1;
435 while (pos > -1 && pos < m_text.size() && (next_pos = m_text.find(' ', pos + 1)) > -1 ){ 439 while (pos > -1 && pos < static_cast<signed>(m_text.size()) && (next_pos = m_text.find(' ', pos + 1)) > -1 ){
436 440
437 if (next_pos - 1 > pos) 441 if (next_pos - 1 > pos)
438 break; 442 break;
diff --git a/src/FbTk/TextBox.hh b/src/FbTk/TextBox.hh
index d5f2b61..660ac80 100644
--- a/src/FbTk/TextBox.hh
+++ b/src/FbTk/TextBox.hh
@@ -70,8 +70,8 @@ public:
70 int cursorPosition() const { return m_cursor_pos; } 70 int cursorPosition() const { return m_cursor_pos; }
71 inline int textStartPos(){ return m_start_pos; } 71 inline int textStartPos(){ return m_start_pos; }
72 72
73 int findEmptySpaceLeft(); 73 unsigned int findEmptySpaceLeft();
74 int findEmptySpaceRight(); 74 unsigned int findEmptySpaceRight();
75 75
76private: 76private:
77 void adjustEndPos(); 77 void adjustEndPos();