mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Added get_size() on Unix
This commit is contained in:
parent
f540aae1b9
commit
75e985d08e
|
@ -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);
|
//XSelectInput(s_display, s_window, KeyPressMask | KeyReleaseMask);
|
||||||
XStoreName(s_display, window, title);
|
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)) {
|
if (!(flags & WINDOW_RESIZE)) {
|
||||||
sizeHints.flags = PPosition | PMinSize | PMaxSize;
|
sizeHints.flags = PPosition | PMinSize | PMaxSize;
|
||||||
|
@ -291,6 +293,13 @@ static int process_event(XEvent* event) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ConfigureNotify:
|
||||||
|
{
|
||||||
|
info->width = event->xconfigure.width;
|
||||||
|
info->height = event->xconfigure.height;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -235,7 +235,7 @@ impl Window {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_size(&self) -> (usize, usize) {
|
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)> {
|
pub fn get_mouse_pos(&self, mode: MouseMode) -> Option<(f32, f32)> {
|
||||||
|
|
Loading…
Reference in a new issue