Subject: bug#19413: 24.4; (desktop-save-mode 1) save frame as page and desktop sticky (_NET_WM_STATE_STICKY) when close Emacs shaded, (setq desktop-restore-frames nil) fix issue.

From: Oleksandr Gavenko <[email-masked]>
Date: Sat, 20 Dec 2014 00:35:12 +0200

On 2014-12-19, Eli Zaretskii wrote:

>> When I use Fvwm `WindowShade` command on Emacs window it hided, only titlebar
>> shown.
>> 
>> If I close Emacs in shaded state and run again it gain sticky attribute (so it
>> shown on every page/desktop, follow my page/desktop switching).
>> 
>> So with "emacs -q" and only "(desktop-save-mode 1)" this behavior reproduced.
>
> AFAIR, Debian has a lot of stuff hiding in site-init files, and -q
> doesn't disable that.  Does the same problem happen with -Q or
> --no-site-file?

Ok. I reproduce with --no-site-file and clean ~/.emacs with only:

  (desktop-save-mode 1)

But one correction - I lay about "-q". Evaluation of (desktop-save-mode 1) in
non-startup stage works different. For example it doesn't read
~/.emacs.desktop file (or just doesn't rearrange frame geometry) and when I
leave Emacs - it prompt for place for .emacs.desktop. With --no-site-file and
above ~/.emacs I am not asked for savefile and bug reproduced.

Here X window properties for shaded Emacs:

  $ xprop -id 0x200001a

  _NET_WM_STATE(ATOM) = _NET_WM_STATE_SHADED
  _MOTIF_DRAG_RECEIVER_INFO(_MOTIF_DRAG_RECEIVER_INFO) = 0x6c, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
  XdndAware(ATOM) = BITMAP
  WM_STATE(WM_STATE):
                  window state: Normal
                  icon window: 0x0
  _WIN_AREA(CARDINAL) = 0, 0
  _WIN_WORKSPACE(CARDINAL) = 2
  _WIN_LAYER(CARDINAL) = 4
  _WIN_STATE(CARDINAL) = 32
  _NET_FRAME_EXTENTS(CARDINAL) = 6, 6, 22, 6
  _KDE_NET_WM_FRAME_STRUT(CARDINAL) = 6, 6, 22, 6
  _NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_STICK
  _NET_WM_DESKTOP(CARDINAL) = 2
  _NET_WM_ICON_VISIBLE_NAME(UTF8_STRING) = "EMACS desktop.home.int: *unsent wide reply to Eli Zaretskii*"
  _NET_WM_VISIBLE_NAME(UTF8_STRING) = "EMACS desktop.home.int: *unsent wide reply to Eli Zaretskii* «Emacs:emacs»"
  WM_HINTS(WM_HINTS):
                  Client accepts input or input focus: True
                  Initial state is Normal State.
                  bitmap id # to use for icon: 0x200097e
                  bitmap id # of mask for icon: 0x2000984
                  window id # of group leader: 0x2000001
  _NET_WM_ICON(CARDINAL) =        Icon (48 x 48):
  _NET_WM_OPAQUE_REGION(CARDINAL) = 7, 0, 1894, 7, 0, 7, 1908, 1165
  _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
  _NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 33554460, 33554461
  _NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x200001b
  WM_CLIENT_LEADER(WINDOW): window id # 0x2000001
  _NET_WM_PID(CARDINAL) = 19038
  WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
  WM_CLIENT_MACHINE(STRING) = "desktop"
  WM_NORMAL_HINTS(WM_SIZE_HINTS):
                  program specified minimum size: 0 by 0
                  program specified base size: 0 by 0
                  window gravity: NorthWest
  WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
  WM_CLASS(STRING) = "emacs", "Emacs"
  WM_ICON_NAME(STRING) = "EMACS desktop.home.int: *unsent wide reply to Eli Zaretskii*"
  _NET_WM_ICON_NAME(UTF8_STRING) = "EMACS desktop.home.int: *unsent wide reply to Eli Zaretskii*"
  WM_NAME(STRING) = "EMACS desktop.home.int: *unsent wide reply to Eli Zaretskii*"
  _NET_WM_NAME(UTF8_STRING) = "EMACS desktop.home.int: *unsent wide reply to Eli Zaretskii*"

I see difference in value:

  _NET_WM_STATE(ATOM) = _NET_WM_STATE_SHADED

vs:

  _NET_WM_STATE(ATOM) = _NET_WM_STATE_STICKY

Is desktop-save code incorrectly recognise _NET_WM_STATE_SHADED ?

-- 
Best regards!