Implementation of the Windows (GDI) video driver. More...
#include "../stdafx.h"
#include "../openttd.h"
#include "../gfx_func.h"
#include "../os/windows/win32.h"
#include "../rev.h"
#include "../blitter/factory.hpp"
#include "../network/network.h"
#include "../core/math_func.hpp"
#include "../core/random_func.hpp"
#include "../texteff.hpp"
#include "../thread/thread.h"
#include "../progress.h"
#include "../window_gui.h"
#include "../window_func.h"
#include "win32_v.h"
#include <windows.h>
#include <imm.h>
Go to the source code of this file.
Data Structures | |
struct | VkMapping |
Defines | |
#define | MAPVK_VK_TO_CHAR (2) |
#define | AS(x, z) {x, 0, z} |
#define | AM(x, y, z, w) {x, y - x, z} |
#define | WM_MOUSELEAVE 0x02A3 |
#define | TID_POLLMOUSE 1 |
#define | MOUSE_POLL_DELAY 75 |
#define | WM_MOUSEWHEEL 0x020A |
#define | GET_WHEEL_DELTA_WPARAM(wparam) ((short)HIWORD(wparam)) |
Functions | |
static void | MakePalette () |
static void | UpdatePalette (HDC dc, uint start, uint count) |
static uint | MapWindowsKey (uint sym) |
static bool | AllocateDibSection (int w, int h, bool force=false) |
static void | ClientSizeChanged (int w, int h) |
static void CALLBACK | TrackMouseTimerProc (HWND hwnd, UINT msg, UINT event, DWORD time) |
static void | PaintWindow (HDC dc) |
Do palette animation and blit to the window. | |
static void | PaintWindowThread (void *) |
static LRESULT | HandleCharMsg (uint keycode, WChar charcode) |
Forward key presses to the window system. | |
static bool | DrawIMECompositionString () |
Should we draw the composition string ourself, i.e is this a normal IME? | |
static void | SetCompositionPos (HWND hwnd) |
Set position of the composition window to the caret position. | |
static void | SetCandidatePos (HWND hwnd) |
Set the position of the candidate window. | |
static LRESULT | HandleIMEComposition (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Handle WM_IME_COMPOSITION messages. | |
static void | CancelIMEComposition (HWND hwnd) |
Clear the current composition string. | |
static LRESULT CALLBACK | WndProcGdi (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
static void | RegisterWndClass () |
static void | FindResolutions () |
static void | CheckPaletteAnim () |
Variables | |
struct { | |
HWND main_wnd | |
HBITMAP dib_sect | |
void * buffer_bits | |
HPALETTE gdi_palette | |
RECT update_rect | |
int width | |
int height | |
int width_org | |
int height_org | |
bool fullscreen | |
bool has_focus | |
bool running | |
} | _wnd |
bool | _force_full_redraw |
bool | _window_maximize |
uint | _display_hz |
uint | _fullscreen_bpp |
static Dimension | _bck_resolution |
DWORD | _imm_props |
static bool | _draw_threaded |
Whether the drawing is/may be done in a separate thread. | |
static ThreadObject * | _draw_thread = NULL |
Thread used to 'draw' to the screen, i.e. | |
static ThreadMutex * | _draw_mutex = NULL |
Mutex to keep the access to the shared memory controlled. | |
static volatile bool | _draw_continue |
Should we keep continue drawing? | |
static Palette | _local_palette |
Local copy of the palette for use in the drawing thread. | |
static const VkMapping | _vk_mapping [] |
static const Dimension | default_resolutions [] |
static FVideoDriver_Win32 | iFVideoDriver_Win32 |
Implementation of the Windows (GDI) video driver.
Definition in file win32_v.cpp.
static void CancelIMEComposition | ( | HWND | hwnd | ) | [static] |
Clear the current composition string.
Definition at line 634 of file win32_v.cpp.
References HandleTextInput().
Referenced by VideoDriver_Win32::EditBoxLostFocus().
static LRESULT HandleCharMsg | ( | uint | keycode, | |
WChar | charcode | |||
) | [static] |
Forward key presses to the window system.
Definition at line 444 of file win32_v.cpp.
References DEBUG, HandleKeypress(), Utf16DecodeSurrogate(), Utf16IsLeadSurrogate(), and Utf16IsTrailSurrogate().
static LRESULT HandleIMEComposition | ( | HWND | hwnd, | |
WPARAM | wParam, | |||
LPARAM | lParam | |||
) | [static] |
Handle WM_IME_COMPOSITION messages.
Definition at line 570 of file win32_v.cpp.
References convert_from_fs(), DrawIMECompositionString(), FS2OTTD(), HandleTextInput(), lengthof, SetCompositionPos(), and Utf16IsLeadSurrogate().
static void PaintWindow | ( | HDC | dc | ) | [static] |
Do palette animation and blit to the window.
Definition at line 370 of file win32_v.cpp.
References _cur_palette, Palette::count_dirty, Palette::first_dirty, BlitterFactoryBase::GetCurrentBlitter(), Blitter::PALETTE_ANIMATION_BLITTER, Blitter::PALETTE_ANIMATION_NONE, Blitter::PALETTE_ANIMATION_VIDEO_BACKEND, Blitter::PaletteAnimate(), and Blitter::UsePaletteAnimation().
static void SetCandidatePos | ( | HWND | hwnd | ) | [static] |
Set the position of the candidate window.
Definition at line 536 of file win32_v.cpp.
References NWidgetBase::current_x, NWidgetBase::current_y, EditBoxInGlobalFocus(), Window::GetCaretPosition(), Window::height, Window::left, Window::nested_focus, NWidgetBase::pos_x, NWidgetBase::pos_y, Window::top, WC_CONSOLE, Window::width, and Window::window_class.
Referenced by VideoDriver_Win32::EditBoxLostFocus().
static void SetCompositionPos | ( | HWND | hwnd | ) | [static] |
Set position of the composition window to the caret position.
Definition at line 514 of file win32_v.cpp.
References EditBoxInGlobalFocus(), Window::GetCaretPosition(), Window::left, and Window::top.
Referenced by VideoDriver_Win32::EditBoxLostFocus(), and HandleIMEComposition().
ThreadMutex* _draw_mutex = NULL [static] |
Mutex to keep the access to the shared memory controlled.
Definition at line 64 of file win32_v.cpp.
ThreadObject* _draw_thread = NULL [static] |
Thread used to 'draw' to the screen, i.e.
push data to the screen.
Definition at line 62 of file win32_v.cpp.
bool _draw_threaded [static] |
Whether the drawing is/may be done in a separate thread.
Definition at line 60 of file win32_v.cpp.
Referenced by VideoDriver_Win32::MainLoop(), and VideoDriver_Win32::Start().
Palette _local_palette [static] |
Local copy of the palette for use in the drawing thread.
Definition at line 68 of file win32_v.cpp.
const Dimension default_resolutions[] [static] |
{ { 640, 480 }, { 800, 600 }, { 1024, 768 }, { 1152, 864 }, { 1280, 800 }, { 1280, 960 }, { 1280, 1024 }, { 1400, 1050 }, { 1600, 1200 }, { 1680, 1050 }, { 1920, 1200 } }
Definition at line 1096 of file win32_v.cpp.