Skip to content

Commit 7ba0a11

Browse files
authored
client: add r_noborder mode
1 parent bc8afa0 commit 7ba0a11

9 files changed

Lines changed: 73 additions & 5 deletions

File tree

cmake/WolfBuildClient.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ endif()
106106
endfunction()
107107

108108
if(WOLF_64BITS)
109-
#setup_client(wolfmp_gl_x64 FALSE)
109+
setup_client(wolfmp_gl_x64 FALSE)
110110
setup_client(wolfmp_vk_x64 TRUE)
111111
else()
112112
setup_client(wolfmp_gl_x86 FALSE)

src/renderer_gl/tr_init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ int max_polys;
199199
cvar_t *r_maxpolyverts;
200200
int max_polyverts;
201201

202+
cvar_t *r_noborder;
203+
202204

203205
void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
204206
void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
@@ -1102,6 +1104,8 @@ void R_Register( void ) {
11021104
r_maxpolys = ri.Cvar_Get( "r_maxpolys", va( "%d", MAX_POLYS ), 0 );
11031105
r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", va( "%d", MAX_POLYVERTS ), 0 );
11041106

1107+
r_noborder = ri.Cvar_Get("r_noborder", "0", CVAR_ARCHIVE | CVAR_LATCH);
1108+
11051109
r_highQualityVideo = ri.Cvar_Get( "r_highQualityVideo", "1", CVAR_ARCHIVE );
11061110
// make sure all the commands added here are also
11071111
// removed in R_Shutdown

src/renderer_gl/tr_local.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,8 @@ extern cvar_t *r_wolffog;
11511151
// done
11521152

11531153
extern cvar_t *r_highQualityVideo;
1154+
1155+
extern cvar_t *r_noborder;
11541156
//====================================================================
11551157

11561158
float R_NoiseGet4f( float x, float y, float z, float t );

src/renderer_vk/tr_init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ cvar_t *r_sleepThreshold;
178178
cvar_t *r_msaa;
179179
cvar_t *r_alphaboost;
180180

181+
cvar_t *r_noborder;
182+
181183
//-------------------------------------------------------------------------------
182184
// Ridah, mesh compression
183185
float r_anormals[NUMMDCVERTEXNORMALS][3] = {
@@ -862,6 +864,8 @@ void R_Register( void ) {
862864
r_msaa = ri.Cvar_Get("r_msaa", "8", CVAR_ARCHIVE | CVAR_LATCH);
863865
r_alphaboost = ri.Cvar_Get("r_alphaboost", "1.0", CVAR_ARCHIVE);
864866

867+
r_noborder = ri.Cvar_Get("r_noborder", "0", CVAR_ARCHIVE | CVAR_LATCH);
868+
865869
// make sure all the commands added here are also
866870
// removed in R_Shutdown
867871
ri.Cmd_AddCommand( "imagelist", R_ImageList_f );

src/renderer_vk/tr_local.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,8 @@ extern cvar_t *r_sleepThreshold; // time cushion in us for a call to Sleep(1+)
12051205

12061206
extern cvar_t *r_msaa;
12071207
extern cvar_t *r_alphaboost;
1208+
1209+
extern cvar_t *r_noborder;
12081210
//====================================================================
12091211

12101212
float R_NoiseGet4f( float x, float y, float z, float t );

src/win32/win_glimp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ static qboolean GLW_InitDriver( const char *drivername, int colorbits ) {
524524
static qboolean GLW_CreateWindow( const char *drivername, int width, int height, int colorbits, qboolean cdsFullscreen ) {
525525
RECT r;
526526
cvar_t *vid_xpos, *vid_ypos;
527-
int stylebits;
527+
unsigned long stylebits = WS_VISIBLE | WS_CLIPCHILDREN;
528528
int x, y, w, h;
529529
int exstyle;
530530

@@ -572,7 +572,13 @@ static qboolean GLW_CreateWindow( const char *drivername, int width, int height,
572572
} else
573573
{
574574
exstyle = 0;
575-
stylebits = WINDOW_STYLE | WS_SYSMENU;
575+
g_wv.noborder = r_noborder->integer;
576+
if (g_wv.noborder){
577+
stylebits |= WS_POPUP;
578+
}else{
579+
stylebits |= (WS_BORDER | WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX);
580+
}
581+
stylebits |= WS_VISIBLE | WS_SYSMENU;
576582
AdjustWindowRect( &r, stylebits, FALSE );
577583
}
578584

src/win32/win_local.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ typedef struct
120120

121121
qbool inputInitialized;
122122
qbool duringCreateWindow; // qtrue during the call to CreateWindow
123-
123+
qbool noborder;
124124
} WinVars_t;
125125

126126
extern WinVars_t g_wv;

src/win32/win_vkimp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,13 @@ static qbool VKW_CreateWindow()
126126
}
127127
else
128128
{
129-
style |= WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
129+
g_wv.noborder = r_noborder->integer;
130+
if (g_wv.noborder){
131+
style |= WS_POPUP;
132+
}else{
133+
style |= WS_BORDER | WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX;
134+
}
135+
style |= WS_VISIBLE | WS_SYSMENU;
130136
AdjustWindowRect( &r, style, FALSE );
131137
}
132138

src/win32/win_wndproc.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,43 @@ LRESULT CALLBACK MainWndProc(
374374
}
375375
break;
376376

377+
case WM_WINDOWPOSCHANGING:
378+
if (g_wv.noborder)
379+
{
380+
WINDOWPOS* pos = (LPWINDOWPOS)lParam;
381+
const int threshold = 10;
382+
HMONITOR hMonitor;
383+
MONITORINFO mi;
384+
const RECT* r;
385+
RECT rr;
386+
387+
rr.left = pos->x;
388+
rr.right = pos->x + pos->cx;
389+
rr.top = pos->y;
390+
rr.bottom = pos->y + pos->cy;
391+
hMonitor = MonitorFromRect(&rr, MONITOR_DEFAULTTOPRIMARY);
392+
393+
if (hMonitor)
394+
{
395+
mi.cbSize = sizeof(mi);
396+
GetMonitorInfo(hMonitor, &mi);
397+
r = &mi.rcWork;
398+
399+
if (pos->x >= (r->left - threshold) && pos->x <= (r->left + threshold))
400+
pos->x = r->left;
401+
else if ((pos->x + pos->cx) >= (r->right - threshold) && (pos->x + pos->cx) <= (r->right + threshold))
402+
pos->x = (r->right - pos->cx);
403+
404+
if (pos->y >= (r->top - threshold) && pos->y <= (r->top + threshold))
405+
pos->y = r->top;
406+
else if ((pos->y + pos->cy) >= (r->bottom - threshold) && (pos->y + pos->cy) <= (r->bottom + threshold))
407+
pos->y = (r->bottom - pos->cy);
408+
409+
return 0;
410+
}
411+
}
412+
break;
413+
377414
case WM_MOVE:
378415
{
379416
int xPos, yPos;
@@ -468,6 +505,13 @@ LRESULT CALLBACK MainWndProc(
468505
case WM_CHAR:
469506
Sys_QueEvent( g_wv.sysMsgTime, SE_CHAR, wParam, 0, 0, NULL );
470507
break;
508+
509+
case WM_NCHITTEST:
510+
if (g_wv.noborder && GetKeyState(VK_CONTROL) & (1 << 15))
511+
{
512+
return HTCAPTION;
513+
}
514+
break;
471515
}
472516

473517
return DefWindowProc( hWnd, uMsg, wParam, lParam );

0 commit comments

Comments
 (0)