aboutsummaryrefslogtreecommitdiffstats
path: root/android/utils
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-06-04 16:07:01 +0200
committerDavid 'Digit' Turner <digit@google.com>2009-06-08 17:43:17 +0200
commit46be48730333120a7b939116cef075e61c12c703 (patch)
tree92bde033dd93fc14e0e2565a52293b59787b8859 /android/utils
parentb72269abe4a75736c09b0ee8797b736f49c058c8 (diff)
downloadexternal_qemu-46be48730333120a7b939116cef075e61c12c703.zip
external_qemu-46be48730333120a7b939116cef075e61c12c703.tar.gz
external_qemu-46be48730333120a7b939116cef075e61c12c703.tar.bz2
Add our modified SDL sources under distrib/sdl-1.2.12
Fix distrib/make-distrib.sh script to work with git Fix distrib/build-emulator.sh to accomodate for new SDL configure script Handle Tiger SDK usage in SDL configure script
Diffstat (limited to 'android/utils')
-rw-r--r--android/utils/display-quartz.m111
-rw-r--r--android/utils/display.c245
-rw-r--r--android/utils/display.h31
3 files changed, 0 insertions, 387 deletions
diff --git a/android/utils/display-quartz.m b/android/utils/display-quartz.m
deleted file mode 100644
index 594657e..0000000
--- a/android/utils/display-quartz.m
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright (C) 2007-2008 The Android Open Source Project
-**
-** This software is licensed under the terms of the GNU General Public
-** License version 2, as published by the Free Software Foundation, and
-** may be copied, distributed, and modified under those terms.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-*/
-
-/* this is the Quartz-specific implementation of
- * <android/utils/display.h>
- */
-
-#include "android/utils/display.h"
-#include "android/utils/debug.h"
-
-#define D(...) VERBOSE_PRINT(init,__VA_ARGS__)
-
-#include <stdio.h>
-#include <Cocoa/Cocoa.h>
-#include <Carbon/Carbon.h>
-#include <SDL_syswm.h>
-
-int
-get_monitor_resolution( int *px_dpi, int *py_dpi )
-{
- fprintf(stderr, "emulator: FIXME: implement get_monitor_resolution on OS X\n" );
- return -1;
-}
-
-int
-get_nearest_monitor_rect( int *x, int *y, int *width, int *height )
-{
- SDL_SysWMinfo info;
- NSWindow* window;
-
- SDL_VERSION(&info.version);
- if ( SDL_GetWMInfo(&info) < 0 ) {
- D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError());
- return -1;
- }
- window = info.nsWindowPtr;
- if (window == NULL) {
- D( "%s: SDL_GetWMInfo() returned NULL NSWindow ptr",
- __FUNCTION__ );
- return -1;
- }
- else
- {
- NSRect frame = [ window frame ];
- int fx1 = frame.origin.x;
- int fy1 = frame.origin.y;
- int fx2 = frame.size.width + fx1;
- int fy2 = frame.size.height + fy1;
- NSArray* screens = [ NSScreen screens ];
- unsigned int count = [ screens count ];
- int bestScreen = -1;
- int bestArea = 0;
-
- unsigned int n;
- printf( "window frame (%d,%d) (%d,%d)\n", fx1, fy1, fx2, fy2 );
-
- /* we need to compute which screen has the most window pixels */
- for (n = 0; n < count; n++) {
- NSScreen* screen = [ screens objectAtIndex: n ];
- NSRect vis = [ screen visibleFrame ];
- int vx1 = vis.origin.x;
- int vy1 = vis.origin.y;
- int vx2 = vis.size.width + vx1;
- int vy2 = vis.size.height + vy1;
- int cx1, cx2, cy1, cy2, cArea;
-
- //printf( "screen %d/%d frame (%d,%d) (%d,%d)\n", n+1, count,
- // vx1, vy1, vx2, vy2 );
-
- if (fx1 >= vx2 || vx1 >= fx2 || fy1 >= vy2 || vy1 >= fy2)
- continue;
-
- cx1 = (fx1 < vx1) ? vx1 : fx1;
- cx2 = (fx2 > vx2) ? vx2 : fx2;
- cy1 = (fy1 < vy1) ? vy1 : fy1;
- cy2 = (fy2 > vy2) ? vy2 : fy2;
-
- if (cx1 >= cx2 || cy1 >= cy2)
- continue;
-
- cArea = (cx2-cx1)*(cy2-cy1);
-
- if (bestScreen < 0 || cArea > bestArea) {
- bestScreen = n;
- bestArea = cArea;
- }
- }
- if (bestScreen < 0)
- bestScreen = 0;
-
- {
- NSScreen* screen = [ screens objectAtIndex: bestScreen ];
- NSRect vis = [ screen visibleFrame ];
-
- *x = vis.origin.x;
- *y = vis.origin.y;
- *width = vis.size.width;
- *height = vis.size.height;
- }
- return 0;
- }
-};
diff --git a/android/utils/display.c b/android/utils/display.c
deleted file mode 100644
index e1ba507..0000000
--- a/android/utils/display.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* Copyright (C) 2007-2008 The Android Open Source Project
-**
-** This software is licensed under the terms of the GNU General Public
-** License version 2, as published by the Free Software Foundation, and
-** may be copied, distributed, and modified under those terms.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-*/
-
-#include "android/utils/display.h"
-#include "android/utils/debug.h"
-
-#define D(...) VERBOSE_PRINT(init,__VA_ARGS__)
-
-/** HOST RESOLUTION SETTINGS
- **
- ** return the main monitor's DPI resolution according to the host device
- ** beware: this is not always reliable or even obtainable.
- **
- ** returns 0 on success, or -1 in case of error (e.g. the system returns funky values)
- **/
-
-/** NOTE: the following code assumes that we exclusively use X11 on Linux, and Quartz on OS X
- **/
-
-#ifdef _WIN32
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <SDL_syswm.h>
-
-int
-get_monitor_resolution( int *px_dpi, int *py_dpi )
-{
- HDC displayDC = CreateDC( "DISPLAY", NULL, NULL, NULL );
- int xdpi, ydpi;
-
- if (displayDC == NULL) {
- D( "%s: could not get display DC\n", __FUNCTION__ );
- return -1;
- }
- xdpi = GetDeviceCaps( displayDC, LOGPIXELSX );
- ydpi = GetDeviceCaps( displayDC, LOGPIXELSY );
-
- /* sanity checks */
- if (xdpi < 20 || xdpi > 400 || ydpi < 20 || ydpi > 400) {
- D( "%s: bad resolution: xpi=%d ydpi=%d", __FUNCTION__,
- xdpi, ydpi );
- return -1;
- }
-
- *px_dpi = xdpi;
- *py_dpi = ydpi;
- return 0;
-}
-
-int
-get_nearest_monitor_rect( int *x, int *y, int *width, int *height )
-{
- SDL_SysWMinfo info;
- HMONITOR monitor;
- MONITORINFO monitorInfo;
-
- SDL_VERSION(&info.version);
-
- if ( !SDL_GetWMInfo(&info) ) {
- D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError());
- return -1;
- }
-
- monitor = MonitorFromWindow( info.window, MONITOR_DEFAULTTONEAREST );
- monitorInfo.cbSize = sizeof(monitorInfo);
- GetMonitorInfo( monitor, &monitorInfo );
-
- *x = monitorInfo.rcMonitor.left;
- *y = monitorInfo.rcMonitor.top;
- *width = monitorInfo.rcMonitor.right - *x;
- *height = monitorInfo.rcMonitor.bottom - *y;
-
- D("%s: found (x,y,w,h)=(%d,%d,%d,%d)", __FUNCTION__,
- *x, *y, *width, *height);
-
- return 0;
-}
-
-
-#elif defined __APPLE__
-
-/* the real implementation is in display-quartz.m, but
- * unfortunately, the Android build system doesn't know
- * how to build Objective-C sources, so provide stubs
- * here instead.
- *
- * CONFIG_NO_COCOA is set by Makefile.android
- */
-
-#ifdef CONFIG_NO_COCOA
-int
-get_monitor_resolution( int *px_dpi, int *py_dpi )
-{
- return -1;
-}
-
-int
-get_nearest_monitor_rect( int *x, int *y, int *width, int *height )
-{
- return -1;
-}
-#endif /* CONFIG_NO_COCOA */
-
-#else /* Linux and others */
-#include <SDL.h>
-#include <SDL_syswm.h>
-#include <dlfcn.h>
-#include <X11/Xlib.h>
-#define MM_PER_INCH 25.4
-
-#define DYNLINK_FUNCTIONS \
- DYNLINK_FUNC(int,XDefaultScreen,(Display*)) \
- DYNLINK_FUNC(int,XDisplayWidth,(Display*,int)) \
- DYNLINK_FUNC(int,XDisplayWidthMM,(Display*,int)) \
- DYNLINK_FUNC(int,XDisplayHeight,(Display*,int)) \
- DYNLINK_FUNC(int,XDisplayHeightMM,(Display*,int)) \
-
-#define DYNLINK_FUNCTIONS_INIT \
- x11_dynlink_init
-
-#include "dynlink.h"
-
-static int x11_lib_inited;
-static void* x11_lib;
-
-int
-x11_lib_init( void )
-{
- if (!x11_lib_inited) {
- x11_lib_inited = 1;
-
- x11_lib = dlopen( "libX11.so", RTLD_NOW );
-
- if (x11_lib == NULL) {
- x11_lib = dlopen( "libX11.so.6", RTLD_NOW );
- }
- if (x11_lib == NULL) {
- D("%s: Could not find libX11.so on this machine",
- __FUNCTION__);
- return -1;
- }
-
- if (x11_dynlink_init(x11_lib) < 0) {
- D("%s: didn't find necessary symbols in libX11.so",
- __FUNCTION__);
- dlclose(x11_lib);
- x11_lib = NULL;
- }
- }
- return x11_lib ? 0 : -1;
-}
-
-
-int
-get_monitor_resolution( int *px_dpi, int *py_dpi )
-{
- SDL_SysWMinfo info;
- Display* display;
- int screen;
- int width, width_mm, height, height_mm, xdpi, ydpi;
-
- SDL_VERSION(&info.version);
-
- if ( !SDL_GetWMInfo(&info) ) {
- D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError());
- return -1;
- }
-
- if (x11_lib_init() < 0)
- return -1;
-
- display = info.info.x11.display;
- screen = FF(XDefaultScreen)(display);
-
- width = FF(XDisplayWidth)(display, screen);
- width_mm = FF(XDisplayWidthMM)(display, screen);
- height = FF(XDisplayHeight)(display, screen);
- height_mm = FF(XDisplayHeightMM)(display, screen);
-
- if (width_mm <= 0 || height_mm <= 0) {
- D( "%s: bad screen dimensions: width_mm = %d, height_mm = %d",
- __FUNCTION__, width_mm, height_mm);
- return -1;
- }
-
- D( "%s: found screen width=%d height=%d width_mm=%d height_mm=%d",
- __FUNCTION__, width, height, width_mm, height_mm );
-
- xdpi = width * MM_PER_INCH / width_mm;
- ydpi = height * MM_PER_INCH / height_mm;
-
- if (xdpi < 20 || xdpi > 400 || ydpi < 20 || ydpi > 400) {
- D( "%s: bad resolution: xpi=%d ydpi=%d", __FUNCTION__,
- xdpi, ydpi );
- return -1;
- }
-
- *px_dpi = xdpi;
- *py_dpi = ydpi;
-
- return 0;
-}
-
-int
-get_nearest_monitor_rect( int *x, int *y, int *width, int *height )
-{
- SDL_SysWMinfo info;
- Display* display;
- int screen;
-
- SDL_VERSION(&info.version);
-
- if ( !SDL_GetWMInfo(&info) ) {
- D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError());
- return -1;
- }
-
- if (x11_lib_init() < 0)
- return -1;
-
- display = info.info.x11.display;
- screen = FF(XDefaultScreen)(display);
-
- *x = 0;
- *y = 0;
- *width = FF(XDisplayWidth)(display, screen);
- *height = FF(XDisplayHeight)(display, screen);
-
- D("%s: found (x,y,w,h)=(%d,%d,%d,%d)", __FUNCTION__,
- *x, *y, *width, *height);
-
- return 0;
-}
-
-#endif
diff --git a/android/utils/display.h b/android/utils/display.h
deleted file mode 100644
index 7254aca..0000000
--- a/android/utils/display.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2007-2008 The Android Open Source Project
-**
-** This software is licensed under the terms of the GNU General Public
-** License version 2, as published by the Free Software Foundation, and
-** may be copied, distributed, and modified under those terms.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-*/
-
-#ifndef _ANDROID_UTILS_DISPLAY_H
-#define _ANDROID_UTILS_DISPLAY_H
-
-/** HOST RESOLUTION SETTINGS
- **
- ** return the main monitor's DPI resolution according to the host device
- ** beware: this is not always reliable or even obtainable.
- **
- ** returns 0 on success, or -1 in case of error (e.g. the system returns funky values)
- **/
-extern int get_monitor_resolution( int *px_dpi, int *py_dpi );
-
-/** return the size in pixels of the nearest monitor for the current window.
- ** this is used to implement full-screen presentation mode.
- **/
-
-extern int get_nearest_monitor_rect( int *x, int *y, int *width, int *height );
-
-#endif /* _ANDROID_UTILS_DISPLAY_H */