Added get_size() on Unix

This commit is contained in:
Daniel Collin 2016-05-01 10:16:39 +02:00
parent f540aae1b9
commit 75e985d08e
2 changed files with 11 additions and 2 deletions

View file

@ -154,7 +154,9 @@ void* mfb_open(const char* title, int width, int height, unsigned int flags, int
//XSelectInput(s_display, s_window, KeyPressMask | KeyReleaseMask);
XStoreName(s_display, window, title);
XSelectInput(s_display, window, ButtonPressMask | KeyPressMask | KeyReleaseMask | ButtonReleaseMask);
XSelectInput(s_display, window,
StructureNotifyMask |
ButtonPressMask | KeyPressMask | KeyReleaseMask | ButtonReleaseMask);
if (!(flags & WINDOW_RESIZE)) {
sizeHints.flags = PPosition | PMinSize | PMaxSize;
@ -291,6 +293,13 @@ static int process_event(XEvent* event) {
break;
}
case ConfigureNotify:
{
info->width = event->xconfigure.width;
info->height = event->xconfigure.height;
break;
}
}
return 1;

View file

@ -235,7 +235,7 @@ impl Window {
#[inline]
pub fn get_size(&self) -> (usize, usize) {
(0, 0)
(self.shared_data.width as usize, self.shared_data.height as usize)
}
pub fn get_mouse_pos(&self, mode: MouseMode) -> Option<(f32, f32)> {