aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbAtoms.cc2
-rw-r--r--src/FbAtoms.hh4
-rw-r--r--src/FbTk/FbWindow.cc11
-rw-r--r--src/IconButton.cc9
-rw-r--r--src/IconButton.hh2
-rw-r--r--src/Window.cc25
-rw-r--r--src/Window.hh3
7 files changed, 50 insertions, 6 deletions
diff --git a/src/FbAtoms.cc b/src/FbAtoms.cc
index 409a99f..95a89a7 100644
--- a/src/FbAtoms.cc
+++ b/src/FbAtoms.cc
@@ -40,6 +40,8 @@ FbAtoms::FbAtoms() {
40 motif_wm_hints = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); 40 motif_wm_hints = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
41 41
42 blackbox_attributes = XInternAtom(dpy, "_BLACKBOX_ATTRIBUTES", False); 42 blackbox_attributes = XInternAtom(dpy, "_BLACKBOX_ATTRIBUTES", False);
43 current_iconbar_item = XInternAtom(dpy, "_FLUXBOX_CURRENT_ICONBAR_ITEM", False);
44 resize_rect = XInternAtom(dpy, "_FLUXBOX_RECONFIGURE_RECT", False);
43 45
44 s_singleton = this; 46 s_singleton = this;
45} 47}
diff --git a/src/FbAtoms.hh b/src/FbAtoms.hh
index 3ed52a5..09920f3 100644
--- a/src/FbAtoms.hh
+++ b/src/FbAtoms.hh
@@ -42,12 +42,16 @@ public:
42 // these atoms are for normal app->WM interaction beyond the scope of the 42 // these atoms are for normal app->WM interaction beyond the scope of the
43 // ICCCM... 43 // ICCCM...
44 Atom getFluxboxAttributesAtom() const { return blackbox_attributes; } 44 Atom getFluxboxAttributesAtom() const { return blackbox_attributes; }
45 Atom getFluxboxCurrentIconbarItemAtom() const { return current_iconbar_item; }
46 Atom getFluxboxResizeRectAtom() const { return resize_rect; }
45 47
46private: 48private:
47 FbAtoms(); 49 FbAtoms();
48 50
49 Atom blackbox_attributes; 51 Atom blackbox_attributes;
52 Atom current_iconbar_item;
50 Atom motif_wm_hints; 53 Atom motif_wm_hints;
54 Atom resize_rect;
51 Atom xa_wm_protocols; 55 Atom xa_wm_protocols;
52 Atom xa_wm_state; 56 Atom xa_wm_state;
53 Atom xa_wm_delete_window; 57 Atom xa_wm_delete_window;
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 8362733..cf2d348 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -64,7 +64,7 @@ FbWindow::FbWindow(const FbWindow& the_copy):
64 m_width(the_copy.width()), m_height(the_copy.height()), 64 m_width(the_copy.width()), m_height(the_copy.height()),
65 m_border_width(the_copy.borderWidth()), 65 m_border_width(the_copy.borderWidth()),
66 m_border_color(the_copy.borderColor()), 66 m_border_color(the_copy.borderColor()),
67 m_depth(the_copy.depth()), m_destroy(true), 67 m_depth(the_copy.depth()), m_destroy(the_copy.m_destroy),
68 m_lastbg_color_set(false), m_lastbg_color(0), m_lastbg_pm(0), 68 m_lastbg_color_set(false), m_lastbg_color(0), m_lastbg_pm(0),
69 m_renderer(the_copy.m_renderer) { 69 m_renderer(the_copy.m_renderer) {
70 the_copy.m_window = 0; 70 the_copy.m_window = 0;
@@ -413,7 +413,6 @@ void FbWindow::setNew(Window win) {
413 m_window = win; 413 m_window = win;
414 414
415 if (m_window != 0) { 415 if (m_window != 0) {
416 updateGeometry();
417 XWindowAttributes attr; 416 XWindowAttributes attr;
418 attr.screen = 0; 417 attr.screen = 0;
419 //get screen number 418 //get screen number
@@ -622,16 +621,16 @@ bool FbWindow::updateGeometry() {
622 return false; 621 return false;
623 622
624 int old_x = m_x, old_y = m_y; 623 int old_x = m_x, old_y = m_y;
625 unsigned int old_width = m_width, old_height = m_height; 624 unsigned int old_border_width = m_border_width, old_width = m_width, old_height = m_height;
626 625
627 Window root; 626 Window root;
628 unsigned int border_width, depth; 627 unsigned int depth;
629 if (XGetGeometry(display(), m_window, &root, &m_x, &m_y, 628 if (XGetGeometry(display(), m_window, &root, &m_x, &m_y,
630 &m_width, &m_height, &border_width, &depth)) 629 &m_width, &m_height, &m_border_width, &depth))
631 m_depth = depth; 630 m_depth = depth;
632 631
633 return (old_x != m_x || old_y != m_y || old_width != m_width || 632 return (old_x != m_x || old_y != m_y || old_width != m_width ||
634 old_height != m_height); 633 old_height != m_height || old_border_width != m_border_width);
635} 634}
636 635
637void FbWindow::create(Window parent, int x, int y, 636void FbWindow::create(Window parent, int x, int y,
diff --git a/src/IconButton.cc b/src/IconButton.cc
index 7c70a63..6e7294e 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -24,7 +24,9 @@
24#include "IconbarTool.hh" 24#include "IconbarTool.hh"
25#include "IconbarTheme.hh" 25#include "IconbarTheme.hh"
26 26
27#include "FbAtoms.hh"
27#include "Screen.hh" 28#include "Screen.hh"
29#include "Window.hh"
28 30
29#include "FbTk/App.hh" 31#include "FbTk/App.hh"
30#include "FbTk/Command.hh" 32#include "FbTk/Command.hh"
@@ -36,6 +38,7 @@
36#include "config.h" 38#include "config.h"
37#endif // HAVE_CONFIG_H 39#endif // HAVE_CONFIG_H
38 40
41#include <X11/Xatom.h>
39#include <X11/Xutil.h> 42#include <X11/Xutil.h>
40#ifdef SHAPE 43#ifdef SHAPE
41#include <X11/extensions/shape.h> 44#include <X11/extensions/shape.h>
@@ -86,11 +89,13 @@ void IconButton::exposeEvent(XExposeEvent &event) {
86 89
87void IconButton::enterNotifyEvent(XCrossingEvent &ev) { 90void IconButton::enterNotifyEvent(XCrossingEvent &ev) {
88 m_has_tooltip = true; 91 m_has_tooltip = true;
92 setCurrentIconbarItem(m_win.fbwindow()->clientWindow());
89 showTooltip(); 93 showTooltip();
90} 94}
91 95
92void IconButton::leaveNotifyEvent(XCrossingEvent &ev) { 96void IconButton::leaveNotifyEvent(XCrossingEvent &ev) {
93 m_has_tooltip = false; 97 m_has_tooltip = false;
98 setCurrentIconbarItem(None);
94 m_win.screen().hideTooltip(); 99 m_win.screen().hideTooltip();
95} 100}
96 101
@@ -282,3 +287,7 @@ bool IconButton::setOrientation(FbTk::Orientation orient) {
282 } 287 }
283} 288}
284 289
290void IconButton::setCurrentIconbarItem(Window xid) {
291 m_win.screen().rootWindow().changeProperty(FbAtoms::instance()->getFluxboxCurrentIconbarItemAtom(),
292 XA_WINDOW, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&xid), 1);
293}
diff --git a/src/IconButton.hh b/src/IconButton.hh
index 4f1587b..afb97bf 100644
--- a/src/IconButton.hh
+++ b/src/IconButton.hh
@@ -79,6 +79,8 @@ private:
79 /// Called when client title changed. 79 /// Called when client title changed.
80 void clientTitleChanged(); 80 void clientTitleChanged();
81 81
82 void setCurrentIconbarItem(Window xid);
83
82 Focusable &m_win; 84 Focusable &m_win;
83 FbTk::FbWindow m_icon_window; 85 FbTk::FbWindow m_icon_window;
84 FbTk::FbPixmap m_icon_pixmap; 86 FbTk::FbPixmap m_icon_pixmap;
diff --git a/src/Window.cc b/src/Window.cc
index a8e4534..f390fc5 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1882,6 +1882,16 @@ bool FluxboxWindow::getState() {
1882 return ret; 1882 return ret;
1883} 1883}
1884 1884
1885void FluxboxWindow::setReconfigureRectProperty(int x, int y, int width, int height) {
1886 long data[4] = { x, y, width, height };
1887 winClient().screen().rootWindow().changeProperty(FbAtoms::instance()->getFluxboxResizeRectAtom(),
1888 XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(data), 4);
1889}
1890
1891void FluxboxWindow::clearReconfigureRectProperty() {
1892 setReconfigureRectProperty(0, 0, 0, 0);
1893}
1894
1885/** 1895/**
1886 Show the window menu at pos x, y 1896 Show the window menu at pos x, y
1887*/ 1897*/
@@ -2579,6 +2589,10 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2579 m_last_resize_w - 1 + 2 * frame().window().borderWidth(), 2589 m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
2580 m_last_resize_h - 1 + 2 * frame().window().borderWidth()); 2590 m_last_resize_h - 1 + 2 * frame().window().borderWidth());
2581 2591
2592 setReconfigureRectProperty(m_last_resize_x, m_last_resize_y,
2593 m_last_resize_w + 2 * frame().window().borderWidth() - 1,
2594 m_last_resize_h + 2 * frame().window().borderWidth() - 1);
2595
2582 } 2596 }
2583 } else if (m_attaching_tab != 0) { 2597 } else if (m_attaching_tab != 0) {
2584 // 2598 //
@@ -2596,6 +2610,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2596 dx, dy, 2610 dx, dy,
2597 m_last_resize_w, m_last_resize_h); 2611 m_last_resize_w, m_last_resize_h);
2598 2612
2613 setReconfigureRectProperty(dx, dy, m_last_resize_w, m_last_resize_h);
2614
2599 // change remembered position of rectangle 2615 // change remembered position of rectangle
2600 m_last_move_x = dx; 2616 m_last_move_x = dx;
2601 m_last_move_y = dy; 2617 m_last_move_y = dy;
@@ -3096,6 +3112,10 @@ void FluxboxWindow::startResizing(int x, int y, ReferenceCorner dir) {
3096 m_last_resize_x, m_last_resize_y, 3112 m_last_resize_x, m_last_resize_y,
3097 m_last_resize_w - 1 + 2 * frame().window().borderWidth(), 3113 m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
3098 m_last_resize_h - 1 + 2 * frame().window().borderWidth()); 3114 m_last_resize_h - 1 + 2 * frame().window().borderWidth());
3115
3116 setReconfigureRectProperty(m_last_resize_x, m_last_resize_y,
3117 m_last_resize_w + 2 * frame().window().borderWidth() - 1,
3118 m_last_resize_h + 2 * frame().window().borderWidth() - 1);
3099} 3119}
3100 3120
3101void FluxboxWindow::stopResizing(bool interrupted) { 3121void FluxboxWindow::stopResizing(bool interrupted) {
@@ -3116,6 +3136,7 @@ void FluxboxWindow::stopResizing(bool interrupted) {
3116 } 3136 }
3117 3137
3118 ungrabPointer(CurrentTime); 3138 ungrabPointer(CurrentTime);
3139 clearReconfigureRectProperty();
3119} 3140}
3120 3141
3121WinClient* FluxboxWindow::winClientOfLabelButtonWindow(Window window) { 3142WinClient* FluxboxWindow::winClientOfLabelButtonWindow(Window window) {
@@ -3172,6 +3193,8 @@ void FluxboxWindow::startTabbing(const XButtonEvent &be) {
3172 m_last_resize_w, m_last_resize_h); 3193 m_last_resize_w, m_last_resize_h);
3173 3194
3174 menu().hide(); 3195 menu().hide();
3196
3197 setReconfigureRectProperty(m_last_move_x, m_last_move_y, m_last_resize_w, m_last_resize_h);
3175} 3198}
3176 3199
3177void FluxboxWindow::attachTo(int x, int y, bool interrupted) { 3200void FluxboxWindow::attachTo(int x, int y, bool interrupted) {
@@ -3182,6 +3205,8 @@ void FluxboxWindow::attachTo(int x, int y, bool interrupted) {
3182 m_last_move_x, m_last_move_y, 3205 m_last_move_x, m_last_move_y,
3183 m_last_resize_w, m_last_resize_h); 3206 m_last_resize_w, m_last_resize_h);
3184 3207
3208 clearReconfigureRectProperty();
3209
3185 ungrabPointer(CurrentTime); 3210 ungrabPointer(CurrentTime);
3186 3211
3187 Fluxbox::instance()->ungrab(); 3212 Fluxbox::instance()->ungrab();
diff --git a/src/Window.hh b/src/Window.hh
index 6117d48..a826378 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -499,6 +499,9 @@ private:
499 void setFullscreenLayer(); 499 void setFullscreenLayer();
500 void attachWorkAreaSig(); 500 void attachWorkAreaSig();
501 501
502 void setReconfigureRectProperty(int x, int y, int width, int height);
503 void clearReconfigureRectProperty();
504
502 // modifies left and top if snap is necessary 505 // modifies left and top if snap is necessary
503 void doSnapping(int &left, int &top); 506 void doSnapping(int &left, int &top);
504 // user_w/h return the values that should be shown to the user 507 // user_w/h return the values that should be shown to the user