aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-18 11:49:50 (GMT)
committerfluxgen <fluxgen>2003-08-18 11:49:50 (GMT)
commit51fe5995b15236220499d3502a5ec6bd4882a771 (patch)
treed798d72ec439d00c008daae11c1510750bbc9dfe
parent98013ee6f7b61b39c14a24e74751b0b6c2673375 (diff)
downloadfluxbox-51fe5995b15236220499d3502a5ec6bd4882a771.zip
fluxbox-51fe5995b15236220499d3502a5ec6bd4882a771.tar.bz2
minor ceaning
-rw-r--r--src/FbTk/Menu.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 67656ae..2eb8654 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Menu.cc,v 1.33 2003/08/04 12:45:42 fluxgen Exp $ 25// $Id: Menu.cc,v 1.34 2003/08/18 11:49:50 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -243,10 +243,7 @@ int Menu::remove(unsigned int index) {
243 // if menu is interal we should just hide it instead 243 // if menu is interal we should just hide it instead
244 // if destroying it 244 // if destroying it
245 if (! tmp->internal_menu) { 245 if (! tmp->internal_menu) {
246#ifdef DEBUG 246 delete tmp;
247 cerr<<__FILE__<<"("<<__FUNCTION__<<"): delete: "<<tmp<<endl;
248#endif // DEBUG
249 delete tmp;
250 } else 247 } else
251 tmp->internal_hide(); 248 tmp->internal_hide();
252 } 249 }
@@ -823,10 +820,12 @@ void Menu::drawItem(unsigned int index, bool highlight, bool clear, bool render_
823 820
824 if (clear) { 821 if (clear) {
825 822
826 GC def_gc = DefaultGC(m_display, menu.frame.screenNumber()); 823 GC def_gc = XCreateGC(m_display, menu.frame.window(), 0, 0);
827 if (menu.frame_pixmap == 0) { 824 if (menu.frame_pixmap == 0) {
825
828 XSetForeground(m_display, def_gc, m_theme.frameTexture().color().pixel()); 826 XSetForeground(m_display, def_gc, m_theme.frameTexture().color().pixel());
829 m_frame_pm.fillRectangle(def_gc, item_x, item_y, menu.item_w, menu.item_h); 827 m_frame_pm.fillRectangle(def_gc, item_x, item_y, menu.item_w, menu.item_h);
828
830 } else { 829 } else {
831 830
832 m_frame_pm.copyArea(menu.frame_pixmap, def_gc, 831 m_frame_pm.copyArea(menu.frame_pixmap, def_gc,
@@ -834,7 +833,7 @@ void Menu::drawItem(unsigned int index, bool highlight, bool clear, bool render_
834 item_x, item_y, 833 item_x, item_y,
835 menu.item_w, menu.item_h); 834 menu.item_w, menu.item_h);
836 } 835 }
837 836 XFreeGC(m_display, def_gc);
838 } else if (! (x == y && y == -1 && w == h && h == 0)) { 837 } else if (! (x == y && y == -1 && w == h && h == 0)) {
839 // calculate the which part of the hilite to redraw 838 // calculate the which part of the hilite to redraw
840 if (! (std::max(item_x, x) <= (signed) std::min(item_x + menu.item_w, x + w) && 839 if (! (std::max(item_x, x) <= (signed) std::min(item_x + menu.item_w, x + w) &&
@@ -1050,7 +1049,9 @@ void Menu::handleEvent(XEvent &event) {
1050} 1049}
1051 1050
1052void Menu::buttonPressEvent(XButtonEvent &be) { 1051void Menu::buttonPressEvent(XButtonEvent &be) {
1053 grabInputFocus(); 1052 if (be.window == menu.title)
1053 grabInputFocus();
1054
1054 if (be.window == menu.frame && menu.item_h != 0 && menu.item_w != 0) { 1055 if (be.window == menu.frame && menu.item_h != 0 && menu.item_w != 0) {
1055 1056
1056 int sbl = (be.x / menu.item_w), i = (be.y / menu.item_h); 1057 int sbl = (be.x / menu.item_w), i = (be.y / menu.item_h);
@@ -1093,8 +1094,6 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) {
1093 re.x >= 0 && re.x < (signed) menu.width && 1094 re.x >= 0 && re.x < (signed) menu.width &&
1094 re.y >= 0 && re.y < (signed) menu.frame_h) { 1095 re.y >= 0 && re.y < (signed) menu.frame_h) {
1095 1096
1096
1097
1098 int sbl = (re.x / menu.item_w), i = (re.y / menu.item_h), 1097 int sbl = (re.x / menu.item_w), i = (re.y / menu.item_h),
1099 ix = sbl * menu.item_w, iy = i * menu.item_h, 1098 ix = sbl * menu.item_w, iy = i * menu.item_h,
1100 w = (sbl * menu.persub) + i, 1099 w = (sbl * menu.persub) + i,