Skip to content

Commit

Permalink
Cope with windows that don't want focus at all
Browse files Browse the repository at this point in the history
  • Loading branch information
bavardage committed Feb 22, 2009
1 parent 7ee0294 commit 8c6a1f7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions libqtile/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import marshal, sys
import Xlib
from Xlib import X, Xatom
from Xlib import X, Xatom, Xutil
import Xlib.protocol.event as event
import Xlib.error
import command, utils
Expand All @@ -38,9 +38,11 @@ def __init__(self, window, qtile):
self.minimised = False
self.floatDimensions = {'x': 0, 'y': 0, 'w': 0, 'h': 0}
self.urgent = False
self.nofocus = False
self.updateName()
self.updateFloating()
self.updateUrgency()
self.updateFocus()

def updateName(self):
try:
Expand Down Expand Up @@ -95,6 +97,17 @@ def updateUrgency(self):
if self.urgent != old_value:
manager.Hooks.call_hook("client-urgent-hint-changed", self)

def updateFocus(self):
try:
h = self.window.get_wm_hints()
except:
return
if h is None:
return
if not (h.flags & Xutil.InputHint):
self.nofocus = True
else:
self.nofocus = not h.input

def info(self):
return dict(
Expand Down Expand Up @@ -211,7 +224,7 @@ def place(self, x, y, width, height, border, borderColor):
)

def focus(self, warp):
if not self.hidden:
if not self.hidden and not self.nofocus:
self.window.set_input_focus(
X.RevertToPointerRoot,
X.CurrentTime
Expand Down

0 comments on commit 8c6a1f7

Please sign in to comment.