Skip to content

Commit

Permalink
Merge pull request #93 from Archargelod/main
Browse files Browse the repository at this point in the history
Support Nim 2.0
  • Loading branch information
codic12 authored Mar 30, 2024
2 parents 5307384 + e202f76 commit 95837e0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/events/clientmessage.nim
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ proc handleClientMessage*(self: var Wm; ev: XClientMessageEvent) =
let err = self.dpy.XmbTextPropertyToTextList(addr fontProp, cast[
ptr ptr cstring](addr fontList), addr n)
log "Appending to decoration disable list: " & $fontList[0]
self.noDecorList.add re $fontList[0]
self.noDecorList.add re2 $fontList[0]
if err >= Success and n > 0 and fontList != nil:
XFreeStringList cast[ptr cstring](fontList)
discard XFree fontProp.value
Expand Down
16 changes: 8 additions & 8 deletions src/events/maprequest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ proc handleMapRequest*(self: var Wm; ev: XMapRequestEvent): void =
flags, functions, decorations: culong
inputMode: clong
status: culong
if wintype.isSome and wintype.get in {self.netAtoms[
if wintype.isSome and wintype.get in [self.netAtoms[
NetWMWindowTypeDock], self.netAtoms[NetWMWindowTypeDropdownMenu],
self.netAtoms[NetWMWindowTypePopupMenu], self.netAtoms[
NetWMWindowTypeTooltip], self.netAtoms[
NetWMWindowTypeNotification], self.netAtoms[NetWMWindowTypeDesktop]}:
NetWMWindowTypeNotification], self.netAtoms[NetWMWindowTypeDesktop]]:
discard self.dpy.XMapWindow ev.window
discard self.dpy.XLowerWindow ev.window
return # Don't manage irregular windows
Expand All @@ -63,22 +63,22 @@ proc handleMapRequest*(self: var Wm; ev: XMapRequestEvent): void =
fmt: cint
nitem: culong
baf: culong
props: ptr cuchar
props: ptr char
discard self.dpy.XGetWindowProperty(ev.window, self.netAtoms[NetWMState], 0,
high clong, false, AnyPropertyType, addr typ, addr fmt, addr nitem,
addr baf, addr props)
props
if state != nil:
if cast[int](state[]) in {int self.netAtoms[NetWMStateMaximizedHorz],
int self.netAtoms[NetWMStateMaximizedVert]}:
if cast[int](state[]) in [int self.netAtoms[NetWMStateMaximizedHorz],
int self.netAtoms[NetWMStateMaximizedVert]]:
max = true
var chr: XClassHint
discard self.dpy.XGetClassHint(ev.window, addr chr)
block:
for thing in self.noDecorList:
var m: RegexMatch
var m: RegexMatch2
log $chr.resClass
log $thing
log $Regex(thing)
if ($chr.resClass).match thing:
csd = true
frameHeight = 0
Expand Down Expand Up @@ -147,7 +147,7 @@ proc handleMapRequest*(self: var Wm; ev: XMapRequestEvent): void =
addr atr, addr afr, addr nr, addr bar, addr prop_return)
if prop_return == nil: discard self.dpy.XFetchName(ev.window, cast[
ptr cstring](addr prop_return))
cstring prop_return
cast[cstring](prop_return)
if title == nil: title = "Unnamed Window" # why the heck does this window not have a name?!
for button in [1'u8, 3]:
for mask in [uint32 0, Mod2Mask, LockMask,
Expand Down
2 changes: 1 addition & 1 deletion src/events/propertynotify.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ proc handlePropertyNotify*(self: var Wm; ev: XPropertyEvent): void =
addr atr, addr afr, addr nr, addr bar, addr prop_return)
if prop_return == nil: discard self.dpy.XFetchName(ev.window, cast[
ptr cstring](addr prop_return))
$cstring prop_return
$cast[cstring](prop_return)
if client.title == title: return
client.title = title
self.renderTop client[]
4 changes: 2 additions & 2 deletions src/wm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type
focused*: Option[uint]
tags*: TagSet
layout*: Layout
noDecorList*: seq[Regex]
noDecorList*: seq[Regex2]
focusMode*: FocusMode

proc initWm*(): Wm =
Expand Down Expand Up @@ -169,7 +169,7 @@ proc initWm*(): Wm =
focusMode: FocusFollowsClick
)

func findClient*(
proc findClient*(
self: var Wm;
predicate: proc(client: Client): bool
): Option[(ptr Client, uint)] =
Expand Down

0 comments on commit 95837e0

Please sign in to comment.