Skip to content

Commit

Permalink
Set wm_attribute -type value for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed Oct 31, 2023
1 parent a468735 commit f78798a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/app/SubPane.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def __init__(
self.can_resize_y = resize_y
super().__init__(parent, name='pane_' + name)
self.withdraw() # Hide by default
if utils.LINUX:
self.wm_attributes('-type', 'utility')

self.tool_button = make_tool_button(
tool_frame, tk_img,
Expand Down
3 changes: 2 additions & 1 deletion src/app/UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,8 @@ def init_drag_icon() -> None:
# appearing in this window.
drag_win.overrideredirect(True)
drag_win.resizable(False, False)
drag_win.withdraw()
if utils.LINUX:
drag_win.wm_attributes('-type', 'dnd')
drag_win.transient(master=TK_ROOT)
drag_win.withdraw() # starts hidden
drag_win.bind(tk_tools.EVENTS['LEFT_RELEASE'], drag_stop)
Expand Down
2 changes: 2 additions & 0 deletions src/app/contextWin.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
window.overrideredirect(True)
window.resizable(False, False)
window.transient(master=TK_ROOT)
if utils.LINUX:
window.wm_attributes('-type', 'popup_menu')
window.withdraw() # starts hidden

SUBITEM_POS = {
Expand Down
4 changes: 3 additions & 1 deletion src/app/helpMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,14 @@ def __init__(self, name: str, title: TransToken, text: str):
set_win_title(self, title)
self.transient(master=TK_ROOT)
self.resizable(width=True, height=True)
if utils.LINUX:
self.wm_attributes('-type', 'dialog')
self.text = text
tk_tools.set_window_icon(self)

# Hide when the exit button is pressed, or Escape
# on the keyboard.
self.protocol("WM_DELETE_WINDOW", self.withdraw)
self.wm_protocol("WM_DELETE_WINDOW", self.withdraw)
self.bind("<Escape>", f"wm withdraw {self}")

frame = tk.Frame(self, background='white')
Expand Down
7 changes: 5 additions & 2 deletions src/app/tooltip.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from ui_tk.img import TK_IMG
# Don't import set_text directly, could be confused with tooltip setter.
from ui_tk import wid_transtoken
import utils


__all__ = ['set_tooltip', 'add_tooltip']
Expand All @@ -27,8 +28,10 @@
window = tk.Toplevel(TK_ROOT, name='tooltipWin')
window.withdraw()
window.transient(master=TK_ROOT)
window.overrideredirect(True)
window.resizable(False, False)
window.wm_overrideredirect(True)
window.wm_resizable(False, False)
if utils.LINUX:
window.wm_attributes('-type', 'tooltip')

context_label = tk.Label(
window,
Expand Down
4 changes: 3 additions & 1 deletion src/bg_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def __init__(
self.win = tk.Toplevel(TK_ROOT, name=f'loadscreen_{scr_id}')
self.win.withdraw()
self.win.wm_overrideredirect(True)
self.win.attributes('-topmost', int(force_ontop))
self.win.wm_attributes('-topmost', int(force_ontop))
if utils.LINUX:
self.win.wm_attributes('-type', 'splash')
self.win['cursor'] = tk_tools.Cursors.WAIT
self.win.grid_columnconfigure(0, weight=1)
self.win.grid_rowconfigure(0, weight=1)
Expand Down
2 changes: 2 additions & 0 deletions src/ui_tk/dragdrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def __init__(
self._drag_win = drag_win = tk.Toplevel(parent, name='drag_icon')
drag_win.withdraw()
drag_win.transient(master=parent)
if utils.LINUX:
drag_win.wm_attributes('-type', 'dnd')
drag_win.wm_overrideredirect(True)

self._drag_lbl = tk.Label(drag_win)
Expand Down

0 comments on commit f78798a

Please sign in to comment.