2003-04-14 12:13:36 +00:00
|
|
|
// WinClient.hh for Fluxbox - an X11 Window manager
|
|
|
|
// Copyright (c) 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net)
|
|
|
|
//
|
|
|
|
// 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,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
// 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.
|
|
|
|
|
2003-09-29 14:58:15 +00:00
|
|
|
// $Id: WinClient.hh,v 1.15 2003/09/29 14:58:15 rathnor Exp $
|
2003-04-14 12:13:36 +00:00
|
|
|
|
|
|
|
#ifndef WINCLIENT_HH
|
|
|
|
#define WINCLIENT_HH
|
|
|
|
|
2003-05-10 14:16:38 +00:00
|
|
|
#include "Window.hh"
|
2003-04-14 12:13:36 +00:00
|
|
|
#include "Subject.hh"
|
|
|
|
#include "FbWindow.hh"
|
|
|
|
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include <string>
|
|
|
|
|
2003-05-14 12:07:06 +00:00
|
|
|
class BScreen;
|
2003-07-28 15:06:36 +00:00
|
|
|
class Strut;
|
2003-05-14 12:07:06 +00:00
|
|
|
|
2003-04-14 12:13:36 +00:00
|
|
|
/// Holds client window info
|
|
|
|
class WinClient:public FbTk::FbWindow {
|
|
|
|
public:
|
2003-05-07 16:21:26 +00:00
|
|
|
typedef std::list<WinClient *> TransientList;
|
2003-04-14 12:13:36 +00:00
|
|
|
|
2003-06-23 14:16:05 +00:00
|
|
|
WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin = 0);
|
2003-04-14 12:13:36 +00:00
|
|
|
|
|
|
|
~WinClient();
|
|
|
|
void updateRect(int x, int y, unsigned int width, unsigned int height);
|
2003-07-21 15:26:57 +00:00
|
|
|
bool sendFocus(); // returns whether we sent a message or not
|
|
|
|
// i.e. whether we assume the focus will get taken
|
2003-07-28 15:06:36 +00:00
|
|
|
void sendClose(bool forceful = false);
|
2003-09-21 12:49:48 +00:00
|
|
|
// not aware of anything that makes this false at present
|
|
|
|
inline bool isClosable() const { return true; }
|
2003-04-14 12:13:36 +00:00
|
|
|
void reparent(Window win, int x, int y);
|
|
|
|
bool getAttrib(XWindowAttributes &attr) const;
|
|
|
|
bool getWMName(XTextProperty &textprop) const;
|
|
|
|
bool getWMIconName(XTextProperty &textprop) const;
|
2003-06-15 18:36:40 +00:00
|
|
|
/// @return name member of class structure
|
|
|
|
const std::string &getWMClassName() const;
|
|
|
|
/// @return class member of class structure
|
|
|
|
const std::string &getWMClassClass() const;
|
|
|
|
/// updates from wm class hints
|
|
|
|
void updateWMClassHint();
|
2003-07-28 15:46:00 +00:00
|
|
|
void updateWMProtocols();
|
2003-06-15 18:36:40 +00:00
|
|
|
|
2003-07-28 15:06:36 +00:00
|
|
|
inline const std::string &getTitle() const { return m_title; }
|
2003-04-14 12:13:36 +00:00
|
|
|
void updateTitle();
|
|
|
|
void updateIconTitle();
|
2003-05-14 12:07:06 +00:00
|
|
|
BScreen &screen() { return m_screen; }
|
|
|
|
const BScreen &screen() const { return m_screen; }
|
2003-04-14 12:13:36 +00:00
|
|
|
/// notifies when this client dies
|
|
|
|
FbTk::Subject &dieSig() { return m_diesig; }
|
|
|
|
|
|
|
|
/// updates transient window information
|
|
|
|
void updateTransientInfo();
|
2003-05-07 16:21:26 +00:00
|
|
|
WinClient *transientFor() { return transient_for; }
|
|
|
|
const WinClient *transientFor() const { return transient_for; }
|
2003-04-14 12:13:36 +00:00
|
|
|
TransientList &transientList() { return transients; }
|
|
|
|
const TransientList &transientList() const { return transients; }
|
2003-05-07 16:21:26 +00:00
|
|
|
bool isTransient() const { return transient_for != 0; }
|
2003-07-20 18:05:40 +00:00
|
|
|
|
|
|
|
bool isModal() const { return m_modal > 0; }
|
|
|
|
void addModal(); // some transient of ours (or us) is modal
|
|
|
|
void removeModal(); // some transient (or us) is no longer modal
|
2003-05-07 16:21:26 +00:00
|
|
|
|
2003-04-14 12:13:36 +00:00
|
|
|
bool operator == (const FluxboxWindow &win) const {
|
|
|
|
return (m_win == &win);
|
|
|
|
}
|
|
|
|
|
2003-07-28 15:06:36 +00:00
|
|
|
void setStrut(Strut *strut);
|
|
|
|
void clearStrut();
|
|
|
|
|
|
|
|
bool focus(); // calls Window->setCurrentClient to give focus to this client
|
|
|
|
|
2003-04-14 12:13:36 +00:00
|
|
|
const std::string &title() const { return m_title; }
|
|
|
|
const std::string &iconTitle() const { return m_icon_title; }
|
|
|
|
const FluxboxWindow *fbwindow() const { return m_win; }
|
|
|
|
FluxboxWindow *fbwindow() { return m_win; }
|
2003-06-23 14:16:05 +00:00
|
|
|
|
|
|
|
static const int PropBlackboxHintsElements = 5;
|
|
|
|
static const int PropMwmHintsElements = 3;
|
|
|
|
|
|
|
|
void updateBlackboxHints();
|
|
|
|
void updateMWMHints();
|
|
|
|
void updateWMHints();
|
|
|
|
void updateWMNormalHints();
|
|
|
|
|
2003-09-29 14:58:15 +00:00
|
|
|
/**
|
|
|
|
* Changes width and height to the nearest (lower) value
|
|
|
|
* that conforms to it's size hints.
|
|
|
|
*
|
|
|
|
* display_* give the values that would be displayed
|
|
|
|
* to the user when resizing.
|
|
|
|
* We use pointers for display_* since they are optional.
|
|
|
|
*/
|
|
|
|
void applySizeHints(int &width, int &height, int *display_width = 0, int *display_height = 0);
|
|
|
|
|
2003-06-23 14:16:05 +00:00
|
|
|
// grouping is tracked by remembering the window to the left in the group
|
|
|
|
Window getGroupLeftWindow() const;
|
|
|
|
void setGroupLeftWindow(Window win);
|
|
|
|
bool hasGroupLeftWindow() const;
|
|
|
|
|
2003-07-28 15:06:36 +00:00
|
|
|
// does this client have a pending unmap or destroy event?
|
|
|
|
bool validateClient() const;
|
|
|
|
|
2003-09-11 19:55:27 +00:00
|
|
|
inline int gravity() const { return m_win_gravity; }
|
|
|
|
|
2003-04-14 12:13:36 +00:00
|
|
|
/**
|
|
|
|
!! TODO !!
|
|
|
|
remove or move these to private
|
|
|
|
*/
|
|
|
|
|
2003-05-07 16:21:26 +00:00
|
|
|
WinClient *transient_for; // which window are we a transient for?
|
|
|
|
std::list<WinClient *> transients; // which windows are our transients?
|
2003-04-14 12:13:36 +00:00
|
|
|
Window window_group;
|
|
|
|
|
|
|
|
|
|
|
|
int x, y, old_bw;
|
|
|
|
unsigned int
|
|
|
|
min_width, min_height, max_width, max_height, width_inc, height_inc,
|
|
|
|
min_aspect_x, min_aspect_y, max_aspect_x, max_aspect_y,
|
2003-09-11 19:55:27 +00:00
|
|
|
base_width, base_height;
|
2003-04-14 12:13:36 +00:00
|
|
|
unsigned long initial_state, normal_hint_flags, wm_hint_flags;
|
|
|
|
|
|
|
|
// this structure only contains 3 elements... the Motif 2.0 structure contains
|
|
|
|
// 5... we only need the first 3... so that is all we will define
|
|
|
|
typedef struct MwmHints {
|
|
|
|
unsigned long flags; // Motif wm flags
|
|
|
|
unsigned long functions; // Motif wm functions
|
|
|
|
unsigned long decorations; // Motif wm decorations
|
|
|
|
} MwmHints;
|
|
|
|
|
|
|
|
FluxboxWindow *m_win;
|
|
|
|
class WinClientSubj: public FbTk::Subject {
|
|
|
|
public:
|
|
|
|
explicit WinClientSubj(WinClient &client):m_winclient(client) { }
|
|
|
|
WinClient &winClient() { return m_winclient; }
|
|
|
|
private:
|
|
|
|
WinClient &m_winclient;
|
|
|
|
};
|
|
|
|
|
2003-06-23 14:16:05 +00:00
|
|
|
inline int getFocusMode() const { return m_focus_mode; }
|
|
|
|
inline const FluxboxWindow::BlackboxHints *getBlackboxHint() const {
|
|
|
|
return m_blackbox_hint; }
|
|
|
|
void saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs);
|
|
|
|
inline const MwmHints *getMwmHint() const { return m_mwm_hint; }
|
|
|
|
|
|
|
|
enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };
|
|
|
|
|
2003-04-14 12:13:36 +00:00
|
|
|
private:
|
2003-07-20 18:05:40 +00:00
|
|
|
// number of transients which we are modal for
|
|
|
|
// or indicates that we are modal if don't have any transients
|
|
|
|
int m_modal;
|
2003-09-21 12:49:48 +00:00
|
|
|
bool send_focus_message, send_close_message;
|
2003-06-23 14:16:05 +00:00
|
|
|
|
2003-09-11 19:55:27 +00:00
|
|
|
int m_win_gravity;
|
|
|
|
|
2003-04-14 12:13:36 +00:00
|
|
|
std::string m_title, m_icon_title;
|
2003-06-23 14:16:05 +00:00
|
|
|
std::string m_class_name, m_instance_name;
|
|
|
|
|
|
|
|
FluxboxWindow::BlackboxHints *m_blackbox_hint;
|
|
|
|
MwmHints *m_mwm_hint;
|
|
|
|
|
|
|
|
int m_focus_mode;
|
|
|
|
|
2003-04-14 12:13:36 +00:00
|
|
|
WinClientSubj m_diesig;
|
2003-05-14 12:07:06 +00:00
|
|
|
BScreen &m_screen;
|
2003-06-23 14:16:05 +00:00
|
|
|
|
2003-07-28 15:06:36 +00:00
|
|
|
Strut *m_strut;
|
|
|
|
|
2003-04-14 12:13:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WINCLIENT_HH
|