summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc97
1 files changed, 39 insertions, 58 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 834531c..1feb86f 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.69 2002/08/14 22:52:06 fluxgen Exp $ 25// $Id: Window.cc,v 1.70 2002/08/16 10:50:20 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -2800,9 +2800,10 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent *re) {
2800 2800
2801 2801
2802void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) { 2802void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) {
2803 #ifdef GNOME 2803#ifdef GNOME
2804 loadGnomeAtoms(); 2804 loadGnomeAtoms();
2805 #endif 2805#endif // GNOME
2806
2806 if ((ne->window == client.window) && (! ne->override_redirect) && (visible)) { 2807 if ((ne->window == client.window) && (! ne->override_redirect) && (visible)) {
2807 Fluxbox *fluxbox = Fluxbox::instance(); 2808 Fluxbox *fluxbox = Fluxbox::instance();
2808 BaseDisplay::GrabGuard gg(*fluxbox); 2809 BaseDisplay::GrabGuard gg(*fluxbox);
@@ -2826,7 +2827,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) {
2826 visible = true; 2827 visible = true;
2827 iconic = false; 2828 iconic = false;
2828 2829
2829 // Auto-group? 2830 // Auto-group from tab?
2830 if (!transient) { 2831 if (!transient) {
2831 // Grab and clear the auto-group window 2832 // Grab and clear the auto-group window
2832 FluxboxWindow* autoGroupWindow = screen->useAutoGroupWindow(); 2833 FluxboxWindow* autoGroupWindow = screen->useAutoGroupWindow();
@@ -2848,53 +2849,21 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) {
2848// else false 2849// else false
2849//------------------------------------------------- 2850//-------------------------------------------------
2850bool FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) { 2851bool FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
2851 if (ue->window == client.window) { 2852 if (ue->window != client.window)
2852 #ifdef DEBUG 2853 return false;
2853 fprintf(stderr, 2854
2854 I18n::instance()->getMessage( 2855#ifdef DEBUG
2855 FBNLS::WindowSet, FBNLS::WindowUnmapNotify, 2856 fprintf(stderr,
2856 "FluxboxWindow::unmapNotifyEvent() for 0x%lx\n"), 2857 I18n::instance()->getMessage(
2857 client.window); 2858 FBNLS::WindowSet, FBNLS::WindowUnmapNotify,
2858 #endif // DEBUG 2859 "FluxboxWindow::unmapNotifyEvent() for 0x%lx\n"),
2859 2860 client.window);
2860 Fluxbox *fluxbox = Fluxbox::instance(); 2861#endif // DEBUG
2861 BaseDisplay::GrabGuard gg(*fluxbox);
2862 fluxbox->grab();
2863 if (! validateClient())
2864 return false;
2865
2866 XChangeSaveSet(display, client.window, SetModeDelete);
2867 XSelectInput(display, client.window, NoEventMask);
2868
2869 XDeleteProperty(display, client.window, fluxbox->getWMStateAtom());
2870 XDeleteProperty(display, client.window, fluxbox->getFluxboxAttributesAtom());
2871
2872 XUnmapWindow(display, frame.window);
2873 XUnmapWindow(display, client.window);
2874
2875 XEvent dummy;
2876 if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
2877 &dummy)) {
2878 #ifdef DEBUG
2879 fprintf(stderr,
2880 I18n::instance()->getMessage(
2881 FBNLS::WindowSet, FBNLS::WindowUnmapNotifyReparent,
2882 "FluxboxWindow::unmapNotifyEvent(): reparent 0x%lx to "
2883 "root.\n"), client.window);
2884 #endif // DEBUG
2885 restoreGravity();
2886 XReparentWindow(display, client.window, screen->getRootWindow(),
2887 client.x, client.y);
2888 }
2889
2890 XFlush(display);
2891 2862
2892 fluxbox->ungrab(); 2863 restore(false);
2893 2864
2894 return true; 2865 return true; // make sure this one deletes
2895 }
2896 2866
2897 return false;
2898} 2867}
2899 2868
2900//----------- destroyNotifyEvent ------------- 2869//----------- destroyNotifyEvent -------------
@@ -2904,9 +2873,9 @@ bool FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
2904//-------------------------------------------- 2873//--------------------------------------------
2905bool FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) { 2874bool FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) {
2906 if (de->window == client.window) { 2875 if (de->window == client.window) {
2907 #ifdef DEBUG 2876#ifdef DEBUG
2908 cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl; 2877 cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl;
2909 #endif 2878#endif // DEBUG
2910 XUnmapWindow(display, frame.window); 2879 XUnmapWindow(display, frame.window);
2911 return true; 2880 return true;
2912 } 2881 }
@@ -3746,7 +3715,7 @@ void FluxboxWindow::checkTransient() {
3746 3715
3747 while (tr->client.transient) { 3716 while (tr->client.transient) {
3748 tr = tr->client.transient; 3717 tr = tr->client.transient;
3749 if (tr == tr->client.transient) { //ops! something is wrong with transient 3718 if (tr && tr == tr->client.transient) { //ops! something is wrong with transient
3750 tr->client.transient = 0; 3719 tr->client.transient = 0;
3751 } 3720 }
3752 } 3721 }
@@ -3761,7 +3730,7 @@ void FluxboxWindow::checkTransient() {
3761 3730
3762 while (tr->client.transient) { 3731 while (tr->client.transient) {
3763 tr = tr->client.transient; 3732 tr = tr->client.transient;
3764 if (tr == tr->client.transient) { //ops! somehtin is wrong with transient 3733 if (tr && tr == tr->client.transient) { //ops! somehtin is wrong with transient
3765 tr->client.transient = 0; 3734 tr->client.transient = 0;
3766 } 3735 }
3767 } 3736 }
@@ -3779,7 +3748,7 @@ void FluxboxWindow::checkTransient() {
3779 3748
3780} 3749}
3781 3750
3782void FluxboxWindow::restore() { 3751void FluxboxWindow::restore(bool remap) {
3783 XChangeSaveSet(display, client.window, SetModeDelete); 3752 XChangeSaveSet(display, client.window, SetModeDelete);
3784 XSelectInput(display, client.window, NoEventMask); 3753 XSelectInput(display, client.window, NoEventMask);
3785 3754
@@ -3789,11 +3758,23 @@ void FluxboxWindow::restore() {
3789 XUnmapWindow(display, client.window); 3758 XUnmapWindow(display, client.window);
3790 3759
3791 XSetWindowBorderWidth(display, client.window, client.old_bw); 3760 XSetWindowBorderWidth(display, client.window, client.old_bw);
3792 XReparentWindow(display, client.window, screen->getRootWindow(), 3761 XEvent dummy;
3793 client.x, client.y); 3762 if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
3794 XMapWindow(display, client.window); 3763 &dummy)) {
3795 3764#ifdef DEBUG
3796 XFlush(display); 3765 fprintf(stderr,
3766 I18n::instance()->getMessage(
3767 FBNLS::WindowSet, FBNLS::WindowUnmapNotifyReparent,
3768 "FluxboxWindow::restore: reparent 0x%lx to "
3769 "root.\n"), client.window);
3770#endif // DEBUG
3771 XReparentWindow(display, client.window, screen->getRootWindow(),
3772 client.x, client.y);
3773 }
3774
3775 if (remap)
3776 XMapWindow(display, client.window);
3777
3797} 3778}
3798 3779
3799 3780