about summary refs log tree commit diff stats
path: root/dwm.h
Commit message (Expand)AuthorAgeFilesLines
* made Layout a static struct in layout.c, added some convenience getters in la...Anselm R. Garbe2007-08-131-7/+4
* moved floating to layout.c, kept tile.c outsideAnselm R. Garbe2007-08-121-0/+2
* separated layout-specific stuff into separate .h and .c files which are inclu...Anselm R. Garbe2007-08-111-4/+1
* removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist ...Anselm R. Garbe2007-08-101-5/+2
* I introduced {H,V}RATIO and inc{h,v,}ratio() functions - the default behaves ...Anselm R. Garbe2007-08-041-2/+2
* implemented ratio tile as described on the mailinglistAnselm R. Garbe2007-08-031-1/+2
* changed ban/unban implementation to not move the windows anymore, but map/unm...Anselm R. Garbe2007-07-281-0/+1
* removed shiftview(), if you scroll the views in the tag area, you can also us...Anselm R. Garbe2007-07-281-1/+0
* applied Jeroen Schot's shiftview patchAnselm R. Garbe2007-07-241-0/+1
* added an creatnotify event handlerAnselm R. Garbe2007-06-041-1/+3
* making variable declarations in dwm.h extern, this seems to be more ansi comp...Anselm R. Garbe2007-06-011-15/+15
* referred to LICENSE file 4.2Anselm R. Garbe2007-05-301-6/+1
* Jukka also belongs to Copyright holders after all he has contributed and done...Anselm R. Garbe2007-05-301-0/+1
* added nsz to copyright holders as well, because he did a lot recentlyAnselm R. Garbe2007-05-291-0/+1
* added anydot to Copyright holders, because he contributed a lot recentlyAnselm R. Garbe2007-05-291-0/+1
* applied anydot's 3 minor patches, thank you anydotAnselm R. Garbe2007-05-291-2/+1
* fooAnselm R. Garbe2007-05-231-1/+1
* made bar togglalbleAnselm R. Garbe2007-05-151-9/+12
* applied dfenze cleanups, fixed some comments in dwm.hAnselm R. Garbe2007-05-141-4/+5
* fixed the border issue for mplayer, ff is definately broken when using F11 (f... 4.0Anselm R. Garbe2007-04-191-1/+1
* yet another fix of copyright compactisitionAnselm R. Garbe2007-04-131-1/+2
* some changes to updatesizehints, I don't change the aspect ratio algorithm no...Anselm R. Garbe2007-03-011-1/+1
* removed sendeventAnselm R. Garbe2007-02-261-1/+0
* removed an unnecessary newlineAnselm R. Garbe2007-02-241-1/+0
* removed superfluous externs (except for tags, because tags is defined in the ...Anselm R. Garbe2007-02-241-53/+53
* renamed untiled into floating, keeping tiled instead of tiling (afaik tiled s...Anselm R. Garbe2007-02-221-4/+4
* made Fnt an anonymous inner structAnselm R. Garbe2007-02-221-15/+15
* made Fnt an anonymous inner structAnselm R. Garbe2007-02-221-9/+7
* renamed versatile into untiledAnselm R. Garbe2007-02-221-4/+4
* merged focus{prev.next} into focusclient(1/-1)Anselm R. Garbe2007-02-221-2/+1
* made dwm.h more tidy (thx Jukka for the zoom() hint)Anselm R. Garbe2007-02-221-12/+11
* replaced Arg union with const char *arg, seems cleaner to me, even if we need...Anselm R. Garbe2007-02-221-20/+15
* fixing missing extern declars in dwm.h for {de,at}tach()Anselm R. Garbe2007-02-221-0/+2
* several changes, made togglemax extern and separated it from zoom() - moved z...Anselm R. Garbe2007-02-221-15/+15
* reverted accidental removal of sx, syAnselm R. Garbe2007-02-211-1/+1
* removed some global vars which should be static insteadAnselm R. Garbe2007-02-211-2/+2
* moved focus{next,prev} and nexttiled from client.c to layout.c (because those...Anselm R. Garbe2007-02-211-4/+4
* fixed quoting and a comment 3.6Anselm R. Garbe2007-02-211-1/+1
* added draw.c again (except getcolor and setfont which are helpers in main.c)Anselm R. Garbe2007-02-201-4/+6
* separating drawsquare from drawtext, made drawtext externAnselm R. Garbe2007-02-201-0/+2
* split screen.c into layout.c and tag.c (because the view is an implicit mixtu...Anselm R. Garbe2007-02-201-8/+10
* replaced togglelayout with setlayoutAnselm R. Garbe2007-02-191-1/+1
* renamed Client->versatile and Rule->versatile into Client->isversatile resp. ...Anselm R. Garbe2007-02-191-1/+1
* renames swim[ming] into versatileAnselm R. Garbe2007-02-191-3/+3
* renamed floating into swimming (this does not clash with C naming conventions...Anselm R. Garbe2007-02-191-4/+3
* introduced Layout structAnselm R. Garbe2007-02-191-7/+12
* forgot an extern declarationAnselm R. Garbe2007-02-191-1/+1
* removed procevent, more refactoringAnselm R. Garbe2007-02-191-1/+0
* draw.c is useless (belongs to main.c now)Anselm R. Garbe2007-02-191-8/+3
* renamed view.c into screen.cAnselm R. Garbe2007-02-191-6/+4
ef='#n37'>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
152
153
154
155
156

                                  
                                        
                                             
                               
                                                  
                                                                          
                                                                            
                                                                                              
                                                                                                       
                      
                                                    

                                                                   
                                                                                
                                                                                       
                                                                                                    


                                                                                


                                          
                                  
                        






                                                                             
                                           




                                                                



























































                                                                                                                                                                 

                              
                                                          
                                             

















                                                           



                                                                           
                         

   

                                             
                                                          
                                                                                 

                                               
                             





















                                                                                    
function test_resize_window()
  io.write('\ntest_resize_window')
  App.screen.init{width=300, height=300}
  Editor_state = edit.initialize_test_state()
  Editor_state.filename = 'foo'
  Log_browser_state = edit.initialize_test_state()
  check_eq(App.screen.width, 300, 'F - test_resize_window/baseline/width')
  check_eq(App.screen.height, 300, 'F - test_resize_window/baseline/height')
  check_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/baseline/left_margin')
  check_eq(Editor_state.right, 300 - Test_margin_right, 'F - test_resize_window/baseline/right_margin')
  App.resize(200, 400)
  -- ugly; resize switches to real, non-test margins
  check_eq(App.screen.width, 200, 'F - test_resize_window/width')
  check_eq(App.screen.height, 400, 'F - test_resize_window/height')
  check_eq(Editor_state.left, Margin_left, 'F - test_resize_window/left_margin')
  check_eq(Editor_state.right, 200-Margin_right, 'F - test_resize_window/right_margin')
  check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'F - test_resize_window/drawing_width')
  -- TODO: how to make assertions about when App.update got past the early exit?
end

function test_show_log_browser_side()
  io.write('\ntest_show_log_browser_side')
  App.screen.init{width=300, height=300}
  Display_width = App.screen.width
  Current_app = 'source'
  Editor_state = edit.initialize_test_state()
  Editor_state.filename = 'foo'
  Text.redraw_all(Editor_state)
  Log_browser_state = edit.initialize_test_state()
  Text.redraw_all(Log_browser_state)
  log_browser.parse(Log_browser_state)
  check(not Show_log_browser_side, 'F - test_show_log_browser_side/baseline')
  -- pressing ctrl+l shows log-browser side
  App.wait_fake_time(0.1)
  App.run_after_keychord('C-l')
  check(Show_log_browser_side, 'F - test_show_log_browser_side')
end

function test_show_log_browser_side_doubles_window_width_if_possible()
  io.write('\ntest_show_log_browser_side_doubles_window_width_if_possible')
  -- initialize screen dimensions to half width
  App.screen.init{width=300, height=300}
  Display_width = App.screen.width*2
  -- initialize source app with left side occupying entire window (half the display)
  Current_app = 'source'
  Editor_state = edit.initialize_test_state()
  Editor_state.filename = 'foo'
  Editor_state.left = Margin_left
  Editor_state.right = App.screen.width - Margin_right
  local old_editor_right = Editor_state.right
  Text.redraw_all(Editor_state)
  Log_browser_state = edit.initialize_test_state()
  -- log browser has some arbitrary margins
  Log_browser_state.left = 200 + Margin_left
  Log_browser_state.right = 400
  Text.redraw_all(Log_browser_state)
  log_browser.parse(Log_browser_state)
  -- display log browser
  App.wait_fake_time(0.1)
  App.run_after_keychord('C-l')
  -- window width is doubled
  check_eq(App.screen.width, 600, 'F - test_show_log_browser_side_doubles_window_width_if_possible/display:width')
  -- left side margins are unchanged
  check_eq(Editor_state.left, Margin_left, 'F - test_show_log_browser_side_doubles_window_width_if_possible/edit:left')
  check_eq(Editor_state.right, old_editor_right, 'F - test_show_log_browser_side_doubles_window_width_if_possible/edit:right')
  -- log browser margins are adjusted
  check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'F - test_show_log_browser_side_doubles_window_width_if_possible/log:left')
  check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'F - test_show_log_browser_side_doubles_window_width_if_possible/log:right')
end

function test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width()
  io.write('\ntest_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width')
  -- initialize screen dimensions and indicate that it is maximized
  App.screen.init{width=300, height=300}
  Display_width = 300
  -- initialize source app with left side occupying more than half the display
  Current_app = 'source'
  Editor_state = edit.initialize_test_state()
  Editor_state.filename = 'foo'
  Editor_state.left = Margin_left
  Editor_state.right = 200
  Text.redraw_all(Editor_state)
  Log_browser_state = edit.initialize_test_state()
  -- log browser has some arbitrary margins
  Log_browser_state.left = 200 + Margin_left
  Log_browser_state.right = 400
  Text.redraw_all(Log_browser_state)
  log_browser.parse(Log_browser_state)
  -- display log browser
  App.wait_fake_time(0.1)
  App.run_after_keychord('C-l')
  -- margins are now adjusted
  check_eq(Editor_state.left, Margin_left, 'F - test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width/edit:left')
  check_eq(Editor_state.right, App.screen.width/2 - Margin_right, 'F - test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width/edit:right')
  check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'F - test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width/log:left')
  check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'F - test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width/log:right')
end

function test_drop_file()
  io.write('\ntest_drop_file')
  App.screen.init{width=Editor_state.left+300, height=300}
  Editor_state = edit.initialize_test_state()
  App.filesystem['foo'] = 'abc\ndef\nghi\n'
  local fake_dropped_file = {
    opened = false,
    getFilename = function(self)
                    return 'foo'
                  end,
    open = function(self)
             self.opened = true
           end,
    lines = function(self)
              assert(self.opened)
              return App.filesystem['foo']:gmatch('[^\n]+')
            end,
    close = function(self)
              self.opened = false
            end,
  }
  App.filedropped(fake_dropped_file)
  check_eq(#Editor_state.lines, 3, 'F - test_drop_file/#lines')
  check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')
  check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')
  check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
  edit.draw(Editor_state)
end

function test_drop_file_saves_previous()
  io.write('\ntest_drop_file_saves_previous')
  App.screen.init{width=Editor_state.left+300, height=300}
  -- initially editing a file called foo that hasn't been saved to filesystem yet
  Editor_state.lines = load_array{'abc', 'def'}
  Editor_state.filename = 'foo'
  schedule_save(Editor_state)
  -- now drag a new file bar from the filesystem
  App.filesystem['bar'] = 'abc\ndef\nghi\n'
  local fake_dropped_file = {
    opened = false,
    getFilename = function(self)
                    return 'bar'
                  end,
    open = function(self)
             self.opened = true
           end,
    lines = function(self)
              assert(self.opened)
              return App.filesystem['bar']:gmatch('[^\n]+')
            end,
    close = function(self)
              self.opened = false
            end,
  }
  App.filedropped(fake_dropped_file)
  -- filesystem now contains a file called foo
  check_eq(App.filesystem['foo'], 'abc\ndef\n', 'F - test_drop_file_saves_previous')
end