summaryrefslogtreecommitdiff
path: root/src/user/raleigh/window.cpp
blob: 4373b06b66ff84fc1d39d9aeae16682623694e04 (plain) (blame)
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
#include <raleigh/runtime.h>
#include <raleigh/window.h>
#include <knob/heap.h>

namespace raleigh {
  window::window(widget &root)
    : size(root.size), root(root) {
    root.w = this;
    root.window_offset = coord(0, 0);
    root.notify_window_change();

    pixbuf = (_pixel_t *)get_block(size.x * size.y * sizeof(_pixel_t));

    root.paint(pixbuf, size.x);
    handle = _new_window(size.x, size.y, pixbuf);

    open_windows.add_front(*this);
  }

  window::try_actions_return_t window::try_actions() {
    struct window_action wa;
    window::try_actions_return_t got = NONE;
    while (1) {
      _get_win_action(handle, &wa);
      if (!wa.action_type)
        return got;
      if ((wa.action_type == wa.KEY_DOWN) &&
          (wa.as_key.modifiers & wa.as_key.ALTS) &&
          (wa.as_key.key_id == wa.as_key.KEY_F4))
        return DELETE;
      got = GOOD;
      //TODO
    }
  }
}