Linux: Removed getScreenModeWidth/Height from display.c
This commit is contained in:
parent
936ae90290
commit
026f64a8e5
|
@ -68,14 +68,6 @@ static int current_width;
|
|||
static int current_height;
|
||||
static int current_freq;
|
||||
|
||||
int getScreenModeWidth(void) {
|
||||
return current_width;
|
||||
}
|
||||
|
||||
int getScreenModeHeight(void) {
|
||||
return current_height;
|
||||
}
|
||||
|
||||
static bool getXF86VidModeVersion(JNIEnv *env, Display *disp, int *major, int *minor) {
|
||||
int event_base, error_base;
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
#include <jni.h>
|
||||
#include "common_tools.h"
|
||||
|
||||
extern int getScreenModeWidth(void);
|
||||
extern int getScreenModeHeight(void);
|
||||
extern void resetDisplayMode(JNIEnv *env, int screen, jint extension, jobject gamma_ramp, jobject saved_mode, bool temporary);
|
||||
extern void temporaryRestoreMode(JNIEnv *env, int screen, jint extension, jobject gamma_ramp);
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ static int min(int v1, int v2) {
|
|||
return v1 < v2 ? v1 : v2;
|
||||
}
|
||||
|
||||
static void doHandlePointerMotion(int root_x, int root_y, int win_x, int win_y) {
|
||||
static void doHandlePointerMotion(Window root_window, int root_x, int root_y, int win_x, int win_y) {
|
||||
setCursorPos(win_x, win_y);
|
||||
if (!pointer_grabbed || !shouldGrab())
|
||||
return;
|
||||
|
@ -292,8 +292,10 @@ static void doHandlePointerMotion(int root_x, int root_y, int win_x, int win_y)
|
|||
// cap the window position to the screen dimensions
|
||||
int border_left = max(0, win_left);
|
||||
int border_top = max(0, win_top);
|
||||
int border_right = min(getScreenModeWidth(), win_right);
|
||||
int border_bottom = min(getScreenModeHeight(), win_bottom);
|
||||
XWindowAttributes root_attributes;
|
||||
XGetWindowAttributes(getDisplay(), root_window, &root_attributes);
|
||||
int border_right = min(root_attributes.width, win_right);
|
||||
int border_bottom = min(root_attributes.height, win_bottom);
|
||||
// determine whether the cursor is outside the bounds
|
||||
bool outside_limits = root_x < border_left + POINTER_WARP_BORDER || root_y < border_top + POINTER_WARP_BORDER ||
|
||||
root_x > border_right - POINTER_WARP_BORDER || root_y > border_bottom - POINTER_WARP_BORDER;
|
||||
|
@ -306,7 +308,7 @@ static void doHandlePointerMotion(int root_x, int root_y, int win_x, int win_y)
|
|||
}
|
||||
|
||||
void handlePointerMotion(XMotionEvent *event) {
|
||||
doHandlePointerMotion(event->x_root, event->y_root, event->x, event->y);
|
||||
doHandlePointerMotion(event->root, event->x_root, event->y_root, event->x, event->y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nPollMouse(JNIEnv * env, jclass clazz, jobject coord_buffer_obj, jobject button_buffer_obj) {
|
||||
|
@ -353,5 +355,5 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabMouse(JNIEnv * en
|
|||
setGrab(window_mode, new_grab == JNI_TRUE ? true : false);
|
||||
reset();
|
||||
XQueryPointer(getDisplay(), getCurrentWindow(), &root_return, &child_return, &root_x, &root_y, &win_x, &win_y, &mask_return);
|
||||
doHandlePointerMotion(root_x, root_y, win_x, win_y);
|
||||
doHandlePointerMotion(root_return, root_x, root_y, win_x, win_y);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue