| 1 | #include <X11/Xlib.h> |
| 2 | |
| 3 | #include <stdexcept> |
| 4 | |
| 5 | #include "screen.hh" |
| 6 | |
| 7 | namespace uw { |
| 8 | Screen::Screen() { |
| 9 | dp = XOpenDisplay(nullptr); |
| 10 | if (dp == nullptr) throw std::runtime_error("X画面を開くに失敗。"); |
| 11 | |
| 12 | screen = DefaultScreen(dp); |
| 13 | w = RootWindow(dp, screen); |
| 14 | extent.width = DisplayWidth(dp, screen); |
| 15 | extent.height = DisplayHeight(dp, screen); |
| 16 | } |
| 17 | |
| 18 | Screen::~Screen() { |
| 19 | XCloseDisplay(dp); |
| 20 | } |
| 21 | } |