mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
Created a Unix sysdep/ folder, and implemented a unix debug_break function
This was SVN commit r735.
This commit is contained in:
parent
dccdd0c747
commit
aa9c6e7d30
5 changed files with 40 additions and 4 deletions
|
|
@ -49,6 +49,8 @@ void debug_break()
|
|||
win_debug_break();
|
||||
# elif defined(_M_IX86)
|
||||
ia32_debug_break();
|
||||
# elif defined(OS_UNIX)
|
||||
unix_debug_break();
|
||||
# else
|
||||
# error "port"
|
||||
# endif
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
#ifndef SYSDEP_H__
|
||||
#define SYSDEP_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "win/win.h"
|
||||
#include "win/wdbg.h"
|
||||
#elif defined(OS_UNIX)
|
||||
#include "unix/unix.h"
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
12
source/lib/sysdep/unix/unix.cpp
Executable file
12
source/lib/sysdep/unix/unix.cpp
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#include "precompiled.h"
|
||||
|
||||
#include "sysdep/sysdep.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void unix_debug_break()
|
||||
{
|
||||
kill(getpid(), SIGTRAP);
|
||||
}
|
||||
10
source/lib/sysdep/unix/unix.h
Executable file
10
source/lib/sysdep/unix/unix.h
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef _sysdep_unix_H
|
||||
#define _sysdep_unix_H
|
||||
|
||||
/*
|
||||
This implementation raises the SIGTRAP signal which should be caught by your
|
||||
debugger
|
||||
*/
|
||||
extern void unix_debug_break();
|
||||
|
||||
#endif
|
||||
|
|
@ -36,7 +36,7 @@ int get_cur_vmode(int* xres, int* yres, int* bpp, int* freq)
|
|||
if(yres)
|
||||
*yres = XDisplayHeight(disp, screen);
|
||||
if(bpp)
|
||||
*bpp = 0;
|
||||
*bpp = XDefaultDepth(disp, screen);
|
||||
if(freq)
|
||||
*freq = 0;
|
||||
XCloseDisplay(disp);
|
||||
|
|
@ -48,7 +48,17 @@ int get_cur_vmode(int* xres, int* yres, int* bpp, int* freq)
|
|||
// if we fail, outputs are unchanged (assumed initialized to defaults)
|
||||
int get_monitor_size(int& width_mm, int& height_mm)
|
||||
{
|
||||
return -1;
|
||||
Display* disp = XOpenDisplay(0);
|
||||
if(!disp)
|
||||
return -1;
|
||||
|
||||
int screen = XDefaultScreen(disp);
|
||||
|
||||
width_mm=XDisplayWidthMM(disp, screen);
|
||||
height_mm=XDisplayHeightMM(disp, screen);
|
||||
|
||||
XCloseDisplay(disp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in a new issue