aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-09-07 20:16:43 (GMT)
committerfluxgen <fluxgen>2002-09-07 20:16:43 (GMT)
commit54d855ee5947d6575d04d2a26cf5132df1f003ec (patch)
tree89bd7d00fc08c8ea35c63758aa354348f76968e7 /src/Window.cc
parentd1bd3245b4e1c949874f1fa9d18cd223b20cc28f (diff)
downloadfluxbox-54d855ee5947d6575d04d2a26cf5132df1f003ec.zip
fluxbox-54d855ee5947d6575d04d2a26cf5132df1f003ec.tar.bz2
removed gnome stuff
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc303
1 files changed, 16 insertions, 287 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 2c6499e..2df8f30 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.78 2002/09/07 10:41:26 fluxgen Exp $ 25// $Id: Window.cc,v 1.79 2002/09/07 20:16:43 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -57,6 +57,9 @@
57using namespace std; 57using namespace std;
58 58
59FluxboxWindow::FluxboxWindow(Window w, BScreen *s): 59FluxboxWindow::FluxboxWindow(Window w, BScreen *s):
60m_hintsig(*this),
61m_statesig(*this),
62m_workspacesig(*this),
60image_ctrl(0), 63image_ctrl(0),
61moving(false), resizing(false), shaded(false), maximized(false), 64moving(false), resizing(false), shaded(false), maximized(false),
62visible(false), iconic(false), transient(false), focused(false), 65visible(false), iconic(false), transient(false), focused(false),
@@ -67,11 +70,7 @@ display(0),
67lastButtonPressTime(0), 70lastButtonPressTime(0),
68windowmenu(0), 71windowmenu(0),
69m_layer(LAYER_NORMAL), 72m_layer(LAYER_NORMAL),
70tab(0) 73tab(0) {
71#ifdef GNOME
72,gnome_hints(0)
73#endif
74{
75 74
76 lastFocusTime.tv_sec = lastFocusTime.tv_usec = 0; 75 lastFocusTime.tv_sec = lastFocusTime.tv_usec = 0;
77#ifdef DEBUG 76#ifdef DEBUG
@@ -324,9 +323,6 @@ tab(0)
324 323
325 setFocusFlag(false); 324 setFocusFlag(false);
326 325
327#ifdef GNOME
328 updateGnomeAtoms();
329#endif // GNOME
330 326
331#ifdef DEBUG 327#ifdef DEBUG
332 fprintf(stderr, "%s(%d): FluxboxWindow(this=%p)\n", __FILE__, __LINE__, this); 328 fprintf(stderr, "%s(%d): FluxboxWindow(this=%p)\n", __FILE__, __LINE__, this);
@@ -447,33 +443,6 @@ FluxboxWindow::~FluxboxWindow() {
447 #endif 443 #endif
448} 444}
449 445
450void FluxboxWindow::showError(FluxboxWindow::Error error) {
451
452#ifdef DEBUG
453 switch (error) {
454 case NOERROR:
455 break;
456 case XGETWINDOWATTRIB:
457 fprintf(stderr,
458 I18n::instance()->
459 getMessage(
460 FBNLS::WindowSet, FBNLS::WindowXGetWindowAttributesFail,
461 "FluxboxWindow::FluxboxWindow(): XGetWindowAttributes "
462 "failed\n")
463 );
464 break;
465 case CANTFINDSCREEN:
466 fprintf(stderr,
467 I18n::instance()->
468 getMessage(
469 FBNLS::WindowSet, FBNLS::WindowCannotFindScreen,
470 "FluxboxWindow::FluxboxWindow(): can't find screen\n"
471 " for root window"));
472 break;
473 };
474#endif // DEBUG
475}
476
477Window FluxboxWindow::createToplevelWindow( 446Window FluxboxWindow::createToplevelWindow(
478 int x, int y, unsigned int width, 447 int x, int y, unsigned int width,
479 unsigned int height, 448 unsigned int height,
@@ -791,232 +760,6 @@ void FluxboxWindow::createButton(int type, ButtonEventProc pressed, ButtonEventP
791 buttonlist.push_back(b); 760 buttonlist.push_back(b);
792} 761}
793 762
794#ifdef GNOME
795//TODO
796void FluxboxWindow::updateGnomeAtoms() const {
797 updateGnomeStateAtom();
798 updateGnomeLayerAtom();
799 updateGnomeWorkspaceAtom();
800}
801
802void FluxboxWindow::updateGnomeStateAtom() const {
803 int val = getGnomeWindowState();
804 XChangeProperty(display, client.window, FbAtoms::instance()->getGnomeStateAtom(),
805 XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1);
806}
807
808void FluxboxWindow::updateGnomeLayerAtom() const {
809 int val = getGnomeLayer();
810 XChangeProperty(display, client.window, FbAtoms::instance()->getGnomeLayerAtom(),
811 XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1);
812}
813
814void FluxboxWindow::updateGnomeWorkspaceAtom() const {
815 int val = workspace_number;
816 XChangeProperty(display, client.window, FbAtoms::instance()->getGnomeWorkspaceAtom(),
817 XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1);
818}
819
820//TODO
821int FluxboxWindow::getGnomeWindowState() const {
822 int state=0;
823 if (isStuck())
824 state |= WIN_STATE_STICKY;
825 if (isIconic())
826 state |= WIN_STATE_MINIMIZED;
827 if (isShaded())
828 state |= WIN_STATE_SHADED;
829 /*TODO: states:
830 WIN_STATE_MAXIMIZED_VERT // window in maximized V state
831 WIN_STATE_MAXIMIZED_HORIZ // window in maximized H state
832 WIN_STATE_HIDDEN // not on taskbar but window visible
833 WIN_STATE_HID_WORKSPACE // not on current desktop
834 WIN_STATE_HID_TRANSIENT // owner of transient is hidden
835 WIN_STATE_FIXED_POSITION // window is fixed in position even
836 WIN_STATE_ARRANGE_IGNORE // ignore for auto arranging
837 */
838 return state;
839}
840
841//TODO
842int FluxboxWindow::getGnomeLayer() const {
843 switch (m_layer) {
844 case LAYER_NORMAL:
845 return WIN_LAYER_NORMAL;
846 case LAYER_BOTTOM:
847 return WIN_LAYER_BELOW;
848 case LAYER_TOP:
849 return WIN_LAYER_ONTOP;
850 case LAYER_BELOW:
851 return WIN_LAYER_BELOW;
852 default:
853 break;
854 }
855 return WIN_LAYER_NORMAL;
856}
857
858bool FluxboxWindow::handleGnomePropertyNotify(Atom atom) {
859 FbAtoms *fba = FbAtoms::instance();
860
861 if (atom == fba->getGnomeStateAtom()) {
862 #ifdef DEBUG
863 cerr<<__FILE__<<"("<<__LINE__<<"): gnome state"<<endl;
864 #endif
865 loadGnomeStateAtom();
866 } else if (atom == fba->getGnomeWorkspaceAtom()) {
867 #ifdef DEBUG
868 cerr<<__FILE__<<"("<<__LINE__<<"): gnome workspace"<<endl;
869 #endif
870 } else if (atom == fba->getGnomeHintsAtom()) {
871 #ifdef DEBUG
872 cerr<<__FILE__<<"("<<__LINE__<<"): gnome hints"<<endl;
873 #endif
874 loadGnomeHintsAtom();
875 } else if (atom == fba->getGnomeLayerAtom()){
876 #ifdef DEBUG
877 cerr<<__FILE__<<"("<<__LINE__<<"): gnome layer"<<endl;
878 #endif
879 loadGnomeLayerAtom();
880 } else
881 return false;
882
883 return true;
884}
885
886//TODO
887void FluxboxWindow::setGnomeState(int state) {
888 #ifdef DEBUG
889 cerr<<"state=0x"<<hex<<state<<dec<<endl;
890 #endif
891
892 if ( state & WIN_STATE_STICKY) {
893 cerr<<"Sticky"<<endl;
894 if (!isStuck())
895 stick();
896 } else if (isStuck())
897 stick();
898
899 if (state & WIN_STATE_MINIMIZED) {
900 cerr<<"Minimized"<<endl;
901 if (isIconic())
902 iconify();
903 } else if (isIconic())
904 deiconify(true, true);
905 /* TODO
906 if (state & WIN_STATE_MAXIMIZED_VERT)
907 cerr<<"Maximize Vert"<<endl;
908 if (state & WIN_STATE_MAXIMIZED_HORIZ)
909 cerr<<"Maximize Horiz"<<endl;
910 if (state & WIN_STATE_HIDDEN)
911 cerr<<"Hidden"<<endl;
912 if (state & WIN_STATE_SHADED) {
913 cerr<<"Shaded"<<endl;
914 if (!isShaded()) shade();
915 } else if (isShaded())
916 shade();
917
918 if (state & WIN_STATE_HID_WORKSPACE)
919 cerr<<"HID Workspace"<<endl;
920 if (state & WIN_STATE_HID_TRANSIENT)
921 cerr<<"HID Transient"<<endl;
922 if (state & WIN_STATE_FIXED_POSITION)
923 cerr<<"Fixed Position"<<endl;
924 if (state & WIN_STATE_ARRANGE_IGNORE)
925 cerr<<"Arrange Ignore"<<endl;
926 */
927}
928
929void FluxboxWindow::setGnomeLayer(int layer) {
930 switch (layer) {
931 case WIN_LAYER_DESKTOP:
932 m_layer = LAYER_BOTTOM;
933 break;
934 case WIN_LAYER_BELOW:
935 m_layer = LAYER_BELOW;
936 break;
937 case WIN_LAYER_NORMAL:
938 m_layer = LAYER_NORMAL;
939 break;
940 case WIN_LAYER_ONTOP:
941 case WIN_LAYER_DOCK:
942 case WIN_LAYER_ABOVE_DOCK:
943 case WIN_LAYER_MENU:
944 m_layer = LAYER_TOP;
945 break;
946 default:
947 m_layer = LAYER_NORMAL;
948 break;
949 }
950}
951//------------ loadGnomeAtoms ------------
952// Loads the values from the atoms
953//----------------------------------------
954void FluxboxWindow::loadGnomeAtoms() {
955 loadGnomeStateAtom();
956 loadGnomeHintsAtom();
957 loadGnomeLayerAtom();
958}
959//----------- loadGnomeStateAtom -------
960// Gets gnome state from the atom
961//----------------------------------------
962void FluxboxWindow::loadGnomeStateAtom() {
963 Atom ret_type;
964 int fmt;
965 unsigned long nitems, bytes_after;
966 long flags, *data = 0;
967
968 if (XGetWindowProperty (display, getClientWindow(),
969 FbAtoms::instance()->getGnomeStateAtom(), 0, 1, False, XA_CARDINAL,
970 &ret_type, &fmt, &nitems, &bytes_after,
971 (unsigned char **) &data) == Success && data) {
972 flags = *data;
973 setGnomeState(flags);
974 XFree (data);
975 }
976}
977
978//--------- loadGnomeHintsAtom ---------
979// Gets the gnome hint from the atom
980//----------------------------------------
981void FluxboxWindow::loadGnomeHintsAtom() {
982 Atom ret_type;
983 int fmt;
984 unsigned long nitems, bytes_after;
985 long *data = 0;
986
987 if (XGetWindowProperty (display, getClientWindow(),
988 FbAtoms::instance()->getGnomeHintsAtom(), 0, 1, False, XA_CARDINAL,
989 &ret_type, &fmt, &nitems, &bytes_after,
990 (unsigned char **) &data) == Success && data) {
991 gnome_hints = static_cast<int>(*data);
992 #ifdef DEBUG
993 cerr<<__FILE__<<"("<<__LINE__<<"): gnome hints:0x"<<hex<<gnome_hints<<dec<<endl;
994 #endif
995 XFree (data);
996 }
997}
998//---------- loadGnomeLayerAtom ------------
999// Gets the gnome layer from the atom
1000//------------------------------------------
1001void FluxboxWindow::loadGnomeLayerAtom() {
1002 Atom ret_type;
1003 int fmt;
1004 unsigned long nitems, bytes_after;
1005 long *data = 0;
1006
1007 if (XGetWindowProperty (display, getClientWindow(),
1008 FbAtoms::instance()->getGnomeLayerAtom(), 0, 1, False, XA_CARDINAL,
1009 &ret_type, &fmt, &nitems, &bytes_after,
1010 (unsigned char **) &data) == Success && data) {
1011 setGnomeLayer(static_cast<int>(*data));
1012 #ifdef DEBUG
1013 cerr<<__FILE__<<"("<<__LINE__<<"): gnome hints:0x"<<hex<<*data<<dec<<endl;
1014 #endif
1015 XFree (data);
1016 }
1017}
1018#endif //!GNOME
1019
1020#ifdef NEWWMSPEC 763#ifdef NEWWMSPEC
1021//TODO!! 764//TODO!!
1022 765
@@ -1757,11 +1500,8 @@ void FluxboxWindow::configure(int dx, int dy,
1757 1500
1758 1501
1759bool FluxboxWindow::setInputFocus() { 1502bool FluxboxWindow::setInputFocus() {
1760#ifdef GNOME 1503 //TODO hint skip focus
1761 if (gnome_hints & WIN_HINTS_SKIP_FOCUS) 1504
1762 return false;
1763#endif // GNOME
1764
1765 if (((signed) (frame.x + frame.width)) < 0) { 1505 if (((signed) (frame.x + frame.width)) < 0) {
1766 if (((signed) (frame.y + frame.y_border)) < 0) 1506 if (((signed) (frame.y + frame.y_border)) < 0)
1767 configure(screen->getBorderWidth(), screen->getBorderWidth(), 1507 configure(screen->getBorderWidth(), screen->getBorderWidth(),
@@ -1889,10 +1629,6 @@ void FluxboxWindow::iconify() {
1889 client.transient->iconify(); 1629 client.transient->iconify();
1890 } 1630 }
1891 1631
1892#ifdef GNOME
1893 updateGnomeStateAtom();
1894#endif // GNOME
1895
1896} 1632}
1897 1633
1898 1634
@@ -2285,9 +2021,12 @@ void FluxboxWindow::setWorkspace(int n) {
2285 2021
2286 blackbox_attrib.flags |= BaseDisplay::ATTRIB_WORKSPACE; 2022 blackbox_attrib.flags |= BaseDisplay::ATTRIB_WORKSPACE;
2287 blackbox_attrib.workspace = workspace_number; 2023 blackbox_attrib.workspace = workspace_number;
2288 #ifdef GNOME 2024
2289 updateGnomeWorkspaceAtom(); 2025 // notify workspace change
2290 #endif 2026#ifdef DEBUG
2027 cerr<<this<<" notify workspace signal"<<endl;
2028#endif // DEBUG
2029 m_workspacesig.notify();
2291} 2030}
2292 2031
2293 2032
@@ -2308,9 +2047,6 @@ void FluxboxWindow::shade() {
2308 2047
2309 setState(IconicState); 2048 setState(IconicState);
2310 } 2049 }
2311 #ifdef GNOME
2312 updateGnomeStateAtom();
2313 #endif
2314 } 2050 }
2315} 2051}
2316 2052
@@ -2339,9 +2075,6 @@ void FluxboxWindow::stick() {
2339 //find a STICK button in window 2075 //find a STICK button in window
2340 redrawAllButtons(); 2076 redrawAllButtons();
2341 setState(current_state); 2077 setState(current_state);
2342 #ifdef GNOME
2343 updateGnomeStateAtom();
2344 #endif
2345} 2078}
2346 2079
2347 2080
@@ -2468,6 +2201,9 @@ void FluxboxWindow::setState(unsigned long new_state) {
2468 XChangeProperty(display, client.window, fluxbox->getFluxboxAttributesAtom(), 2201 XChangeProperty(display, client.window, fluxbox->getFluxboxAttributesAtom(),
2469 fluxbox->getFluxboxAttributesAtom(), 32, PropModeReplace, 2202 fluxbox->getFluxboxAttributesAtom(), 32, PropModeReplace,
2470 (unsigned char *) &blackbox_attrib, PropBlackboxAttributesElements); 2203 (unsigned char *) &blackbox_attrib, PropBlackboxAttributesElements);
2204
2205 //notify state changed
2206 m_statesig.notify();
2471} 2207}
2472 2208
2473//TODO: why ungrab in if-statement? 2209//TODO: why ungrab in if-statement?
@@ -2809,10 +2545,6 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent *re) {
2809 2545
2810 2546
2811void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) { 2547void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) {
2812#ifdef GNOME
2813 loadGnomeAtoms();
2814#endif // GNOME
2815
2816 if ((ne->window == client.window) && (! ne->override_redirect) && (visible)) { 2548 if ((ne->window == client.window) && (! ne->override_redirect) && (visible)) {
2817 Fluxbox *fluxbox = Fluxbox::instance(); 2549 Fluxbox *fluxbox = Fluxbox::instance();
2818 fluxbox->grab(); 2550 fluxbox->grab();
@@ -2979,9 +2711,6 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) {
2979 } 2711 }
2980 } else { 2712 } else {
2981 bool val = false; 2713 bool val = false;
2982 #ifdef GNOME
2983 val = handleGnomePropertyNotify(atom);
2984 #endif
2985 #ifdef NEWWMSPEC 2714 #ifdef NEWWMSPEC
2986 if (!val) 2715 if (!val)
2987 handleNETWMPropertyNotify(atom); 2716 handleNETWMPropertyNotify(atom);