|
1 | 1 | #include <X11/Xlib.h>
|
2 | 2 | #include <X11/Xutil.h>
|
3 | 3 | #include "../window_manager.h"
|
| 4 | +#include <iostream> |
4 | 5 | extern "C" {
|
5 | 6 | #include "../xdisplay.h"
|
6 | 7 | }
|
@@ -82,23 +83,28 @@ bool focusWindow(const WindowHandle windowHandle) {
|
82 | 83 | return false;
|
83 | 84 | }
|
84 | 85 |
|
85 |
| -bool resizeWindow(const WindowHandle windowHandle, const MMRect& rect) { |
| 86 | +bool resizeWindow(const WindowHandle windowHandle, const MMSize newSize) { |
| 87 | + std::cout << "resizing" << std::endl; |
86 | 88 | Display* display = XGetMainDisplay();
|
87 | 89 | if (display != NULL && windowHandle >= 0) {
|
88 |
| - XWindowChanges changes; |
89 |
| - |
90 |
| - //size |
91 |
| - changes.width = rect.size.width; |
92 |
| - changes.height = rect.size.height; |
93 |
| - |
94 |
| - //origin |
95 |
| - changes.x = rect.origin.x; |
96 |
| - changes.y = rect.origin.y; |
97 |
| - |
98 |
| - // Resize and move the window |
99 |
| - XConfigureWindow(display, windowHandle, CWX | CWY | CWWidth | CWHeight, &changes); |
| 90 | + XResizeWindow(display, windowHandle, newSize.width, newSize.height); |
100 | 91 | XFlush(display);
|
101 |
| - |
| 92 | + std::cout << "resized" << std::endl; |
| 93 | + |
| 94 | + return true; |
| 95 | + } |
| 96 | + return false; |
| 97 | +} |
| 98 | + |
| 99 | +bool moveWindow(const WindowHandle windowHandle, const MMPoint newOrigin) { |
| 100 | + std::cout << "moving" << std::endl; |
| 101 | + |
| 102 | + Display* display = XGetMainDisplay(); |
| 103 | + if (display != NULL && windowHandle >= 0) { |
| 104 | + XMoveWindow(display, windowHandle, newOrigin.x, newOrigin.y); |
| 105 | + XFlush(display); |
| 106 | + std::cout << "moved" << std::endl; |
| 107 | + |
102 | 108 | return true;
|
103 | 109 | }
|
104 | 110 | return false;
|
|
0 commit comments