2002-01-09 14:11:20 +00:00
|
|
|
// Window.hh for Fluxbox Window Manager
|
2006-02-16 06:53:05 +00:00
|
|
|
// Copyright (c) 2001 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
2001-12-19 13:53:35 +00:00
|
|
|
//
|
2001-12-11 20:47:02 +00:00
|
|
|
// Window.hh for Blackbox - an X11 Window manager
|
2002-12-13 20:35:36 +00:00
|
|
|
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)
|
2001-12-11 20:47:02 +00:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
2003-01-05 22:20:46 +00:00
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
2001-12-11 20:47:02 +00:00
|
|
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
#ifndef WINDOW_HH
|
|
|
|
#define WINDOW_HH
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2007-12-26 21:50:44 +00:00
|
|
|
#include "FbTk/DefaultValue.hh"
|
2004-08-10 12:05:47 +00:00
|
|
|
#include "FbTk/Timer.hh"
|
|
|
|
#include "FbTk/Subject.hh"
|
2007-12-22 00:48:11 +00:00
|
|
|
#include "FbTk/Observer.hh"
|
2004-08-10 12:05:47 +00:00
|
|
|
#include "FbTk/EventHandler.hh"
|
|
|
|
#include "FbTk/XLayerItem.hh"
|
2008-09-28 08:46:49 +00:00
|
|
|
#include "FbTk/Signal.hh"
|
2008-08-27 17:05:49 +00:00
|
|
|
|
2003-12-18 18:03:23 +00:00
|
|
|
#include "FbWinFrame.hh"
|
2007-10-13 21:51:37 +00:00
|
|
|
#include "Focusable.hh"
|
2008-01-07 20:08:56 +00:00
|
|
|
#include "FocusableTheme.hh"
|
2007-02-23 17:03:01 +00:00
|
|
|
#include "WinButton.hh"
|
2002-08-11 22:33:41 +00:00
|
|
|
|
2008-09-28 08:46:49 +00:00
|
|
|
|
2007-10-13 21:51:37 +00:00
|
|
|
#include <sys/time.h>
|
2002-02-17 18:47:45 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2002-10-19 10:56:30 +00:00
|
|
|
#include <memory>
|
2003-04-14 15:01:55 +00:00
|
|
|
#include <map>
|
2002-02-17 18:47:45 +00:00
|
|
|
|
2003-04-14 15:01:55 +00:00
|
|
|
class WinClient;
|
2003-01-05 22:20:46 +00:00
|
|
|
class FbWinFrameTheme;
|
2003-01-07 01:34:49 +00:00
|
|
|
class BScreen;
|
2007-12-26 21:50:44 +00:00
|
|
|
class FocusControl;
|
2008-06-20 03:48:26 +00:00
|
|
|
class FbMenu;
|
2003-08-19 16:15:32 +00:00
|
|
|
|
2003-01-07 01:34:49 +00:00
|
|
|
namespace FbTk {
|
2003-08-19 16:15:32 +00:00
|
|
|
class TextButton;
|
2003-01-07 01:34:49 +00:00
|
|
|
class MenuTheme;
|
2003-01-09 22:16:40 +00:00
|
|
|
class ImageControl;
|
2003-02-03 13:53:48 +00:00
|
|
|
class XLayer;
|
2003-12-17 01:21:49 +00:00
|
|
|
}
|
2002-11-15 12:17:03 +00:00
|
|
|
|
2002-12-13 20:35:36 +00:00
|
|
|
/// Creates the window frame and handles any window event for it
|
2007-12-22 00:48:11 +00:00
|
|
|
class FluxboxWindow: public Focusable, public FbTk::Observer,
|
2008-09-28 08:46:49 +00:00
|
|
|
public FbTk::EventHandler,
|
|
|
|
private FbTk::SignalTracker {
|
2001-12-11 20:47:02 +00:00
|
|
|
public:
|
2002-12-13 20:35:36 +00:00
|
|
|
/// Motif wm Hints
|
2002-12-01 13:42:15 +00:00
|
|
|
enum {
|
2002-12-13 20:35:36 +00:00
|
|
|
MwmHintsFunctions = (1l << 0), ///< use motif wm functions
|
2007-12-29 21:38:53 +00:00
|
|
|
MwmHintsDecorations = (1l << 1) ///< use motif wm decorations
|
2002-12-01 13:42:15 +00:00
|
|
|
};
|
2004-12-21 16:17:14 +00:00
|
|
|
|
2002-12-13 20:35:36 +00:00
|
|
|
/// Motif wm functions
|
2002-12-01 13:42:15 +00:00
|
|
|
enum MwmFunc{
|
2002-12-13 20:35:36 +00:00
|
|
|
MwmFuncAll = (1l << 0), ///< all motif wm functions
|
2004-12-21 16:17:14 +00:00
|
|
|
MwmFuncResize = (1l << 1), ///< resize
|
|
|
|
MwmFuncMove = (1l << 2), ///< move
|
2002-12-13 20:35:36 +00:00
|
|
|
MwmFuncIconify = (1l << 3), ///< iconify
|
|
|
|
MwmFuncMaximize = (1l << 4), ///< maximize
|
|
|
|
MwmFuncClose = (1l << 5) ///< close
|
2002-12-01 13:42:15 +00:00
|
|
|
};
|
2003-01-05 22:20:46 +00:00
|
|
|
|
2002-12-13 20:35:36 +00:00
|
|
|
/// Motif wm decorations
|
2002-12-01 13:42:15 +00:00
|
|
|
enum MwmDecor {
|
2002-12-13 20:35:36 +00:00
|
|
|
MwmDecorAll = (1l << 0), /// all decorations
|
|
|
|
MwmDecorBorder = (1l << 1), /// border
|
|
|
|
MwmDecorHandle = (1l << 2), /// handle
|
|
|
|
MwmDecorTitle = (1l << 3), /// title
|
|
|
|
MwmDecorMenu = (1l << 4), /// menu
|
|
|
|
MwmDecorIconify = (1l << 5), /// iconify
|
|
|
|
MwmDecorMaximize = (1l << 6) /// maximize
|
2002-12-01 13:42:15 +00:00
|
|
|
};
|
2003-01-05 22:20:46 +00:00
|
|
|
|
2007-10-22 17:45:39 +00:00
|
|
|
/// Different resize modes when resizing a window
|
2007-12-29 21:38:53 +00:00
|
|
|
enum ResizeModel {
|
2007-10-22 17:45:39 +00:00
|
|
|
QUADRANTRESIZE, ///< resizes from one quadrant
|
|
|
|
CENTERRESIZE, ///< resizes from center
|
|
|
|
NEARESTEDGERESIZE, ///< resizes the nearest edge
|
|
|
|
TOPLEFTRESIZE, ///< resizes top left corner
|
|
|
|
TOPRESIZE, ///< resizes top edge
|
|
|
|
TOPRIGHTRESIZE, ///< resizes top right corner
|
|
|
|
LEFTRESIZE, ///< resizes left edge
|
|
|
|
RIGHTRESIZE, ///< resizes right edge
|
|
|
|
BOTTOMLEFTRESIZE, ///< resizes bottom left corner
|
|
|
|
BOTTOMRESIZE, ///< resizes bottom edge
|
|
|
|
BOTTOMRIGHTRESIZE, ///< resizes bottom right corner
|
|
|
|
DEFAULTRESIZE = BOTTOMRIGHTRESIZE ///< default resize mode
|
|
|
|
};
|
|
|
|
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
2008-08-18 12:12:30 +00:00
|
|
|
* Reference corner for moves and resizes
|
2007-10-13 21:51:37 +00:00
|
|
|
*/
|
2008-08-18 12:12:30 +00:00
|
|
|
enum ReferenceCorner {
|
|
|
|
ERROR = -1,
|
|
|
|
LEFTTOP = 0,
|
|
|
|
TOP = 1,
|
|
|
|
RIGHTTOP = 2,
|
|
|
|
RIGHT = 3,
|
2006-06-11 13:09:44 +00:00
|
|
|
RIGHTBOTTOM = 4,
|
2007-12-29 21:38:53 +00:00
|
|
|
BOTTOM = 5,
|
2006-06-11 13:09:44 +00:00
|
|
|
LEFTBOTTOM = 6,
|
|
|
|
LEFT = 7,
|
2008-08-18 12:12:30 +00:00
|
|
|
CENTER = 8
|
2003-09-29 12:53:58 +00:00
|
|
|
};
|
|
|
|
|
2003-04-14 15:01:55 +00:00
|
|
|
typedef std::list<WinClient *> ClientList;
|
|
|
|
|
|
|
|
/// create a window from a client
|
2008-08-27 22:29:33 +00:00
|
|
|
FluxboxWindow(WinClient &client);
|
2003-04-14 15:01:55 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
virtual ~FluxboxWindow();
|
2003-01-05 22:20:46 +00:00
|
|
|
|
2003-04-14 15:01:55 +00:00
|
|
|
/// attach client to our client list and remove it from old window
|
2004-11-24 23:26:38 +00:00
|
|
|
void attachClient(WinClient &client, int x=-1, int y=-1);
|
2004-12-21 16:17:14 +00:00
|
|
|
/// detach client (remove it from list) and create a new window for it
|
2003-04-14 15:01:55 +00:00
|
|
|
bool detachClient(WinClient &client);
|
2003-04-16 12:28:39 +00:00
|
|
|
/// detach current working client if we have more than one
|
|
|
|
void detachCurrentClient();
|
2003-04-14 15:01:55 +00:00
|
|
|
/// remove client from client list
|
|
|
|
bool removeClient(WinClient &client);
|
|
|
|
/// set new current client and raise it
|
2003-12-30 20:56:41 +00:00
|
|
|
bool setCurrentClient(WinClient &client, bool setinput = true);
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
2007-12-29 21:38:53 +00:00
|
|
|
* Searches for a client
|
2007-10-13 21:51:37 +00:00
|
|
|
* @param win the client X window
|
|
|
|
* @return pointer to client matching the window or NULL
|
|
|
|
*/
|
2003-04-14 15:01:55 +00:00
|
|
|
WinClient *findClient(Window win);
|
2007-10-13 21:51:37 +00:00
|
|
|
/// select next client
|
2003-04-14 15:01:55 +00:00
|
|
|
void nextClient();
|
2007-10-13 21:51:37 +00:00
|
|
|
/// select previous client
|
2003-04-14 15:01:55 +00:00
|
|
|
void prevClient();
|
2007-10-13 21:51:37 +00:00
|
|
|
/// move the current client to the left
|
2003-07-28 12:42:32 +00:00
|
|
|
void moveClientLeft();
|
2007-10-13 21:51:37 +00:00
|
|
|
/// move the current client to the right
|
2003-07-28 12:42:32 +00:00
|
|
|
void moveClientRight();
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
|
|
|
* Move a client to the right of dest.
|
|
|
|
* @param win the client to move
|
|
|
|
* @param dest the left-of-client
|
|
|
|
*/
|
2004-12-13 12:17:58 +00:00
|
|
|
void moveClientRightOf(WinClient &win, WinClient &dest);
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
|
|
|
* Move a client to the right of dest.
|
|
|
|
* @param win the client to move
|
|
|
|
* @param dest the left-of-client
|
|
|
|
*/
|
2004-12-13 12:17:58 +00:00
|
|
|
void moveClientLeftOf(WinClient &win, WinClient &dest);
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
|
|
|
* Move client to place specified by pixel position
|
|
|
|
* @param win the client to move
|
|
|
|
* @param x position
|
|
|
|
* @param y position
|
|
|
|
*/
|
2004-12-13 12:17:58 +00:00
|
|
|
void moveClientTo(WinClient &win, int x, int y);
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
|
|
|
* Take focus.
|
|
|
|
* @see Focusable
|
|
|
|
* @return true if it took focus.
|
|
|
|
*/
|
|
|
|
bool focus();
|
2007-12-22 05:24:13 +00:00
|
|
|
bool focusRequestFromClient(WinClient &from);
|
2003-01-05 22:20:46 +00:00
|
|
|
|
2007-10-13 21:51:37 +00:00
|
|
|
/// Raises the window and takes focus (if possible).
|
|
|
|
void raiseAndFocus() { raise(); focus(); }
|
|
|
|
/// sets the internal focus flag
|
2003-01-05 22:20:46 +00:00
|
|
|
void setFocusFlag(bool flag);
|
2007-10-13 21:51:37 +00:00
|
|
|
/// make this window visible
|
2003-02-16 17:57:54 +00:00
|
|
|
void show();
|
2007-10-13 21:51:37 +00:00
|
|
|
/// hide window
|
2007-03-10 18:06:09 +00:00
|
|
|
void hide(bool interrupt_moving = true);
|
2007-10-13 21:51:37 +00:00
|
|
|
/// iconify window
|
2003-01-05 22:20:46 +00:00
|
|
|
void iconify();
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
|
|
|
* Deiconify window
|
|
|
|
* @param do_raise raise the window when its been deiconfied
|
|
|
|
*/
|
2007-12-19 07:08:17 +00:00
|
|
|
void deiconify(bool do_raise = true);
|
2007-01-07 11:55:14 +00:00
|
|
|
|
|
|
|
// ------------------
|
|
|
|
// Per window transparency addons
|
2007-10-13 21:51:37 +00:00
|
|
|
unsigned char getFocusedAlpha() const { return frame().getAlpha(true); }
|
|
|
|
unsigned char getUnfocusedAlpha() const { return frame().getAlpha(false); }
|
2007-01-07 11:55:14 +00:00
|
|
|
void setFocusedAlpha(unsigned char alpha) { frame().setAlpha(true, alpha); }
|
|
|
|
void setUnfocusedAlpha(unsigned char alpha) { frame().setAlpha(false, alpha); }
|
|
|
|
void updateAlpha(bool focused, unsigned char alpha) { frame().setAlpha(focused, alpha); }
|
|
|
|
|
|
|
|
bool getUseDefaultAlpha() const { return frame().getUseDefaultAlpha(); }
|
2007-12-27 04:42:10 +00:00
|
|
|
void setDefaultAlpha() { frame().setDefaultAlpha(); }
|
2007-01-07 11:55:14 +00:00
|
|
|
// ------------------
|
|
|
|
|
2003-07-28 15:06:36 +00:00
|
|
|
/// close current client
|
2003-01-05 22:20:46 +00:00
|
|
|
void close();
|
2004-11-30 01:26:00 +00:00
|
|
|
/// kill current client
|
|
|
|
void kill();
|
2004-12-21 16:17:14 +00:00
|
|
|
/// set fullscreen
|
|
|
|
void setFullscreen(bool flag);
|
2003-07-24 03:19:02 +00:00
|
|
|
/// toggle maximize
|
2008-08-27 17:05:49 +00:00
|
|
|
void maximize(int type = WindowState::MAX_FULL);
|
2007-10-23 17:34:30 +00:00
|
|
|
/// sets the maximized state
|
|
|
|
void setMaximizedState(int type);
|
2003-01-05 22:20:46 +00:00
|
|
|
/// maximizes the window horizontal
|
|
|
|
void maximizeHorizontal();
|
|
|
|
/// maximizes the window vertical
|
|
|
|
void maximizeVertical();
|
2003-07-24 03:19:02 +00:00
|
|
|
/// maximizes the window fully
|
|
|
|
void maximizeFull();
|
2003-01-05 22:20:46 +00:00
|
|
|
/// toggles shade
|
|
|
|
void shade();
|
2005-09-07 16:46:17 +00:00
|
|
|
/// shades window
|
|
|
|
void shadeOn();
|
|
|
|
/// unshades window
|
|
|
|
void shadeOff();
|
2007-12-27 21:55:24 +00:00
|
|
|
/// sets shaded state
|
|
|
|
void setShaded(bool val);
|
2003-01-05 22:20:46 +00:00
|
|
|
/// toggles sticky
|
2004-12-21 16:17:14 +00:00
|
|
|
void stick();
|
2007-12-27 21:55:24 +00:00
|
|
|
/// sets stuck state
|
|
|
|
void setStuck(bool val);
|
2007-01-07 11:55:14 +00:00
|
|
|
/// toggles iconic
|
|
|
|
void toggleIconic();
|
2007-12-27 21:55:24 +00:00
|
|
|
/// sets iconic state
|
|
|
|
void setIconic(bool val);
|
2003-01-05 22:20:46 +00:00
|
|
|
void raise();
|
2003-02-09 14:11:14 +00:00
|
|
|
void lower();
|
2003-04-15 23:09:26 +00:00
|
|
|
void tempRaise();
|
2009-06-28 17:15:06 +00:00
|
|
|
void changeLayer(int diff);
|
2007-10-13 21:51:37 +00:00
|
|
|
/// moves the window to a new layer
|
2007-02-04 18:44:28 +00:00
|
|
|
void moveToLayer(int layernum, bool force = false);
|
2007-10-24 03:44:39 +00:00
|
|
|
int getOnHead() const;
|
2007-10-23 17:34:30 +00:00
|
|
|
void setOnHead(int head);
|
2007-10-13 21:51:37 +00:00
|
|
|
/// sets the window focus hidden state
|
2007-10-24 17:09:26 +00:00
|
|
|
void placeWindow(int head);
|
2004-02-20 09:07:27 +00:00
|
|
|
void setFocusHidden(bool value);
|
2007-10-13 21:51:37 +00:00
|
|
|
/// sets the window icon hidden state
|
2004-02-20 09:07:27 +00:00
|
|
|
void setIconHidden(bool value);
|
2007-12-25 21:05:07 +00:00
|
|
|
/// sets whether or not the window normally gets focus when mapped
|
|
|
|
void setFocusNew(bool value) { m_focus_new = value; }
|
|
|
|
/// sets whether or not the window gets focused with mouse
|
|
|
|
void setMouseFocus(bool value) { m_mouse_focus = value; }
|
|
|
|
/// sets whether or not the window gets focused with click
|
|
|
|
void setClickFocus(bool value) { m_click_focus = value; }
|
2003-01-05 22:20:46 +00:00
|
|
|
void reconfigure();
|
2003-07-28 12:42:32 +00:00
|
|
|
|
2003-07-20 08:12:36 +00:00
|
|
|
|
2003-01-05 22:20:46 +00:00
|
|
|
void installColormap(bool);
|
2003-04-14 15:01:55 +00:00
|
|
|
void restore(WinClient *client, bool remap);
|
2003-01-05 22:20:46 +00:00
|
|
|
void restore(bool remap);
|
|
|
|
/// move frame to x, y
|
2006-07-03 17:18:17 +00:00
|
|
|
void move(int x, int y);
|
2003-01-05 22:20:46 +00:00
|
|
|
/// resize frame to width, height
|
|
|
|
void resize(unsigned int width, unsigned int height);
|
|
|
|
/// move and resize frame to pox x,y and size width, height
|
2006-07-03 17:18:17 +00:00
|
|
|
void moveResize(int x, int y, unsigned int width, unsigned int height, bool send_event = false);
|
2005-03-16 23:19:36 +00:00
|
|
|
/// move to pos x,y and resize client window to size width, height
|
2006-07-03 17:18:17 +00:00
|
|
|
void moveResizeForClient(int x, int y, unsigned int width, unsigned int height, int gravity = ForgetGravity, unsigned int client_bw = 0);
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
|
|
|
* Determines maximum size using all clients that this window can have.
|
2007-12-29 21:38:53 +00:00
|
|
|
* @param width will be filled in with maximum width
|
2007-10-13 21:51:37 +00:00
|
|
|
* @param height will be filled in with maximum height
|
|
|
|
*/
|
2008-08-15 17:38:41 +00:00
|
|
|
void getMaxSize(unsigned int* width, unsigned int* height) const;
|
2005-01-05 05:37:06 +00:00
|
|
|
void setWorkspace(int n);
|
2003-07-28 16:29:25 +00:00
|
|
|
void updateFunctions();
|
2007-10-13 21:51:37 +00:00
|
|
|
/**
|
|
|
|
* Show window meny at at given position
|
|
|
|
* @param mx position
|
|
|
|
* @param my position
|
|
|
|
*/
|
|
|
|
void showMenu(int mx, int my);
|
2008-05-13 13:50:17 +00:00
|
|
|
|
|
|
|
/** popup window menu at specific location
|
|
|
|
* @param x
|
|
|
|
* @param y
|
|
|
|
*/
|
|
|
|
void popupMenu(int x, int y);
|
2003-01-07 01:34:49 +00:00
|
|
|
// popup menu on last button press position
|
|
|
|
void popupMenu();
|
|
|
|
|
2003-01-05 22:20:46 +00:00
|
|
|
/**
|
|
|
|
@name event handlers
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
void handleEvent(XEvent &event);
|
2007-10-13 21:51:37 +00:00
|
|
|
void keyPressEvent(XKeyEvent &ke);
|
2003-01-05 22:20:46 +00:00
|
|
|
void buttonPressEvent(XButtonEvent &be);
|
|
|
|
void buttonReleaseEvent(XButtonEvent &be);
|
|
|
|
void motionNotifyEvent(XMotionEvent &me);
|
|
|
|
void destroyNotifyEvent(XDestroyWindowEvent &dwe);
|
|
|
|
void mapRequestEvent(XMapRequestEvent &mre);
|
|
|
|
void mapNotifyEvent(XMapEvent &mapev);
|
|
|
|
void unmapNotifyEvent(XUnmapEvent &unmapev);
|
|
|
|
void exposeEvent(XExposeEvent &ee);
|
|
|
|
void configureRequestEvent(XConfigureRequestEvent &ce);
|
2003-09-24 14:02:25 +00:00
|
|
|
void propertyNotifyEvent(WinClient &client, Atom a);
|
2003-02-22 15:10:43 +00:00
|
|
|
void enterNotifyEvent(XCrossingEvent &ev);
|
|
|
|
void leaveNotifyEvent(XCrossingEvent &ev);
|
2003-01-05 22:20:46 +00:00
|
|
|
//@}
|
|
|
|
|
2007-12-22 00:48:11 +00:00
|
|
|
/// handle Subject notifications
|
|
|
|
void update(FbTk::Subject *subj);
|
|
|
|
|
2008-05-24 08:03:59 +00:00
|
|
|
void applyDecorations();
|
2003-01-05 22:20:46 +00:00
|
|
|
void toggleDecoration();
|
2003-06-23 14:16:05 +00:00
|
|
|
|
2003-05-15 11:17:29 +00:00
|
|
|
unsigned int decorationMask() const;
|
2007-01-04 19:13:55 +00:00
|
|
|
void setDecorationMask(unsigned int mask, bool apply = true);
|
2006-06-11 13:09:44 +00:00
|
|
|
/**
|
|
|
|
* Start moving process, grabs the pointer and draws move rectangle
|
|
|
|
* @param x position of pointer
|
|
|
|
* @param y position of pointer
|
|
|
|
*/
|
|
|
|
void startMoving(int x, int y);
|
|
|
|
/**
|
|
|
|
* Stop moving process
|
|
|
|
* @param interrupted whether the move was interrupted by hide or destroy
|
|
|
|
*/
|
|
|
|
void stopMoving(bool interrupted = false);
|
|
|
|
/**
|
|
|
|
* Starts resizing process
|
|
|
|
* @param x start position
|
|
|
|
* @param y start position
|
|
|
|
* @param dir the resize direction
|
|
|
|
*/
|
2008-08-18 12:12:30 +00:00
|
|
|
void startResizing(int x, int y, ReferenceCorner dir);
|
2007-10-22 17:45:39 +00:00
|
|
|
/// determine which edge or corner to resize
|
2008-08-18 12:12:30 +00:00
|
|
|
ReferenceCorner getResizeDirection(int x, int y, ResizeModel model) const;
|
2006-06-11 13:09:44 +00:00
|
|
|
/// stops the resizing
|
|
|
|
void stopResizing(bool interrupted = false);
|
2007-12-21 07:07:46 +00:00
|
|
|
/// starts tabbing
|
|
|
|
void startTabbing(const XButtonEvent &be);
|
2003-04-26 05:42:36 +00:00
|
|
|
|
2008-08-18 12:12:30 +00:00
|
|
|
/// determine the reference corner from a string
|
|
|
|
static ReferenceCorner getCorner(std::string str);
|
|
|
|
/// convert to coordinates on the root window
|
|
|
|
void translateCoords(int &x, int &y, ReferenceCorner dir = LEFTTOP) const;
|
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
/**
|
2004-12-21 16:17:14 +00:00
|
|
|
@name accessors
|
2002-12-01 13:42:15 +00:00
|
|
|
*/
|
|
|
|
//@{
|
2007-12-29 21:38:53 +00:00
|
|
|
|
2004-12-21 16:17:14 +00:00
|
|
|
// whether this window can be tabbed with other windows,
|
2004-06-20 04:49:33 +00:00
|
|
|
// and others tabbed with it
|
2007-12-29 21:38:53 +00:00
|
|
|
void setTabable(bool tabable) { functions.tabable = tabable; }
|
2008-08-15 11:39:24 +00:00
|
|
|
bool isTabable() const { return functions.tabable; }
|
2007-12-29 21:38:53 +00:00
|
|
|
void setMovable(bool movable) { functions.move = movable; }
|
|
|
|
void setResizable(bool resizable) { functions.resize = resizable; }
|
|
|
|
|
2008-08-27 22:29:33 +00:00
|
|
|
bool isFocusHidden() const { return m_state.focus_hidden; }
|
|
|
|
bool isIconHidden() const { return m_state.icon_hidden; }
|
2007-12-29 21:38:53 +00:00
|
|
|
bool isManaged() const { return m_initialized; }
|
2003-05-15 11:17:29 +00:00
|
|
|
bool isVisible() const;
|
2008-08-27 22:29:33 +00:00
|
|
|
bool isIconic() const { return m_state.iconic; }
|
2008-08-27 20:29:35 +00:00
|
|
|
bool isShaded() const { return m_state.shaded; }
|
|
|
|
bool isFullscreen() const { return m_state.fullscreen; }
|
|
|
|
bool isMaximized() const { return m_state.isMaximized(); }
|
|
|
|
bool isMaximizedVert() const { return m_state.isMaximizedVert(); }
|
|
|
|
bool isMaximizedHorz() const { return m_state.isMaximizedHorz(); }
|
|
|
|
int maximizedState() const { return m_state.maximized; }
|
2007-12-29 21:38:53 +00:00
|
|
|
bool isIconifiable() const { return functions.iconify; }
|
|
|
|
bool isMaximizable() const { return functions.maximize; }
|
|
|
|
bool isResizable() const { return functions.resize; }
|
|
|
|
bool isClosable() const { return functions.close; }
|
|
|
|
bool isMoveable() const { return functions.move; }
|
2008-08-27 22:29:33 +00:00
|
|
|
bool isStuck() const { return m_state.stuck; }
|
2007-12-29 21:38:53 +00:00
|
|
|
bool hasTitlebar() const { return decorations.titlebar; }
|
|
|
|
bool isMoving() const { return moving; }
|
|
|
|
bool isResizing() const { return resizing; }
|
2002-12-01 13:42:15 +00:00
|
|
|
bool isGroupable() const;
|
2007-12-29 21:38:53 +00:00
|
|
|
int numClients() const { return m_clientlist.size(); }
|
|
|
|
bool empty() const { return m_clientlist.empty(); }
|
|
|
|
ClientList &clientList() { return m_clientlist; }
|
|
|
|
const ClientList &clientList() const { return m_clientlist; }
|
|
|
|
WinClient &winClient() { return *m_client; }
|
|
|
|
const WinClient &winClient() const { return *m_client; }
|
2003-04-14 15:01:55 +00:00
|
|
|
|
2008-08-15 11:39:24 +00:00
|
|
|
bool isTyping() const;
|
2003-04-14 15:01:55 +00:00
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
const FbTk::XLayerItem &layerItem() const { return m_frame.layerItem(); }
|
|
|
|
FbTk::XLayerItem &layerItem() { return m_frame.layerItem(); }
|
2003-04-14 15:01:55 +00:00
|
|
|
|
2003-05-15 11:17:29 +00:00
|
|
|
Window clientWindow() const;
|
2002-09-08 19:49:39 +00:00
|
|
|
|
2003-05-15 11:17:29 +00:00
|
|
|
FbTk::FbWindow &fbWindow();
|
|
|
|
const FbTk::FbWindow &fbWindow() const;
|
2003-02-18 15:11:12 +00:00
|
|
|
|
2008-06-20 03:48:26 +00:00
|
|
|
FbMenu &menu();
|
|
|
|
const FbMenu &menu() const;
|
2003-05-10 23:04:37 +00:00
|
|
|
|
|
|
|
const FbTk::FbWindow &parent() const { return m_parent; }
|
|
|
|
FbTk::FbWindow &parent() { return m_parent; }
|
|
|
|
|
2007-10-13 21:51:37 +00:00
|
|
|
bool acceptsFocus() const;
|
|
|
|
const FbTk::PixmapWithMask &icon() const;
|
2003-05-15 11:17:29 +00:00
|
|
|
const std::string &title() const;
|
2007-12-29 21:38:53 +00:00
|
|
|
const std::string &getWMClassName() const;
|
2007-10-13 21:51:37 +00:00
|
|
|
const std::string &getWMClassClass() const;
|
|
|
|
std::string getWMRole() const;
|
2008-08-27 22:29:33 +00:00
|
|
|
void setWindowType(WindowState::WindowType type);
|
2007-10-14 18:05:31 +00:00
|
|
|
bool isTransient() const;
|
2007-10-13 21:51:37 +00:00
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
int x() const { return frame().x(); }
|
|
|
|
int y() const { return frame().y(); }
|
|
|
|
unsigned int width() const { return frame().width(); }
|
|
|
|
unsigned int height() const { return frame().height(); }
|
2003-12-18 18:03:23 +00:00
|
|
|
|
2008-08-27 20:29:35 +00:00
|
|
|
int normalX() const { return m_state.x; }
|
|
|
|
int normalY() const { return m_state.y; }
|
|
|
|
unsigned int normalWidth() const { return m_state.width; }
|
|
|
|
unsigned int normalHeight() const { return m_state.height; }
|
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
int xOffset() const { return frame().xOffset(); }
|
|
|
|
int yOffset() const { return frame().yOffset(); }
|
|
|
|
int widthOffset() const { return frame().widthOffset(); }
|
|
|
|
int heightOffset() const { return frame().heightOffset(); }
|
2006-03-20 11:31:24 +00:00
|
|
|
|
2003-05-15 11:17:29 +00:00
|
|
|
unsigned int workspaceNumber() const { return m_workspace_number; }
|
2003-06-24 14:57:54 +00:00
|
|
|
|
2008-08-27 22:29:33 +00:00
|
|
|
int layerNum() const { return m_state.layernum; }
|
2003-02-02 16:32:41 +00:00
|
|
|
void setLayerNum(int layernum);
|
2004-12-21 16:17:14 +00:00
|
|
|
|
2003-05-21 23:59:54 +00:00
|
|
|
unsigned int titlebarHeight() const;
|
2003-06-15 18:35:32 +00:00
|
|
|
|
2003-04-14 15:01:55 +00:00
|
|
|
int initialState() const;
|
2003-01-05 22:20:46 +00:00
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
FbWinFrame &frame() { return m_frame; }
|
|
|
|
const FbWinFrame &frame() const { return m_frame; }
|
2003-01-05 22:20:46 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
/**
|
|
|
|
@name signals
|
2003-01-05 22:20:46 +00:00
|
|
|
@{
|
2002-12-01 13:42:15 +00:00
|
|
|
*/
|
|
|
|
FbTk::Subject &stateSig() { return m_statesig; }
|
|
|
|
const FbTk::Subject &stateSig() const { return m_statesig; }
|
2003-02-02 16:32:41 +00:00
|
|
|
FbTk::Subject &layerSig() { return m_layersig; }
|
|
|
|
const FbTk::Subject &layerSig() const { return m_layersig; }
|
2002-12-01 13:42:15 +00:00
|
|
|
FbTk::Subject &hintSig() { return m_hintsig; }
|
|
|
|
const FbTk::Subject &hintSig() const { return m_hintsig; }
|
|
|
|
FbTk::Subject &workspaceSig() { return m_workspacesig; }
|
|
|
|
const FbTk::Subject &workspaceSig() const { return m_workspacesig; }
|
2002-12-13 20:35:36 +00:00
|
|
|
/** @} */ // end group signals
|
2002-12-01 13:42:15 +00:00
|
|
|
|
|
|
|
//@}
|
2003-06-23 14:16:05 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
class WinSubject: public FbTk::Subject {
|
|
|
|
public:
|
|
|
|
WinSubject(FluxboxWindow &w):m_win(w) { }
|
|
|
|
FluxboxWindow &win() { return m_win; }
|
|
|
|
const FluxboxWindow &win() const { return m_win; }
|
|
|
|
private:
|
|
|
|
FluxboxWindow &m_win;
|
|
|
|
};
|
2002-09-07 20:16:43 +00:00
|
|
|
|
2003-07-28 12:42:32 +00:00
|
|
|
bool oplock; ///< Used to help stop transient loops occurring by locking a window during certain operations
|
2004-03-21 09:00:25 +00:00
|
|
|
|
2001-12-11 20:47:02 +00:00
|
|
|
private:
|
2003-07-28 12:42:32 +00:00
|
|
|
void setupWindow();
|
2007-02-23 17:03:01 +00:00
|
|
|
void updateButtons();
|
2003-07-28 12:42:32 +00:00
|
|
|
|
2003-04-14 15:01:55 +00:00
|
|
|
void init();
|
2003-07-28 12:42:32 +00:00
|
|
|
void updateClientLeftWindow();
|
2003-01-05 22:20:46 +00:00
|
|
|
void grabButtons();
|
2003-06-15 18:35:32 +00:00
|
|
|
|
2008-08-15 11:39:24 +00:00
|
|
|
/**
|
|
|
|
* Calculates insertition position in the list by
|
|
|
|
* using pixel position x and y.
|
|
|
|
* @param x position
|
|
|
|
* @param y position
|
|
|
|
* @return iterator position for insertion
|
|
|
|
*/
|
|
|
|
ClientList::iterator getClientInsertPosition(int x, int y);
|
|
|
|
|
2003-04-15 14:40:24 +00:00
|
|
|
/// try to attach current attaching client to a window at pos x, y
|
2004-05-13 01:48:18 +00:00
|
|
|
void attachTo(int x, int y, bool interrupted = false);
|
2003-04-15 14:40:24 +00:00
|
|
|
|
2003-01-05 22:20:46 +00:00
|
|
|
bool getState();
|
2003-09-24 14:02:25 +00:00
|
|
|
void updateMWMHintsFromClient(WinClient &client);
|
2008-08-22 17:16:33 +00:00
|
|
|
void updateSizeHints();
|
2008-08-21 14:05:44 +00:00
|
|
|
void associateClientWindow();
|
2003-06-23 14:16:05 +00:00
|
|
|
|
2004-06-19 15:04:28 +00:00
|
|
|
void setState(unsigned long stateval, bool setting_up);
|
2007-12-22 02:35:05 +00:00
|
|
|
/// set the layer of a fullscreen window
|
|
|
|
void setFullscreenLayer();
|
2008-09-02 15:41:55 +00:00
|
|
|
void attachWorkAreaSig();
|
2003-04-20 02:47:15 +00:00
|
|
|
|
|
|
|
// modifies left and top if snap is necessary
|
|
|
|
void doSnapping(int &left, int &top);
|
2003-09-29 14:58:15 +00:00
|
|
|
// user_w/h return the values that should be shown to the user
|
2008-10-15 06:31:10 +00:00
|
|
|
void fixSize();
|
2008-08-21 17:17:21 +00:00
|
|
|
void moveResizeClient(WinClient &client);
|
2003-04-15 18:56:42 +00:00
|
|
|
/// sends configurenotify to all clients
|
2007-10-13 21:51:37 +00:00
|
|
|
void sendConfigureNotify();
|
2004-04-12 18:19:10 +00:00
|
|
|
|
|
|
|
static void grabPointer(Window grab_window,
|
|
|
|
Bool owner_events,
|
|
|
|
unsigned int event_mask,
|
|
|
|
int pointer_mode, int keyboard_mode,
|
|
|
|
Window confine_to,
|
|
|
|
Cursor cursor,
|
|
|
|
Time time);
|
|
|
|
static void ungrabPointer(Time time);
|
|
|
|
|
2005-05-03 09:28:05 +00:00
|
|
|
void associateClient(WinClient &client);
|
2008-09-28 08:46:49 +00:00
|
|
|
/// Called when focused changed, and is attached when it is not in fullscreen mode
|
|
|
|
void focusedWindowChanged(BScreen &screen, FluxboxWindow *focused_win, WinClient* client);
|
2008-09-28 14:00:48 +00:00
|
|
|
/// Called when workspace area on screen changed.
|
|
|
|
void workspaceAreaChanged(BScreen &screen);
|
|
|
|
|
2005-05-03 09:28:05 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
// state and hint signals
|
2007-12-29 21:38:53 +00:00
|
|
|
WinSubject m_hintsig,
|
|
|
|
m_statesig,
|
|
|
|
m_layersig,
|
2007-10-13 21:51:37 +00:00
|
|
|
m_workspacesig;
|
2002-09-07 20:16:43 +00:00
|
|
|
|
2007-07-06 17:48:02 +00:00
|
|
|
time_t m_creation_time;
|
|
|
|
|
2003-05-10 16:53:09 +00:00
|
|
|
// Window states
|
2008-08-27 22:29:33 +00:00
|
|
|
bool moving, resizing, m_initialized;
|
2003-06-25 13:37:06 +00:00
|
|
|
|
2003-04-15 14:40:24 +00:00
|
|
|
WinClient *m_attaching_tab;
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2003-05-10 16:53:09 +00:00
|
|
|
FbTk::Timer m_timer;
|
2003-04-14 15:01:55 +00:00
|
|
|
Display *display; /// display connection
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2003-05-10 16:53:09 +00:00
|
|
|
int m_button_grab_x, m_button_grab_y; // handles last button press event for move
|
|
|
|
int m_last_resize_x, m_last_resize_y; // handles last button press event for resize
|
|
|
|
int m_last_move_x, m_last_move_y; // handles last pos for non opaque moving
|
2008-10-15 06:31:10 +00:00
|
|
|
int m_last_resize_h, m_last_resize_w; // handles height/width for resize "window"
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2007-10-13 21:51:37 +00:00
|
|
|
timeval m_last_keypress_time;
|
|
|
|
|
2003-05-10 16:53:09 +00:00
|
|
|
unsigned int m_workspace_number;
|
2004-12-21 16:17:14 +00:00
|
|
|
unsigned long m_current_state; // NormalState | IconicState | Withdrawn
|
2003-02-02 16:32:41 +00:00
|
|
|
|
2004-12-21 16:17:14 +00:00
|
|
|
unsigned int m_old_decoration_mask;
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2003-04-14 15:01:55 +00:00
|
|
|
ClientList m_clientlist;
|
2003-12-17 01:21:49 +00:00
|
|
|
WinClient *m_client; ///< current client
|
2007-10-13 21:51:37 +00:00
|
|
|
typedef std::map<WinClient *, IconButton *> Client2ButtonMap;
|
2003-04-14 15:01:55 +00:00
|
|
|
Client2ButtonMap m_labelbuttons;
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2008-08-27 17:05:49 +00:00
|
|
|
SizeHints m_size_hint;
|
2008-10-15 06:31:10 +00:00
|
|
|
struct {
|
|
|
|
bool titlebar:1, handle:1, border:1, iconify:1,
|
|
|
|
maximize:1, close:1, menu:1, sticky:1, shade:1, tab:1, enabled:1;
|
2002-12-01 13:42:15 +00:00
|
|
|
} decorations;
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2007-02-23 17:03:01 +00:00
|
|
|
std::vector<WinButton::Type> m_titlebar_buttons[2];
|
2004-12-21 16:17:14 +00:00
|
|
|
bool m_toggled_decos;
|
2004-04-18 21:17:36 +00:00
|
|
|
|
2008-10-15 06:31:10 +00:00
|
|
|
struct {
|
|
|
|
bool resize:1, move:1, iconify:1, maximize:1, close:1, tabable:1;
|
2002-12-01 13:42:15 +00:00
|
|
|
} functions;
|
2003-05-14 14:43:06 +00:00
|
|
|
|
2007-12-27 21:55:24 +00:00
|
|
|
typedef FbTk::ConstObjectAccessor<bool, FocusControl> BoolAcc;
|
2007-12-26 21:50:44 +00:00
|
|
|
/// if the window is normally focused when mapped
|
2007-12-27 21:55:24 +00:00
|
|
|
FbTk::DefaultValue<bool, BoolAcc> m_focus_new;
|
2007-12-26 21:50:44 +00:00
|
|
|
/// if the window is focused with EnterNotify
|
2007-12-27 21:55:24 +00:00
|
|
|
FbTk::DefaultValue<bool, BoolAcc> m_mouse_focus;
|
2007-12-25 21:05:07 +00:00
|
|
|
bool m_click_focus; ///< if the window is focused by clicking
|
2003-01-07 01:34:49 +00:00
|
|
|
int m_last_button_x, ///< last known x position of the mouse button
|
|
|
|
m_last_button_y; ///< last known y position of the mouse button
|
2008-01-07 20:08:56 +00:00
|
|
|
|
2008-01-08 08:50:58 +00:00
|
|
|
FocusableTheme<WinButtonTheme> m_button_theme;
|
2008-01-07 20:08:56 +00:00
|
|
|
FocusableTheme<FbWinFrameTheme> m_theme;
|
2008-08-27 20:29:35 +00:00
|
|
|
|
|
|
|
WindowState m_state;
|
|
|
|
FbWinFrame m_frame; ///< the actual window frame
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2007-10-23 17:34:30 +00:00
|
|
|
bool m_placed; ///< determine whether or not we should place the window
|
|
|
|
|
2004-12-21 16:17:14 +00:00
|
|
|
int m_old_layernum;
|
2003-02-09 14:11:14 +00:00
|
|
|
|
2003-05-10 23:04:37 +00:00
|
|
|
FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window")
|
|
|
|
|
2008-08-18 12:12:30 +00:00
|
|
|
ReferenceCorner m_resize_corner; //< the current corner used while resizing
|
2003-09-29 12:53:58 +00:00
|
|
|
|
2004-04-12 18:19:10 +00:00
|
|
|
static int s_num_grabs; ///< number of XGrabPointer's
|
2001-12-11 20:47:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-10 14:46:42 +00:00
|
|
|
#endif // WINDOW_HH
|