fix ToggleDecor for fullscreen and decorationless windows, plus some other cleanup

This commit is contained in:
markt 2007-07-24 12:12:45 +00:00
parent 9545871f7a
commit 363764db5b
10 changed files with 39 additions and 30 deletions

View file

@ -1,5 +1,9 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 1.0.0: Changes for 1.0.0:
*07/07/24:
* Don't allow ToggleDecor with fullscreen windows, and make it show
decorations for windows that don't have a titlebar by default (Mark)
Window.cc/hh
*07/07/08: *07/07/08:
* Clean up state and workspace window properties on client close (Mark) * Clean up state and workspace window properties on client close (Mark)
Ewmh.cc Gnome.cc/hh Ewmh.cc Gnome.cc/hh

View file

@ -152,7 +152,7 @@ int ExecuteCmd::run() {
// get shell path from the environment // get shell path from the environment
// this process exits immediately, so we don't have to worry about memleaks // this process exits immediately, so we don't have to worry about memleaks
char *shell = getenv("SHELL"); const char *shell = getenv("SHELL");
if (!shell) if (!shell)
shell = "/bin/sh"; shell = "/bin/sh";

View file

@ -52,7 +52,7 @@ ImageImlib2::ImageImlib2() {
// TODO: this are the potential candidates, // TODO: this are the potential candidates,
// choose only sane ones. open for discussion // choose only sane ones. open for discussion
static char* format_list[] = { static const char* format_list[] = {
"PNG", // pngloader "PNG", // pngloader
"JPEG", "JPG", "JFI", "JFIF", // jpegloader "JPEG", "JPG", "JFI", "JFIF", // jpegloader
// "TIFF", "TIF", // tiffloader // "TIFF", "TIF", // tiffloader
@ -67,7 +67,7 @@ ImageImlib2::ImageImlib2() {
NULL NULL
}; };
char** format = NULL; const char** format = NULL;
for(format = format_list; *format != NULL; format++) { for(format = format_list; *format != NULL; format++) {
Image::registerType(*format, *this); Image::registerType(*format, *this);
} }

View file

@ -34,7 +34,7 @@
namespace { namespace {
struct t_modlist{ struct t_modlist{
char *str; const char *str;
unsigned int mask; unsigned int mask;
bool operator == (const char *modstr) const { bool operator == (const char *modstr) const {
return (strcasecmp(str, modstr) == 0 && mask !=0); return (strcasecmp(str, modstr) == 0 && mask !=0);

View file

@ -524,7 +524,7 @@ FbTk::Menu *MenuCreator::createMenuType(const string &type, int screen_num) {
menu->disableTitle(); // not titlebar menu->disableTitle(); // not titlebar
if (screen->windowMenuFilename().empty() || if (screen->windowMenuFilename().empty() ||
! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) { ! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) {
char *default_menu[] = { const char *default_menu[] = {
"shade", "shade",
"stick", "stick",
"maximize", "maximize",

View file

@ -262,7 +262,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
m_last_resize_h(1), m_last_resize_w(1), m_last_resize_h(1), m_last_resize_w(1),
m_workspace_number(0), m_workspace_number(0),
m_current_state(0), m_current_state(0),
m_old_decoration(DECOR_NORMAL),
m_old_decoration_mask(0), m_old_decoration_mask(0),
m_client(&client), m_client(&client),
m_toggled_decos(false), m_toggled_decos(false),
@ -1243,8 +1242,7 @@ void FluxboxWindow::updateBlackboxHintsFromClient(const WinClient &client) {
m_workspace_number = hint->stack; m_workspace_number = hint->stack;
if (hint->flags & ATTRIB_DECORATION) { if (hint->flags & ATTRIB_DECORATION) {
m_old_decoration = static_cast<Decoration>(hint->decoration); setDecoration(static_cast<Decoration>(hint->decoration), false);
setDecoration(m_old_decoration, false);
} }
} }
@ -1577,8 +1575,10 @@ void FluxboxWindow::setFullscreen(bool flag) {
frame().setUseShape(false); frame().setUseShape(false);
m_old_decoration_mask = decorationMask(); if (!m_toggled_decos)
m_old_layernum =layerNum(); m_old_decoration_mask = decorationMask();
m_old_layernum = layerNum();
m_old_pos_x = frame().x(); m_old_pos_x = frame().x();
m_old_pos_y = frame().y(); m_old_pos_y = frame().y();
m_old_width = frame().width(); m_old_width = frame().width();
@ -1609,8 +1609,14 @@ void FluxboxWindow::setFullscreen(bool flag) {
fullscreen = false; fullscreen = false;
setDecorationMask(m_old_decoration_mask);
frame().setUseShape(!m_shaped); frame().setUseShape(!m_shaped);
if (m_toggled_decos) {
if (m_old_decoration_mask & DECORM_TITLEBAR)
setDecoration(DECOR_NONE);
else
setDecoration(DECOR_NORMAL);
} else
setDecorationMask(m_old_decoration_mask);
// ensure we apply the sizehints here, otherwise some // ensure we apply the sizehints here, otherwise some
// apps (eg xterm) end up a little bit .. crappy (visually) // apps (eg xterm) end up a little bit .. crappy (visually)
@ -1624,7 +1630,6 @@ void FluxboxWindow::setFullscreen(bool flag) {
moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h); moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h);
moveToLayer(m_old_layernum); moveToLayer(m_old_layernum);
m_old_decoration_mask = 0;
m_old_layernum = ::Layer::NORMAL; m_old_layernum = ::Layer::NORMAL;
stateSig().notify(); stateSig().notify();
@ -3205,22 +3210,20 @@ void FluxboxWindow::applyDecorations(bool initial) {
void FluxboxWindow::toggleDecoration() { void FluxboxWindow::toggleDecoration() {
//don't toggle decor if the window is shaded //don't toggle decor if the window is shaded
if (isShaded()) if (isShaded() || isFullscreen())
return; return;
m_toggled_decos= true; m_toggled_decos = !m_toggled_decos;
if (decorations.enabled) { //remove decorations if (m_toggled_decos) {
decorations.enabled = false; m_old_decoration_mask = decorationMask();
setDecoration(DECOR_NONE); if (decorations.titlebar)
} else { //revert back to old decoration setDecoration(DECOR_NONE);
decorations.enabled = true; else
if (m_old_decoration == DECOR_NONE) { // make sure something happens
setDecoration(DECOR_NORMAL); setDecoration(DECOR_NORMAL);
} else { } else
setDecoration(m_old_decoration); setDecorationMask(m_old_decoration_mask);
}
}
} }
unsigned int FluxboxWindow::decorationMask() const { unsigned int FluxboxWindow::decorationMask() const {
@ -3866,8 +3869,7 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) {
} }
if (net.flags & ATTRIB_DECORATION) { if (net.flags & ATTRIB_DECORATION) {
m_old_decoration = static_cast<Decoration>(net.decoration); setDecoration(static_cast<Decoration>(net.decoration));
setDecoration(m_old_decoration);
} }
} }

View file

@ -538,7 +538,6 @@ private:
unsigned int m_workspace_number; unsigned int m_workspace_number;
unsigned long m_current_state; // NormalState | IconicState | Withdrawn unsigned long m_current_state; // NormalState | IconicState | Withdrawn
Decoration m_old_decoration;
unsigned int m_old_decoration_mask; unsigned int m_old_decoration_mask;
ClientList m_clientlist; ClientList m_clientlist;

View file

@ -1448,7 +1448,7 @@ string Fluxbox::getRcFilename() {
} }
/// Provides default filename of data file /// Provides default filename of data file
void Fluxbox::getDefaultDataFilename(char *name, string &filename) { void Fluxbox::getDefaultDataFilename(const char *name, string &filename) {
filename = string(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name); filename = string(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name);
} }

View file

@ -196,7 +196,7 @@ public:
bool menuTimestampsChanged() const; bool menuTimestampsChanged() const;
bool haveShape() const { return m_have_shape; } bool haveShape() const { return m_have_shape; }
int shapeEventbase() const { return m_shape_eventbase; } int shapeEventbase() const { return m_shape_eventbase; }
void getDefaultDataFilename(char *name, std::string &); void getDefaultDataFilename(const char *name, std::string &);
// screen mouse was in at last key event // screen mouse was in at last key event
BScreen *mouseScreen() { return m_mousescreen; } BScreen *mouseScreen() { return m_mousescreen; }
// screen of window that last key event (i.e. focused window) went to // screen of window that last key event (i.e. focused window) went to

View file

@ -321,9 +321,13 @@ int main(int argc, char **argv) {
FbTk::FbStringUtil::shutdown(); FbTk::FbStringUtil::shutdown();
if (restarting) { if (restarting) {
const char *shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
const char *arg = restart_argument.c_str(); const char *arg = restart_argument.c_str();
if (arg) { if (arg) {
execlp(arg, arg, (char *) NULL); execlp(shell, shell, "-c", arg, (char *) NULL);
perror(arg); perror(arg);
} }