Tk Source Code

View Ticket
Login
Ticket UUID: fecd6bd2faeb62aa24df815142c5975cb612746b
Title: linux only: window -zoomed attribute is restored when it should not be.
Type: Bug Version: 8.6.18, 9.0.5, 9.1.0
Submitter: anonymous Created on: 2016-04-29 20:32:48
Subsystem: 48. Geometry Management Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-08 05:11:53
Resolution: Fixed Closed By: serhiy.storchaka
    Closed on: 2026-10-08 05:11:42
Description:
After de-maximizing a Linux window, the -zoomed attribute correctly reports false.
But then doing a withdraw/deiconify does not restore the original window size,
but maximizes the window again.


#!/usr/bin/tclsh

package require Tk

variable vars

proc doupdate { } {
  variable vars

  incr vars(c)
  set vars(txt) "-zoomed is : [wm attributes . -zoomed]"
  append vars(txt) "\n"
  append vars(txt) "The windows is restored to a zoomed state even"
  append vars(txt) "\n"
  append vars(txt) "though the attribute -zoomed was off."
  append vars(txt) "\n"
  append vars(txt) "end of doupdate: calls:$vars(c)"
}

proc chgGeom { } {
  variable vars

  switch $vars(state) {
    0 {
      set vars(state) 1
      set vars(txt) "-zoomed is : [wm attributes . -zoomed]"
      append vars(txt) "\n"
      append vars(txt) "now I will withdraw for a couple of seconds"
      append vars(txt) "and then deiconify"
      update
      after 2000
      wm withdraw .
      update
      after 2000 "wm deiconify .; doupdate"
    }
    default {
    }
  }
}

set vars(c) 0
set vars(state) 0
set vars(txt) {de-maximize me}
ttk::label .l -textvariable vars(txt)
wm attributes . -zoomed 1
pack .l
update
bind . <Configure> chgGeom
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-10-07 19:29:21:

Serhiy, many thanks for the fix! Merged into main, core-9-0-branch, and core-8-6-branch by commits [9b3a47eb], [78765cad], and [129fd4e2].


serhiy.storchaka added on 2026-10-03 15:12:19:

Simpler reproducer:

wm attributes . -zoomed 1
button .b -text "withdraw + deiconify" -command {wm withdraw .; after 500 wm deiconify .}
pack .b

Un-maximize the window with the title bar button, then click the button: the window is maximized again.

Tk only updated the current attributes from _NET_WM_STATE, not the requested ones, so mapping the window again restored the stale requested state.

Proposed fix in branch x11-keep-wm-state. Tested manually with icewm and openbox. Windows has the opposite problem, [897f6672f7].