small tweeks and hacks for better integration with kde
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1575 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
638de77243
commit
277d0b6960
1 changed files with 49 additions and 5 deletions
|
@ -74,9 +74,10 @@ static int vidmode_ext = 0;
|
||||||
static XF86VidModeModeInfo **vidmodes;
|
static XF86VidModeModeInfo **vidmodes;
|
||||||
static int num_vidmodes;
|
static int num_vidmodes;
|
||||||
static qboolean vidmode_active = false;
|
static qboolean vidmode_active = false;
|
||||||
|
static int vidmode_usemode = -1; //so that it can be reset if they switch away.
|
||||||
|
|
||||||
unsigned short originalramps[3][256];
|
unsigned short originalramps[3][256];
|
||||||
qboolean originalapplied;
|
qboolean originalapplied; //states that the origionalramps arrays are valid, and contain stuff that we should revert to on close
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern cvar_t _windowed_mouse;
|
extern cvar_t _windowed_mouse;
|
||||||
|
@ -420,8 +421,19 @@ static void GetEvent(void)
|
||||||
b = 2;
|
b = 2;
|
||||||
else if (event.xbutton.button == 3)
|
else if (event.xbutton.button == 3)
|
||||||
b = 1;
|
b = 1;
|
||||||
|
else if (event.xbutton.button == 4)
|
||||||
|
b = 3;
|
||||||
|
else if (event.xbutton.button == 5)
|
||||||
|
b = 4;
|
||||||
if (b>=0)
|
if (b>=0)
|
||||||
Key_Event(K_MOUSE1 + b, true);
|
Key_Event(K_MOUSE1 + b, true);
|
||||||
|
|
||||||
|
if (vidmode_ext && vidmode_usemode>=0)
|
||||||
|
if (!ActiveApp)
|
||||||
|
{ //KDE doesn't seem to like us, in that you can't alt-tab back or click to activate.
|
||||||
|
//This allows us to steal input focus back from the window manager
|
||||||
|
XSetInputFocus(vid_dpy, vid_window, RevertToParent, CurrentTime);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
|
@ -432,6 +444,10 @@ static void GetEvent(void)
|
||||||
b = 2;
|
b = 2;
|
||||||
else if (event.xbutton.button == 3)
|
else if (event.xbutton.button == 3)
|
||||||
b = 1;
|
b = 1;
|
||||||
|
else if (event.xbutton.button == 4)
|
||||||
|
b = 3;
|
||||||
|
else if (event.xbutton.button == 5)
|
||||||
|
b = 4;
|
||||||
if (b>=0)
|
if (b>=0)
|
||||||
Key_Event(K_MOUSE1 + b, false);
|
Key_Event(K_MOUSE1 + b, false);
|
||||||
break;
|
break;
|
||||||
|
@ -439,14 +455,41 @@ static void GetEvent(void)
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
v_gamma.modified = true;
|
v_gamma.modified = true;
|
||||||
ActiveApp = true;
|
ActiveApp = true;
|
||||||
|
|
||||||
|
if (vidmode_ext && vidmode_usemode>=0)
|
||||||
|
{
|
||||||
|
if (!vidmode_active)
|
||||||
|
{
|
||||||
|
// change to the mode
|
||||||
|
XF86VidModeSwitchToMode(vid_dpy, scrnum, vidmodes[vidmode_usemode]);
|
||||||
|
vidmode_active = true;
|
||||||
|
// Move the viewport to top left
|
||||||
|
}
|
||||||
|
XF86VidModeSetViewPort(vid_dpy, scrnum, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
#ifdef WITH_VMODE
|
#ifdef WITH_VMODE
|
||||||
if (originalapplied)
|
if (originalapplied)
|
||||||
XF86VidModeSetGammaRamp(vid_dpy, scrnum, 256, originalramps[0], originalramps[1], originalramps[2]);
|
XF86VidModeSetGammaRamp(vid_dpy, scrnum, 256, originalramps[0], originalramps[1], originalramps[2]);
|
||||||
|
|
||||||
|
if (!COM_CheckParm("-stayactive"))
|
||||||
|
{ //a parameter that leaves the program fullscreen if you taskswitch.
|
||||||
|
//sounds pointless, works great with two moniters. :D
|
||||||
|
if (originalapplied)
|
||||||
|
XF86VidModeSetGammaRamp(vid_dpy, scrnum, 256, originalramps[0], originalramps[1], originalramps[2]);
|
||||||
|
if (vidmode_active)
|
||||||
|
{
|
||||||
|
XF86VidModeSwitchToMode(vid_dpy, scrnum, vidmodes[0]);
|
||||||
|
vidmode_active = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ActiveApp = false;
|
ActiveApp = false;
|
||||||
ClearAllStates();
|
ClearAllStates();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,11 +505,13 @@ static void GetEvent(void)
|
||||||
|
|
||||||
if (!wantwindowed)
|
if (!wantwindowed)
|
||||||
{
|
{
|
||||||
|
Con_DPrintf("uninstall grabs\n");
|
||||||
/* ungrab the pointer */
|
/* ungrab the pointer */
|
||||||
uninstall_grabs();
|
uninstall_grabs();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Con_DPrintf("install grabs\n");
|
||||||
/* grab the pointer */
|
/* grab the pointer */
|
||||||
install_grabs();
|
install_grabs();
|
||||||
}
|
}
|
||||||
|
@ -666,7 +711,7 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
||||||
|
|
||||||
#ifdef WITH_VMODE
|
#ifdef WITH_VMODE
|
||||||
qboolean fullscreen = false;
|
qboolean fullscreen = false;
|
||||||
int MajorVersion, MinorVersion, actualWidth, actualHeight;
|
int MajorVersion, MinorVersion;
|
||||||
|
|
||||||
if (info->fullscreen)
|
if (info->fullscreen)
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
|
@ -735,6 +780,7 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_VMODE
|
#ifdef WITH_VMODE
|
||||||
|
vidmode_usemode = -1;
|
||||||
if (vidmode_ext)
|
if (vidmode_ext)
|
||||||
{
|
{
|
||||||
int best_fit, best_dist, dist, x, y;
|
int best_fit, best_dist, dist, x, y;
|
||||||
|
@ -764,10 +810,8 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
||||||
|
|
||||||
if (best_fit != -1 && (!best_dist || COM_CheckParm("-fullscreen")))
|
if (best_fit != -1 && (!best_dist || COM_CheckParm("-fullscreen")))
|
||||||
{
|
{
|
||||||
actualWidth = vidmodes[best_fit]->hdisplay;
|
|
||||||
actualHeight = vidmodes[best_fit]->vdisplay;
|
|
||||||
// change to the mode
|
// change to the mode
|
||||||
XF86VidModeSwitchToMode(vid_dpy, scrnum, vidmodes[best_fit]);
|
XF86VidModeSwitchToMode(vid_dpy, scrnum, vidmodes[vidmode_usemode=best_fit]);
|
||||||
vidmode_active = true;
|
vidmode_active = true;
|
||||||
// Move the viewport to top left
|
// Move the viewport to top left
|
||||||
XF86VidModeSetViewPort(vid_dpy, scrnum, 0, 0);
|
XF86VidModeSetViewPort(vid_dpy, scrnum, 0, 0);
|
||||||
|
|
Loading…
Reference in a new issue