summaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc15
-rw-r--r--src/FbTk/Menu.hh1
-rw-r--r--src/FbTk/Shape.cc13
-rw-r--r--src/FbTk/Shape.hh11
-rw-r--r--src/FbTk/TextUtils.hh6
5 files changed, 28 insertions, 18 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 696d847..ff57bde 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -832,8 +832,7 @@ void Menu::handleEvent(XEvent &event) {
832 if (validIndex(m_which_sub) && 832 if (validIndex(m_which_sub) &&
833 menuitems[m_which_sub]->submenu()->isVisible()) 833 menuitems[m_which_sub]->submenu()->isVisible())
834 menuitems[m_which_sub]->submenu()->grabInputFocus(); 834 menuitems[m_which_sub]->submenu()->grabInputFocus();
835 } else if (event.type == LeaveNotify) 835 }
836 m_closing = false;
837} 836}
838 837
839void Menu::buttonPressEvent(XButtonEvent &be) { 838void Menu::buttonPressEvent(XButtonEvent &be) {
@@ -1091,6 +1090,18 @@ void Menu::keyPressEvent(XKeyEvent &event) {
1091 } 1090 }
1092} 1091}
1093 1092
1093void Menu::leaveNotifyEvent(XCrossingEvent &ce) {
1094 m_closing = false;
1095 // if there's a submenu open, highlight its index and stop hide
1096 if (validIndex(m_which_sub) && m_active_index != m_which_sub &&
1097 menuitems[m_which_sub]->submenu()->isVisible()) {
1098 int old = m_active_index;
1099 m_active_index = m_which_sub;
1100 clearItem(m_active_index);
1101 clearItem(old);
1102 menuitems[m_which_sub]->submenu()->stopHide();
1103 }
1104}
1094 1105
1095void Menu::reconfigure() { 1106void Menu::reconfigure() {
1096 m_shape->setPlaces(theme()->shapePlaces()); 1107 m_shape->setPlaces(theme()->shapePlaces());
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 4ebab83..2675502 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -103,6 +103,7 @@ public:
103 void motionNotifyEvent(XMotionEvent &mn); 103 void motionNotifyEvent(XMotionEvent &mn);
104 void exposeEvent(XExposeEvent &ee); 104 void exposeEvent(XExposeEvent &ee);
105 void keyPressEvent(XKeyEvent &ke); 105 void keyPressEvent(XKeyEvent &ke);
106 void leaveNotifyEvent(XCrossingEvent &ce);
106 //@} 107 //@}
107 /// get input focus 108 /// get input focus
108 void grabInputFocus(); 109 void grabInputFocus();
diff --git a/src/FbTk/Shape.cc b/src/FbTk/Shape.cc
index c8cfb46..251d4d4 100644
--- a/src/FbTk/Shape.cc
+++ b/src/FbTk/Shape.cc
@@ -43,6 +43,7 @@
43#endif // SHAPE 43#endif // SHAPE
44 44
45#include <algorithm> 45#include <algorithm>
46#include <vector>
46 47
47using std::min; 48using std::min;
48 49
@@ -92,9 +93,17 @@ Pixmap makePixmap(FbWindow &drawable, const unsigned char rows[]) {
92 return pm.release(); 93 return pm.release();
93} 94}
94 95
96struct CornerPixmaps {
97 FbPixmap topleft;
98 FbPixmap topright;
99 FbPixmap botleft;
100 FbPixmap botright;
95}; 101};
96 102
97std::vector<Shape::CornerPixmaps> Shape::s_corners; 103// unfortunately, we need a separate pixmap per screen
104std::vector<CornerPixmaps> s_corners;
105
106}; // end of anonymous namespace
98 107
99Shape::Shape(FbWindow &win, int shapeplaces): 108Shape::Shape(FbWindow &win, int shapeplaces):
100 m_win(&win), 109 m_win(&win),
@@ -134,7 +143,7 @@ Shape::~Shape() {
134void Shape::initCorners(int screen_num) { 143void Shape::initCorners(int screen_num) {
135 if (s_corners.size() == 0) 144 if (s_corners.size() == 0)
136 s_corners.resize(ScreenCount(App::instance()->display())); 145 s_corners.resize(ScreenCount(App::instance()->display()));
137 146
138 static const unsigned char left_bits[] = { 0xc0, 0xf8, 0xfc, 0xfe, 0xfe, 0xfe, 0xff, 0xff }; 147 static const unsigned char left_bits[] = { 0xc0, 0xf8, 0xfc, 0xfe, 0xfe, 0xfe, 0xff, 0xff };
139 static const unsigned char right_bits[] = { 0x03, 0x1f, 0x3f, 0x7f, 0x7f, 0x7f, 0xff, 0xff}; 148 static const unsigned char right_bits[] = { 0x03, 0x1f, 0x3f, 0x7f, 0x7f, 0x7f, 0xff, 0xff};
140 static const unsigned char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 }; 149 static const unsigned char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 };
diff --git a/src/FbTk/Shape.hh b/src/FbTk/Shape.hh
index 04382cf..3539959 100644
--- a/src/FbTk/Shape.hh
+++ b/src/FbTk/Shape.hh
@@ -24,8 +24,6 @@
24 24
25#include "FbPixmap.hh" 25#include "FbPixmap.hh"
26 26
27#include <vector>
28
29namespace FbTk { 27namespace FbTk {
30class FbWindow; 28class FbWindow;
31 29
@@ -67,17 +65,8 @@ private:
67 65
68 void initCorners(int screen_num); 66 void initCorners(int screen_num);
69 67
70 struct CornerPixmaps {
71 FbPixmap topleft;
72 FbPixmap topright;
73 FbPixmap botleft;
74 FbPixmap botright;
75 };
76 68
77 // unfortunately, we need a separate pixmap per screen
78 static std::vector<CornerPixmaps> s_corners;
79 int m_shapeplaces; ///< places to shape 69 int m_shapeplaces; ///< places to shape
80
81}; 70};
82 71
83}; // end namespace FbTk 72}; // end namespace FbTk
diff --git a/src/FbTk/TextUtils.hh b/src/FbTk/TextUtils.hh
index efb6020..dcc222c 100644
--- a/src/FbTk/TextUtils.hh
+++ b/src/FbTk/TextUtils.hh
@@ -72,7 +72,7 @@ inline void translateCoords(Orientation orient, int &x, int &y, unsigned int w,
72} 72}
73 73
74// still require w and h in ROT0 coords 74// still require w and h in ROT0 coords
75inline void untranslateCoords(Orientation orient, int orig_x, int orig_y, unsigned int w, unsigned int h) { 75inline void untranslateCoords(Orientation orient, int &orig_x, int &orig_y, unsigned int w, unsigned int h) {
76 76
77 int x = orig_x; 77 int x = orig_x;
78 int y = orig_y; 78 int y = orig_y;
@@ -98,7 +98,7 @@ inline void untranslateCoords(Orientation orient, int orig_x, int orig_y, unsign
98 98
99// When positioning an X11 box inside another area, we need to 99// When positioning an X11 box inside another area, we need to
100// relocate the x,y coordinates 100// relocate the x,y coordinates
101inline void translatePosition(Orientation orient, int x, int y, unsigned int w, unsigned int h, unsigned int bw) { 101inline void translatePosition(Orientation orient, int &x, int &y, unsigned int w, unsigned int h, unsigned int bw) {
102 102
103 switch(orient) { 103 switch(orient) {
104 case ROT0: 104 case ROT0:
@@ -117,7 +117,7 @@ inline void translatePosition(Orientation orient, int x, int y, unsigned int w,
117 117
118} 118}
119 119
120inline void translateSize(Orientation orient, unsigned int w, unsigned int h) { 120inline void translateSize(Orientation orient, unsigned int &w, unsigned int &h) {
121 if (orient == ROT0 || orient == ROT180) 121 if (orient == ROT0 || orient == ROT180)
122 return; 122 return;
123 123