From 9fb1fd76aa7abdbc7f3ba91c40c8357fdd690f25 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan <fourdan.olivier@wanadoo.fr> Date: Fri, 13 Sep 2002 16:14:49 +0000 Subject: [PATCH] *** empty log message *** (Old svn revision: 10564) --- src/Makefile.in | 8 +++----- src/client.c | 10 ++++++++-- src/client.h | 9 +++++++++ src/events.c | 4 ++-- src/frame.c | 47 +++++++++++++++++++++++++++++++++-------------- src/hints.h | 2 ++ 6 files changed, 57 insertions(+), 23 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 7f4d5d79e..86d647c69 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.6.2 from Makefile.am. +# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 @@ -181,8 +181,7 @@ install-binPROGRAMS: $(bin_PROGRAMS) p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ - p1=`echo "$$p1" | sed -e 's,^.*/,,'`; \ - f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ @@ -191,8 +190,7 @@ install-binPROGRAMS: $(bin_PROGRAMS) uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - f=`echo "$$f" | sed -e 's,^.*/,,'`; \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done diff --git a/src/client.c b/src/client.c index 65abc43f8..b8dae58e6 100644 --- a/src/client.c +++ b/src/client.c @@ -1578,6 +1578,9 @@ void clientFrame(Window w) c->focus = False; c->fullscreen = False; c->has_border = True; + c->has_menu = True; + c->has_maximize = True; + c->has_hide = True; c->has_struts = False; c->hidden = (START_ICONIC(c) ? True : False); c->ignore_unmap = ((attr.map_state == IsViewable) ? 1 : 0); @@ -1600,7 +1603,10 @@ void clientFrame(Window w) { if(mwm_hints->flags & MWM_HINTS_DECORATIONS && !(mwm_hints->decorations & MWM_DECOR_ALL)) { - c->has_border = ((mwm_hints->decorations & (MWM_DECOR_TITLE | MWM_DECOR_BORDER)) ? True : False); + c->has_border = ((mwm_hints->decorations & (MWM_DECOR_TITLE | MWM_DECOR_BORDER)) ? True : False); + c->has_menu = ((mwm_hints->decorations & (MWM_DECOR_MENU)) ? True : False); + c->has_maximize = ((mwm_hints->decorations & (MWM_DECOR_MAXIMIZE)) ? True : False); + c->has_hide = ((mwm_hints->decorations & (MWM_DECOR_MINIMIZE)) ? True : False); } XFree(mwm_hints); } @@ -2174,7 +2180,7 @@ void clientToggleMaximized(Client * c, int mode) DBG("entering clientToggleMaximized\n"); DBG("maximzing/unmaximizing client \"%s\" (%#lx)\n", c->name, c->window); - if((c->size->flags & (PMinSize | PMaxSize)) && (c->size->min_width == c->size->max_width) && (c->size->min_height == c->size->max_height)) + if(!CAN_MAXIMIZE_WINDOW(c)) { return; } diff --git a/src/client.h b/src/client.h index 41738fc75..5580f5dae 100644 --- a/src/client.h +++ b/src/client.h @@ -166,6 +166,12 @@ WindowType; (c->has_border) && \ !(c->skip_taskbar)) +#define CAN_MAXIMIZE_WINDOW(c) ((!(c->size->flags & (PMinSize | PMaxSize)) || \ + ((c->size->flags & (PMinSize | PMaxSize)) && \ + ((c->size->min_width != c->size->max_width) || \ + (c->size->min_height != c->size->max_height)))) && \ + (c->has_maximize)) + typedef struct _Client Client; struct _Client @@ -210,6 +216,9 @@ struct _Client unsigned int focus:1; unsigned int fullscreen:1; unsigned int has_border:1; + unsigned int has_menu:1; + unsigned int has_maximize:1; + unsigned int has_hide:1; unsigned int has_struts:1; unsigned int hidden:1; unsigned int ignore_unmap; diff --git a/src/events.c b/src/events.c index a808fa3bf..c68b167e4 100644 --- a/src/events.c +++ b/src/events.c @@ -1035,11 +1035,11 @@ static gboolean show_popup_cb(GtkWidget * widget, GdkEventButton * ev, gpointer ops = MENU_OP_DELETE | MENU_OP_DESTROY | MENU_OP_MINIMIZE_ALL; insensitive = 0; - if(c->win_state & (WIN_STATE_MAXIMIZED | WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT)) + if(c->win_state & (WIN_STATE_MAXIMIZED | WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT)) { ops |= MENU_OP_UNMAXIMIZE; } - else + else if (CAN_MAXIMIZE_WINDOW(c)) { ops |= MENU_OP_MAXIMIZE; } diff --git a/src/frame.c b/src/frame.c index b1ffe8893..a42db4145 100644 --- a/src/frame.c +++ b/src/frame.c @@ -298,22 +298,28 @@ static void frameCreateTitlePixmap(Client * c, int state, int left, int right, M g_object_unref(G_OBJECT(layout)); } -static int getButtonFromLetter(char c) +static int getButtonFromLetter(char c, Client * cl) { - int b; + int b=-1; DBG("entering getButtonFromLetter\n"); switch (c) { case 'H': - b = HIDE_BUTTON; + if (cl->has_hide) + { + b = HIDE_BUTTON; + } break; case 'C': b = CLOSE_BUTTON; break; case 'M': - b = MAXIMIZE_BUTTON; + if (cl->has_maximize) + { + b = MAXIMIZE_BUTTON; + } break; case 'S': b = SHADE_BUTTON; @@ -322,7 +328,10 @@ static int getButtonFromLetter(char c) b = STICK_BUTTON; break; case 'O': - b = MENU_BUTTON; + if (cl->has_menu) + { + b = MENU_BUTTON; + } break; default: b = -1; @@ -330,22 +339,28 @@ static int getButtonFromLetter(char c) return b; } -static char getLetterFromButton(int b) +static char getLetterFromButton(int b, Client * cl) { - char c; + char c = 0; DBG("entering getLetterFromButton\n"); switch (b) { case HIDE_BUTTON: - c = 'H'; + if (cl->has_hide) + { + c = 'H'; + } break; case CLOSE_BUTTON: c = 'C'; break; case MAXIMIZE_BUTTON: - c = 'M'; + if (cl->has_maximize) + { + c = 'M'; + } break; case SHADE_BUTTON: c = 'S'; @@ -354,7 +369,10 @@ static char getLetterFromButton(int b) c = 'T'; break; case MENU_BUTTON: - c = 'O'; + if (cl->has_menu) + { + c = 'O'; + } break; default: c = 0; @@ -456,7 +474,7 @@ static void frameSetShape(Client * c, int state, MyPixmap * title, MyPixmap pm_s XShapeCombineShape(dpy, temp, ShapeBounding, frameWidth(c) - corners[CORNER_TOP_RIGHT][ACTIVE].width, 0, c->corners[CORNER_TOP_RIGHT], ShapeBounding, ShapeUnion); for(i = 0; i < BUTTON_COUNT; i++) { - if(strchr(button_layout, getLetterFromButton(i))) + if(strchr(button_layout, getLetterFromButton(i, c))) { XShapeCombineShape(dpy, temp, ShapeBounding, button_x[i], (frameTop(c) - buttons[i][ACTIVE].height) / 2, c->buttons[i], ShapeBounding, ShapeUnion); } @@ -502,7 +520,8 @@ void frameDraw(Client * c) } for(i = 0; i < BUTTON_COUNT; i++) { - if(strchr(button_layout, getLetterFromButton(i))) + char b = getLetterFromButton(i, c); + if(strchr(button_layout, b)) { XMapWindow(dpy, c->buttons[i]); } @@ -515,7 +534,7 @@ void frameDraw(Client * c) x = frameLeft(c) + button_offset; for(i = 0; i < strlen(button_layout); i++) { - button = getButtonFromLetter(button_layout[i]); + button = getButtonFromLetter(button_layout[i], c); if(button >= 0) { XMoveResizeWindow(dpy, c->buttons[button], x, (frameTop(c) - buttons[button][ACTIVE].height) / 2, buttons[button][ACTIVE].width, buttons[button][ACTIVE].height); @@ -532,7 +551,7 @@ void frameDraw(Client * c) x = frameWidth(c) - frameRight(c) + button_spacing - button_offset; for(i = strlen(button_layout) - 1; i >= 0; i--) { - button = getButtonFromLetter(button_layout[i]); + button = getButtonFromLetter(button_layout[i], c); if(button >= 0) { x = x - buttons[button][ACTIVE].width - button_spacing; diff --git a/src/hints.h b/src/hints.h index 535f79096..44c706f11 100644 --- a/src/hints.h +++ b/src/hints.h @@ -32,6 +32,8 @@ #define MWM_DECOR_ALL (1L<<0) #define MWM_DECOR_BORDER (1L<<1) #define MWM_DECOR_TITLE (1L<<3) +#define MWM_DECOR_MENU (1L<<4) +#define MWM_DECOR_MINIMIZE (1L<<5) #define MWM_DECOR_MAXIMIZE (1L<<6) #define WIN_STATE_STICKY (1L<<0) -- GitLab