From 064b418cf814af6134d791249a7a25507711546d Mon Sep 17 00:00:00 2001 From: Johns Date: Wed, 27 Apr 2011 16:58:39 +0200 Subject: [PATCH] Fix Bug #3160010: systray problem Year and version number bump. Tested clang, which compiles uwm without promblems. --- Makefile | 7 +-- client.c | 3 +- hints.c | 4 +- menu.c | 4 +- property.c | 115 +++++++++++++++++++++++++++++++++++++++---------- uwm.c | 18 ++++++-- www/index.html | 1 + 7 files changed, 120 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index b24bb2d..7ca3538 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # # @file Makefile @brief make file # -# Copyright (c) 2009, 2010 by Lutz Sammer. All Rights Reserved. +# Copyright (c) 2009 - 2011 by Lutz Sammer. All Rights Reserved. # # Contributor(s): # @@ -139,15 +139,16 @@ DEFS = $(CONFIG) #### $(addprefix -D, $(CONFIG)) #---------------------------------------------------------------------------- -VERSION = "0.25" +VERSION = "0.26" GIT_REV = $(shell git describe --always 2>/dev/null) CC= gcc +#CC= clang #MARCH= -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp #MARCH= -march=native #MARCH= -muclibc -OPTIM= -U_FORTIFY_SOURCE -D__OPTIMIZE__ -O0 -Os -fomit-frame-pointer +OPTIM= -U_FORTIFY_SOURCE -D__OPTIMIZE__ -Os -fomit-frame-pointer CFLAGS= $(MARCH) $(OPTIM) -W -Wall -Wextra -g -pipe \ -I. $(DEFS) -DVERSION='$(VERSION)' \ $(if $(GIT_REV), -DGIT_REV='"$(GIT_REV)"') \ diff --git a/client.c b/client.c index 2e37b2e..8a91aab 100644 --- a/client.c +++ b/client.c @@ -1,7 +1,7 @@ /// /// @file client.c @brief client functions /// -/// Copyright (c) 2009, 2010 by Lutz Sammer. All Rights Reserved. +/// Copyright (c) 2009 - 2011 by Lutz Sammer. All Rights Reserved. /// /// Contributor(s): /// @@ -1508,6 +1508,7 @@ void ClientSetWithdrawn(Client * client) WM_STATE_SHOW_DESKTOP); // FIXME: need only to update WM_STATE_MAPPED! + // FIXME: HintSetWMState HintSetAllStates(client); TaskUpdate(); diff --git a/hints.c b/hints.c index 63b4920..1091d54 100644 --- a/hints.c +++ b/hints.c @@ -1,7 +1,7 @@ /// /// @file hints.c @brief window manager hints functions. /// -/// Copyright (c) 2009, 2010 by Lutz Sammer. All Rights Reserved. +/// Copyright (c) 2009 - 2011 by Lutz Sammer. All Rights Reserved. /// /// Contributor(s): /// @@ -1141,7 +1141,7 @@ static void HintSetWMState(const Client * client) } else { Debug(3, "set withdrawn %x\n", client->Window); values[0] = XCB_WM_STATE_WITHDRAWN; - values[0] = XCB_WM_STATE_NORMAL; + //values[0] = XCB_WM_STATE_NORMAL; } values[1] = XCB_NONE; diff --git a/menu.c b/menu.c index 0447219..c84014e 100644 --- a/menu.c +++ b/menu.c @@ -1,7 +1,7 @@ /// /// @file menu.c @brief menu functions /// -/// Copyright (c) 2009, 2010 by Lutz Sammer. All Rights Reserved. +/// Copyright (c) 2009 - 2011 by Lutz Sammer. All Rights Reserved. /// /// Contributor(s): /// @@ -95,6 +95,8 @@ extern const char *xcb_event_get_label(uint8_t); /// These functions and all dependencies are only available if compiled /// widh #USE_DIALOG. /// +/// @todo add support for keyboard +/// /// @{ #ifdef USE_DIALOG // { diff --git a/property.c b/property.c index ae9fe02..8044015 100644 --- a/property.c +++ b/property.c @@ -1,7 +1,7 @@ /// /// @file property.c @brief x11 property handler functions /// -/// Copyright (c) 2009, 2010 by Lutz Sammer. All Rights Reserved. +/// Copyright (c) 2009 - 2011 by Lutz Sammer. All Rights Reserved. /// /// Contributor(s): /// @@ -51,6 +51,7 @@ #include "hints.h" #include "icon.h" #include "menu.h" +#include "desktop.h" #include "panel.h" #include "plugin/task.h" @@ -76,7 +77,7 @@ static xcb_property_handlers_t PropertyHandlers; ** @param atom atom of changed property ** @param property get property request of changed property */ -int HandlePropertyDefault( __attribute__ ((unused)) +static int HandlePropertyDefault( __attribute__ ((unused)) void *data, __attribute__ ((unused)) xcb_connection_t * conn, __attribute__ ((unused)) uint8_t state, __attribute__ ((unused)) xcb_window_t window, xcb_atom_t atom, @@ -104,6 +105,75 @@ int HandlePropertyDefault( __attribute__ ((unused)) } #endif +/** +** Handle WM hints property change. +** +** @param data user data (unused). +** @param conn xcb connection +** @param state property state +** @param window window which property was changed +** @param atom atom of changed property +** @param property get property request of changed property +** +** @returns always true. +*/ +static int HandlePropertyWMHints( __attribute__ ((unused)) + void *data, __attribute__ ((unused)) xcb_connection_t * conn, + __attribute__ ((unused)) uint8_t state, xcb_window_t window, + xcb_atom_t atom, xcb_get_property_reply_t * property) +{ + Client *client; + + Debug(3, "%s: atom %x\n", __FUNCTION__, atom); + + if ((client = ClientFindByChild(window))) { + xcb_wm_hints_t wm_hints; + + if (xcb_get_wm_hints_from_reply(&wm_hints, property) + && wm_hints.flags & XCB_WM_HINT_STATE) { + switch (wm_hints.initial_state) { + case XCB_WM_STATE_WITHDRAWN: + case XCB_WM_STATE_NORMAL: + Debug(3, "%s: client %x mapped\n", __FUNCTION__, window); + //FIXME: see map request +#if 0 + xcb_map_window(Connection, client->Window); + if (!(client->State & WM_STATE_MAPPED)) { + client->State |= WM_STATE_MAPPED; + client->State &= ~(WM_STATE_MINIMIZED + | WM_STATE_SHOW_DESKTOP | WM_STATE_HIDDEN + | WM_STATE_SHADED); + if (!(client->State & WM_STATE_STICKY)) { + client->Desktop = DesktopCurrent; + } + xcb_map_window(Connection, client->Window); + xcb_map_window(Connection, client->Parent); + ClientRaise(client); + ClientFocus(client); + // Done by focus: TaskUpdate(); + // Done by focus: PagerUpdate(); + } + ClientRestack(); +#endif + break; + case XCB_WM_STATE_ICONIC: + Debug(3, "%s: client %x minimized\n", __FUNCTION__, window); + //FIXME: + // client->State |= WM_STATE_MINIMIZED; + break; + } + } else { // defaults to mapped + Debug(3, "%s: client %x no state\n", __FUNCTION__, window); + //FIXME: + } + + BorderDraw(client, NULL); + TaskUpdate(); + } + + return 1; +} + /** ** Handle normal hints property change. ** @@ -116,7 +186,7 @@ int HandlePropertyDefault( __attribute__ ((unused)) ** ** @returns always true. */ -int HandlePropertyNormalHints( __attribute__ ((unused)) +static int HandlePropertyWMNormalHints( __attribute__ ((unused)) void *data, __attribute__ ((unused)) xcb_connection_t * conn, __attribute__ ((unused)) uint8_t state, __attribute__ ((unused)) xcb_window_t window, xcb_atom_t atom, @@ -141,7 +211,7 @@ int HandlePropertyNormalHints( __attribute__ ((unused)) ** ** @todo property argument isn't used. */ -int HandlePropertyWMName( __attribute__ ((unused)) +static int HandlePropertyWMName( __attribute__ ((unused)) void *data, __attribute__ ((unused)) xcb_connection_t * conn, __attribute__ ((unused)) uint8_t state, xcb_window_t window, xcb_atom_t atom, @@ -172,32 +242,33 @@ void PropertyInit(void) // ICCCM atoms xcb_property_set_handler(&PropertyHandlers, WM_NAME, UINT32_MAX, HandlePropertyWMName, NULL); + xcb_property_set_handler(&PropertyHandlers, WM_HINTS, UINT32_MAX, + HandlePropertyWMHints, NULL); + xcb_property_set_handler(&PropertyHandlers, WM_NORMAL_HINTS, UINT32_MAX, + HandlePropertyWMNormalHints, NULL); // EWMH atoms xcb_property_set_handler(&PropertyHandlers, Atoms.NET_WM_NAME.Atom, UINT32_MAX, HandlePropertyWMName, NULL); #if 0 - xcb_property_set_handler(&PropertyHandlers, WM_TRANSIENT_FOR, UINT32_MAX, - property_handle_wm_transient_for, NULL); - xcb_property_set_handler(&PropertyHandlers, WM_CLIENT_LEADER, UINT32_MAX, - property_handle_wm_client_leader, NULL); - xcb_property_set_handler(&PropertyHandlers, WM_NORMAL_HINTS, UINT32_MAX, - property_handle_wm_normal_hints, NULL); - xcb_property_set_handler(&PropertyHandlers, WM_HINTS, UINT32_MAX, - property_handle_wm_hints, NULL); - xcb_property_set_handler(&PropertyHandlers, WM_ICON_NAME, UINT32_MAX, - property_handle_wm_icon_name, NULL); + xcb_property_set_handler(&PropertyHandlers, Atoms.WM_TRANSIENT_FOR.Atom, + UINT32_MAX, HandleProperty_wm_transient_for, NULL); + xcb_property_set_handler(&PropertyHandlers, Atoms.WM_CLIENT_LEADER.Atom, + UINT32_MAX, HandleProperty_wm_client_leader, NULL); + xcb_property_set_handler(&PropertyHandlers, Atoms.WM_ICON_NAME.Atom, + UINT32_MAX, HandleProperty_wm_icon_name, NULL); // ATOM_WM_COLORMAP_WINDOWS - xcb_property_set_handler(&PropertyHandlers, _NET_WM_ICON_NAME, UINT32_MAX, - property_handle_wm_icon_name, NULL); - xcb_property_set_handler(&PropertyHandlers, _NET_WM_STRUT_PARTIAL, - UINT32_MAX, property_handle_net_wm_strut_partial, NULL); - xcb_property_set_handler(&PropertyHandlers, _NET_WM_ICON, UINT32_MAX, - property_handle_net_wm_icon, NULL); + xcb_property_set_handler(&PropertyHandlers, Atoms._NET_WM_ICON_NAME.Atom, + UINT32_MAX, HandleProperty_wm_icon_name, NULL); + xcb_property_set_handler(&PropertyHandlers, + Atoms._NET_WM_STRUT_PARTIAL.Atom, UINT32_MAX, + HandleProperty_net_wm_strut_partial, NULL); + xcb_property_set_handler(&PropertyHandlers, Atoms._NET_WM_ICON.Atom, + UINT32_MAX, HandleProperty_net_wm_icon, NULL); // background change - xcb_property_set_handler(&PropertyHandlers, _XROOTPMAP_ID, 1, - property_handle_xrootpmap_id, NULL); + xcb_property_set_handler(&PropertyHandlers, Atoms._XROOTPMAP_ID.Atom, 1, + HandleProperty_xrootpmap_id, NULL); #endif #ifdef DEBUG xcb_property_set_default_handler(&PropertyHandlers, UINT32_MAX, diff --git a/uwm.c b/uwm.c index 240686f..71b8052 100644 --- a/uwm.c +++ b/uwm.c @@ -1,7 +1,7 @@ /// /// @file uwm.c @brief µwm µ window manager main file /// -/// Copyright (c) 2009, 2010 by Lutz Sammer. All Rights Reserved. +/// Copyright (c) 2009 - 2011 by Lutz Sammer. All Rights Reserved. /// /// Contributor(s): /// based on jwm from Joe Wingbermuehle @@ -662,7 +662,7 @@ static void PrintVersion(void) #ifdef GIT_REV "(GIT-" GIT_REV ")" #endif - ", (c) 2009, 2010 by Lutz Sammer\n" + ", (c) 2009 - 2011 by Lutz Sammer\n" "\tLicense AGPLv3: GNU Affero General Public License version 3\n"); } @@ -677,6 +677,9 @@ static void PrintUsage(void) "\t-e\texit µWM (send _UWM_EXIT to the root window)\n" "\t-r\trestart µWM (send _UWM_RESTART to the root window)\n" "\t-p\tparse the configuration file and exit\n" +#ifdef DEBUG + "\t-D\tincrease debug level (more and verbose output)\n" +#endif "\t-? -h\tdisplay this message\n" "\t-v\tdisplay version information\n" "Only idiots print usage on stderr!\n"); } @@ -698,7 +701,7 @@ int main(int argc, char *const argv[]) // Parse command line arguments // for (;;) { - switch (getopt(argc, argv, "hv?-c:d:epr")) { + switch (getopt(argc, argv, "hv?-c:d:eprD")) { case 'c': // config file config_filename = optarg; continue; @@ -717,6 +720,15 @@ int main(int argc, char *const argv[]) ConnectionClose(); return 0; + case 'D': // increase debug level +#ifdef DEBUG + ++DebugLevel; + continue; +#else + fprintf(stderr, "\nCompiled without debug support\n"); + return -1; +#endif + case EOF: break; case 'v': // print version diff --git a/www/index.html b/www/index.html index 65d3430..8e6929b 100644 --- a/www/index.html +++ b/www/index.html @@ -68,6 +68,7 @@

Features

  • multiple screen (xinerama)
  • 64-bit and 32-bit clean; little-endian and big-endian working
  • compatible with uclibc and libc6 +
  • compatible with GCC 4.5.2 and Clang 2.8

    News