about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dwm.c b/dwm.c
index 4a8c2a9..507084c 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1590,7 +1590,7 @@ updategeom(void) {
 	if(XineramaIsActive(dpy)) {
 		info = XineramaQueryScreens(dpy, &i);
 		wx = info[0].x_org;
-		wy = showbar && topbar ? info[0].y_org + info[0].height + bh : info[0].y_org;
+		wy = showbar && topbar ? info[0].y_org + bh : info[0].y_org;
 		ww = info[0].width;
 		wh = showbar ? info[0].height - bh : info[0].height;
 		XFree(info);
tik.com> 2020-09-16 23:46:25 -0700 6796' href='/akkartik/mu/commit/apps/tile/environment.mu?h=main&id=7ecfd5eba9d9f45a2ccd5237bd68d8b24b26978b'>7ecfd5eb ^
7ecfd5eb ^




47821f1b ^

7ecfd5eb ^

47821f1b ^

7ecfd5eb ^
47821f1b ^
7ecfd5eb ^























































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151








































































                                                                                              

                                                    

                  

                                                              
                             
                                                    
       




                                        

                                                     

                  

                                                              
                             
                                                    























































                                                            
type environment {
  screen: (handle screen)
  buf: gap-buffer
  cursor-row: int
  cursor-col: int
}

fn initialize-environment _env: (addr environment) {
  var env/esi: (addr environment) <- copy _env
  var screen-ah/edi: (addr handle screen) <- get env, screen
  var _screen/eax: (addr screen) <- lookup *screen-ah
  var screen/edi: (addr screen) <- copy _screen
  var nrows/eax: int <- copy 0
  var ncols/ecx: int <- copy 0
  nrows, ncols <- screen-size screen
  # cursor-col
  var midcol/edx: int <- copy ncols
  midcol <- shift-right 1
  var start-col/edx: int <- copy midcol
  start-col <- add 2
  {
    var cursor-col/eax: (addr int) <- get env, cursor-col
    copy-to *cursor-col start-col
  }
  # cursor-row
  var midrow/ebx: int <- copy 0
  {
    var tmp/eax: int <- try-divide nrows, 3
    midrow <- copy tmp
  }
  var start-row/ebx: int <- copy midrow
  start-row <- subtract 3
  {
    var cursor-row/eax: (addr int) <- get env, cursor-row
    copy-to *cursor-row start-row
  }
  # buf
  var gap/eax: (addr gap-buffer) <- get env, buf
  initialize-gap-buffer gap
}

fn initialize-environment-with-fake-screen _self: (addr environment), nrows: int, ncols: int {
  var self/esi: (addr environment) <- copy _self
  var screen-ah/eax: (addr handle screen) <- get self, screen
  allocate screen-ah
  var screen-addr/eax: (addr screen) <- lookup *screen-ah
  initialize-screen screen-addr, nrows, ncols
  initialize-environment self
}

fn render-loop _self: (addr environment) {
  var self/esi: (addr environment) <- copy _self
  render self
  #
  $interactive:loop: {
    var key/eax: grapheme <- read-key-from-real-keyboard
    compare key, 0x71  # 'q'
    break-if-=
    process self, key
    loop
  }
}

fn process _self: (addr environment), key: grapheme {
$process:body: {
    var self/esi: (addr environment) <- copy _self
    var screen-ah/edi: (addr handle screen) <- get self, screen
    var _screen/eax: (addr screen) <- lookup *screen-ah
    var screen/edi: (addr screen) <- copy _screen
    var buf/ebx: (addr gap-buffer) <- get self, buf
    compare key, 0x445b1b  # left-arrow
    {
      break-if-!=
      var char-skipped/eax: grapheme <- gap-left buf
      compare char-skipped, -1
      {
        break-if-=
        var cursor-row/eax: (addr int) <- get self, cursor-row
        var cursor-col/ecx: (addr int) <- get self, cursor-col
        decrement *cursor-col
        move-cursor screen, *cursor-row, *cursor-col
      }
      break $process:body
    }
    compare key, 0x435b1b  # right-arrow
    {
      break-if-!=
      var char-skipped/eax: grapheme <- gap-right buf
      compare char-skipped, -1
      {
        break-if-=
        var cursor-row/eax: (addr int) <- get self, cursor-row
        var cursor-col/ecx: (addr int) <- get self, cursor-col
        increment *cursor-col
        move-cursor screen, *cursor-row, *cursor-col
      }
      break $process:body
    }
    var g/ecx: grapheme <- copy key
    var print?/eax: boolean <- real-grapheme? key
    {
      compare print?, 0  # false
      break-if-=
      add-grapheme-at-gap buf, g
      var cursor-col/eax: (addr int) <- get self, cursor-col
      increment *cursor-col
      render self
      break $process:body
    }
    # silently ignore other hotkeys
}
}

fn render _env: (addr environment) {
  var env/esi: (addr environment) <- copy _env
  var screen-ah/edi: (addr handle screen) <- get env, screen
  var _screen/eax: (addr screen) <- lookup *screen-ah
  var screen/edi: (addr screen) <- copy _screen
  clear-screen screen
  var nrows/eax: int <- copy 0
  var ncols/ecx: int <- copy 0
  nrows, ncols <- screen-size screen
  var midcol/edx: int <- copy ncols
  midcol <- shift-right 1
  draw-vertical-line screen, 1, nrows, midcol
  var midrow/ebx: int <- copy 0
  {
    var tmp/eax: int <- try-divide nrows, 3
    midrow <- copy tmp
  }
  var left-col/edx: int <- copy midcol
  left-col <- increment
  draw-horizontal-line screen, midrow, left-col, ncols
#?   # some debug info
#?   ncols <- subtract 2
#?   move-cursor screen, 1, ncols
  var buf/ecx: (addr gap-buffer) <- get env, buf
#?   var foo/eax: int <- gap-buffer-length buf
#?   print-int32-decimal screen, foo
  #
  var start-row/ebx: int <- copy midrow
  start-row <- subtract 3
  var start-col/edx: int <- copy left-col
  start-col <- increment
  move-cursor screen, start-row, start-col
  render-gap-buffer screen, buf
  # update cursor
  var cursor-row/eax: (addr int) <- get env, cursor-row
  var cursor-col/ecx: (addr int) <- get env, cursor-col
  move-cursor screen, *cursor-row, *cursor-col
}