2002-07-11 18:13:38 +00:00
|
|
|
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
2002-07-19 22:33:20 +00:00
|
|
|
// window.hh for Epistophy - a key handler for NETWM/EWMH window managers.
|
2002-07-11 18:13:38 +00:00
|
|
|
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.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.
|
|
|
|
|
|
|
|
#ifndef __window_hh
|
|
|
|
#define __window_hh
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <list>
|
2002-07-12 02:48:43 +00:00
|
|
|
#include <string>
|
2002-07-11 18:13:38 +00:00
|
|
|
|
2002-07-20 20:04:27 +00:00
|
|
|
#include "../../src/Util.hh"
|
|
|
|
|
2002-07-12 16:29:59 +00:00
|
|
|
class epist;
|
2002-07-20 08:06:54 +00:00
|
|
|
class screen;
|
2002-07-12 16:29:59 +00:00
|
|
|
class XAtom;
|
2002-07-11 18:13:38 +00:00
|
|
|
|
|
|
|
class XWindow {
|
2002-07-20 18:44:39 +00:00
|
|
|
public:
|
|
|
|
enum Max {
|
|
|
|
Max_None,
|
|
|
|
Max_Horz,
|
|
|
|
Max_Vert,
|
|
|
|
Max_Full
|
|
|
|
};
|
|
|
|
|
2002-07-11 18:13:38 +00:00
|
|
|
private:
|
2002-07-20 20:04:27 +00:00
|
|
|
epist *_epist;
|
2002-07-20 08:06:54 +00:00
|
|
|
screen *_screen;
|
2002-07-20 20:04:27 +00:00
|
|
|
XAtom *_xatom;
|
|
|
|
|
2002-07-11 18:13:38 +00:00
|
|
|
Window _window;
|
2002-07-20 20:04:27 +00:00
|
|
|
|
2002-07-11 18:13:38 +00:00
|
|
|
unsigned int _desktop;
|
2002-07-12 02:48:43 +00:00
|
|
|
std::string _title;
|
|
|
|
std::string _app_name;
|
|
|
|
std::string _app_class;
|
2002-07-20 20:04:27 +00:00
|
|
|
Rect _rect;
|
2002-07-20 20:25:56 +00:00
|
|
|
int _inc_x, _inc_y; // resize increments
|
|
|
|
int _base_x, _base_y; // base size
|
2002-07-20 20:04:27 +00:00
|
|
|
int _gravity;
|
2002-07-24 17:49:57 +00:00
|
|
|
bool _can_focus;
|
2002-07-12 02:48:43 +00:00
|
|
|
|
|
|
|
// states
|
2002-07-11 18:13:38 +00:00
|
|
|
bool _shaded;
|
|
|
|
bool _iconic;
|
|
|
|
bool _max_vert;
|
|
|
|
bool _max_horz;
|
|
|
|
|
2002-07-12 01:50:56 +00:00
|
|
|
bool _unmapped;
|
|
|
|
|
2002-07-20 20:04:27 +00:00
|
|
|
void updateDimentions();
|
2002-07-24 17:49:57 +00:00
|
|
|
void updateNormalHints();
|
|
|
|
void updateWMHints();
|
2002-07-12 16:29:59 +00:00
|
|
|
void updateState();
|
|
|
|
void updateDesktop();
|
|
|
|
void updateTitle();
|
|
|
|
void updateClass();
|
|
|
|
|
2002-07-11 18:13:38 +00:00
|
|
|
public:
|
2002-07-20 08:06:54 +00:00
|
|
|
XWindow(epist *epist, screen *screen, Window window);
|
2002-07-11 18:13:38 +00:00
|
|
|
virtual ~XWindow();
|
|
|
|
|
2002-07-24 08:33:35 +00:00
|
|
|
inline screen *getScreen() const { return _screen; }
|
2002-07-11 18:13:38 +00:00
|
|
|
inline Window window() const { return _window; }
|
2002-07-12 02:48:43 +00:00
|
|
|
|
2002-07-11 18:13:38 +00:00
|
|
|
inline unsigned int desktop() const { return _desktop; }
|
2002-07-12 02:48:43 +00:00
|
|
|
inline const std::string &title() const { return _title; }
|
|
|
|
inline const std::string &appName() const { return _app_name; }
|
2002-07-20 16:52:52 +00:00
|
|
|
inline const std::string &appClass() const { return _app_class; }
|
2002-07-24 17:49:57 +00:00
|
|
|
inline bool canFocus() const { return _can_focus; }
|
2002-07-12 02:48:43 +00:00
|
|
|
|
2002-07-11 18:13:38 +00:00
|
|
|
inline bool shaded() const { return _shaded; }
|
|
|
|
inline bool iconic() const { return _iconic; }
|
|
|
|
inline bool maxVert() const { return _max_vert; }
|
|
|
|
inline bool maxHorz() const { return _max_horz; }
|
2002-07-20 20:04:27 +00:00
|
|
|
inline const Rect &area() const { return _rect; }
|
|
|
|
inline unsigned int x() const { return _rect.x(); }
|
|
|
|
inline unsigned int y() const { return _rect.y(); }
|
|
|
|
inline unsigned int width() const { return _rect.width(); }
|
|
|
|
inline unsigned int height() const { return _rect.height(); }
|
2002-07-11 18:13:38 +00:00
|
|
|
|
2002-07-12 16:29:59 +00:00
|
|
|
void processEvent(const XEvent &e);
|
2002-07-12 00:40:05 +00:00
|
|
|
|
2002-07-20 08:06:54 +00:00
|
|
|
void shade(const bool sh) const;
|
2002-07-20 09:17:23 +00:00
|
|
|
void close() const;
|
2002-07-20 09:20:14 +00:00
|
|
|
void raise() const;
|
|
|
|
void lower() const;
|
2002-07-20 09:28:01 +00:00
|
|
|
void iconify() const;
|
2002-07-20 09:58:49 +00:00
|
|
|
void focus() const;
|
2002-07-20 10:11:10 +00:00
|
|
|
void sendTo(unsigned int dest) const;
|
2002-07-20 18:16:52 +00:00
|
|
|
void move(int x, int y) const;
|
2002-08-07 16:27:27 +00:00
|
|
|
void resizeRel(int dwidth, int dheight) const;
|
|
|
|
void resizeAbs(unsigned int width, unsigned int height) const;
|
2002-07-20 18:44:39 +00:00
|
|
|
void toggleMaximize(Max max) const; // i hate toggle functions
|
|
|
|
void maximize(Max max) const;
|
2002-07-20 08:06:54 +00:00
|
|
|
|
2002-07-11 18:13:38 +00:00
|
|
|
bool operator == (const XWindow &w) const { return w._window == _window; }
|
|
|
|
bool operator == (const Window &w) const { return w == _window; }
|
|
|
|
};
|
|
|
|
|
2002-07-20 20:04:27 +00:00
|
|
|
typedef std::list<XWindow *> WindowList;
|
|
|
|
|
2002-07-11 18:13:38 +00:00
|
|
|
#endif // __window_hh
|