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)
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:
* Clean up state and workspace window properties on client close (Mark)
Ewmh.cc Gnome.cc/hh

View file

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

View file

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

View file

@ -34,7 +34,7 @@
namespace {
struct t_modlist{
char *str;
const char *str;
unsigned int mask;
bool operator == (const char *modstr) const {
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
if (screen->windowMenuFilename().empty() ||
! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) {
char *default_menu[] = {
const char *default_menu[] = {
"shade",
"stick",
"maximize",

View file

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

View file

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

View file

@ -1448,7 +1448,7 @@ string Fluxbox::getRcFilename() {
}
/// 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);
}

View file

@ -196,7 +196,7 @@ public:
bool menuTimestampsChanged() const;
bool haveShape() const { return m_have_shape; }
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
BScreen *mouseScreen() { return m_mousescreen; }
// 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();
if (restarting) {
const char *shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
const char *arg = restart_argument.c_str();
if (arg) {
execlp(arg, arg, (char *) NULL);
execlp(shell, shell, "-c", arg, (char *) NULL);
perror(arg);
}