Commit Graph

867 Commits (jgrpp)

Author SHA1 Message Date
Jonathan G Rennison f94eb286f2 Fix missing MinGW thread includes 3 years ago
Jonathan G Rennison 2a13c8623c Revert: 4c59dfb6, move DoPaletteAnimations back into GameLoop
Race fix to follow
3 years ago
Jonathan G Rennison 2e6dbfee05 Merge branch 'master' into jgrpp 3 years ago
Jonathan G Rennison 5e14b54a0c Merge branch 'master' into jgrpp 3 years ago
Jonathan G Rennison 297b340697 Revert "OpenGL: Temporarily reduce OpenGL driver priorities"
This reverts commit f81c71e15b.
3 years ago
Michael Lutz 1cd3a3b070
Fix #8935: [OSX] Crash when clicking 'Save' due to wrongly-threaded OS call. (#8944) 3 years ago
Milek7 7a886cb4d4 Change: Do not disallow persistent buffer mapping on AMD GPUs, as it is actually faster. 3 years ago
Michael Lutz df958dc907 Fix f0f96e31: [OpenGL] Broken window resizing due to invalid buffer pitch on texture creation. 3 years ago
frosch 0230624359
Fix f0f96e31: [OpenGL] warning: comparison of integer expressions of different signedness. (#8881) 3 years ago
Michael Lutz f0f96e3103
Fix #8871: [OpenGL] Initialize all buffers after resize and clear back buffer. (#8877) 3 years ago
Patric Stout 970fedd78c Add: make modal windows update more smooth
Basically, modal windows had their own thread-locking for what
drawing was possible. This is a bit nonsense now we have a
game-thread. And it makes much more sense to do things like
NewGRFScan and GenerateWorld in the game-thread, and not in a
thread next to the game-thread.

This commit changes that: it removes the threads for NewGRFScan
and GenerateWorld, and just runs the code in the game-thread.
On regular intervals it allows the draw-thread to do a tick,
which gives a much smoother look and feel.

It does slow down NewGRFScan and GenerateWorld ever so slightly
as it spends more time on drawing. But the slowdown is not
measureable on my machines (with 700+ NewGRFs / 4kx4k map and
a Debug build).

Running without a game-thread means NewGRFScan and GenerateWorld
are now blocking.
3 years ago
sean 0464a50ab8
Add: Display refresh rate game option (#8813) 3 years ago
Michael Lutz 436cdf1fc8 Fix #8825: [OpenGL] Don't clear cursor cache from the game loop thread. 3 years ago
Patric Stout 8946b41d20 Fix: ensure switching blitter happens in the main thread
This because video-drivers might need to make changes to their
context, which for most video-drivers has to be done in the same
thread as the window was created; main thread in our case.
3 years ago
Patric Stout e56d2c63c3 Add: [Video] move GameLoop into its own thread
This allows drawing to happen while the GameLoop is doing an
iteration too.

Sadly, not much drawing currently can be done while the GameLoop
is running, as for example PollEvent() or UpdateWindows() can
influence the game-state. As such, they first need to acquire a
lock on the game-state before they can be called.

Currently, the main advantage is the time spend in Paint(), which
for non-OpenGL drivers can be a few milliseconds. For OpenGL this
is more like 0.05 milliseconds; in these instances this change
doesn't add any benefits for now.

This is an alternative to the former "draw-thread", which moved
the drawing in a thread for some OSes. It has similar performance
gain as this does, although this implementation allows for more
finer control over what suffers when the GameLoop takes too
long: drawing or the next GameLoop. For now they both suffer
equally.
3 years ago
Michael Lutz 3a4a15cc93 Codechange: don't set the window position when changing blitter
There really is no need to make an extra call to the OS in
these cases.
3 years ago
Patric Stout b9eac7c6dc Codechange: remove the unused lock around Blitter 3 years ago
Patric Stout 4610aa7ae3 Remove: [Video] no longer draw in a thread
Drawing in a thread is a bit odd, and often leads to surprising
issues. For example, OpenGL would only allow it if you move the
full context to the thread. Which is not always easily done on
all OSes.
In general, the advise is to handle system events and drawing
from the main thread, and do everything else in other threads.
So, let's be more like other games.

Additionally, putting the drawing routine in a thread was only
done for a few targets.

Upcoming commit will move the GameLoop in a thread, which will
work for all targets.
3 years ago
Patric Stout 04db99749b
Fix #8784: using alt+enter didn't update the fullscreen toggle visibly (#8820)
Basically, the window was not invalidated, so it was never redrawn.
This made it look like it wasn't working, but it really was.
3 years ago
Michael Lutz 25656a10cb Fix #8808: [OSX, OpenGL] Crash on switching blitters due to double-mapping the video buffer. 3 years ago
Patric Stout b93d7dd3cb
Add: Option to (dis-)allow accelerated video drivers. (#8819)
The video drivers using the OpenGL backend are currently our only
accelerated drivers. The options defaults to off for macOS builds and
to on everywhere else.

Co-authored-by: Michael Lutz <michi@icosahedron.de>
3 years ago
Lastorder f3b850623c
Fix #220 build fail due to missing var
Removed from merge commit dfecdf3afb
3 years ago
Jonathan G Rennison f81c71e15b OpenGL: Temporarily reduce OpenGL driver priorities 3 years ago
Jonathan G Rennison 84a7ab180e Merge branch 'master' into jgrpp
# Conflicts:
#	src/company_cmd.cpp
#	src/lang/greek.txt
#	src/table/settings.ini
3 years ago
Jonathan G Rennison f4e29071be Merge tag '1.11.0-beta2' into jgrpp
# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/release.yml
#	CMakeLists.txt
#	src/blitter/32bpp_optimized.cpp
#	src/debug.cpp
#	src/gfx.cpp
#	src/gfx_func.h
#	src/lang/czech.txt
#	src/lang/english.txt
#	src/lang/italian.txt
#	src/lang/swedish.txt
#	src/lang/ukrainian.txt
#	src/network/network_server.cpp
#	src/os/windows/crashlog_win.cpp
#	src/os/windows/win32.cpp
#	src/pathfinder/follow_track.hpp
#	src/screenshot.cpp
#	src/settings_type.h
#	src/spritecache.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/video_driver.cpp
#	src/video/video_driver.hpp
#	src/video/win32_v.cpp
3 years ago
Michael Lutz c656633bea Fix #8775: [Win32] Don't create the main window when alt-tabbing back into fullscreen. 3 years ago
Michael Lutz b7a44983b4 Fix: [Win32] Original window size was lost when tabbing in and out of fullscreen. 3 years ago
Patric Stout abac4b1758
Fix c4df0f95: bootstrap was only showing a black screen (#8788)
The bootstrap has the _switch_mode to SM_MENU, and never leaves
this mode. Neither is it considered a modal window (while in some
sense it really is). So .. we need to add another "draw anyway"
exception, to make sure bootstrap is being drawn.
3 years ago
Owen Rudge 838fd61f29 Fix: [OSX] Hide dock when entering fullscreen 3 years ago
Patric Stout f183ded9fe Add: settings to limit your fast-forward game speed
By default this setting is set to 2500% normal game speed.

(cherry picked from commit c3dc27e37e)

# Conflicts:
#	src/gfx.cpp
#	src/gfx_func.h
#	src/settings_type.h
#	src/video/cocoa/cocoa_v.mm
#	src/video/video_driver.cpp
#	src/video/win32_v.cpp
3 years ago
Patric Stout 535fdb5c89 Codechange: remove _realtime_tick variable
(cherry picked from commit fe451b8dc7)

# Conflicts:
#	src/debug.cpp
#	src/debug.h
#	src/video/video_driver.cpp
3 years ago
Patric Stout c3dc27e37e Add: settings to limit your fast-forward game speed
By default this setting is set to 2500% normal game speed.
3 years ago
Michael Lutz d79398a1d5 Fix #8763: [OpenGL] Cursor sprite origin can be negative. 3 years ago
Jonathan G Rennison d58989f552 Merge branch 'master' into jgrpp
# Conflicts:
#	src/lang/english_US.txt
3 years ago
Michael Lutz 77854d561b Fix: [OpenGL] Don't use OpenGL on MESA software renderers.
Performance in this case is worse than not using OpenGL, so just let
OTTD fall back to a different video driver.
3 years ago
Patric Stout 1b5d1d074e
Fix: [SDL2] set GL attributes to get the best GL context possible (#8759) 3 years ago
frosch dfa141818b Fix: OpenGL cursor did not consider sprite offsets of cursor sprites. 3 years ago
Patric Stout fe451b8dc7 Codechange: remove _realtime_tick variable 3 years ago
Michael Lutz 311df31fb1 Codechange: [OpenGL] Load all OpenGL functions dynamically. 3 years ago
Michael Lutz a0c1a3f736 Codechange: [OpenGL] Simplify loading OpenGL extension functions. 3 years ago
Michael Lutz e1e8cc3851
Fix #8734: [OpenGL] Apply palette remap to cursor sprites. (#8742) 3 years ago
Patric Stout 6a8c461e38 Codechange: [OSX] GameLoop is really more like MainLoop
MainLoop() is used to bootstrap OSX, where later a callback is
done to GameLoop() to execute OpenTTD. All other video drivers
don't need that, so what is in GameLoop is in MainLoop for all
other drivers. This is rather confusing. So, instead, name
GameLoop MainLoopReal to be more in sync with the other drivers.
3 years ago
Patric Stout 67d3c6aa71 Codechange: [Video] move InteractiveRandom() to the VideoDriver 3 years ago
Patric Stout c409f45ddd Codechange: [Video] make the prototype of PollEvent() the same for all drivers
Additionally, call it from the draw-tick.
3 years ago
Niels Martin Hansen b427ddce88 Codechange: Switch to explicit wide strings 3 years ago
Niels Martin Hansen beeb9e0a1b Remove: [Win32] Last pretenses of being able to build for Windows 95 3 years ago
Michael Lutz 06ca147a82 Fix 8706c36f: Change RELEASE code, too. 3 years ago
Michael Lutz af4d32357c Codechange: [Win32] Move common initialization and finalization to the video driver base class. 3 years ago
Michael Lutz 7af1fd3ffb Add: [OSX] OpenGL video driver. 3 years ago
Michael Lutz 78b8fc3e4f Codechange: [Win32] Move GDI-specific variables and related functions into the GDI video driver class. 3 years ago
Michael Lutz b4a3bc1ffe Codechange: [OpenGL] Separate context state setup from general init. 3 years ago
Michael Lutz 8b90d4abe0 Codechange: [Win32] Move GDI specific drawing code into the GDI video driver class. 3 years ago
Michael Lutz 7f55f0a264 Codechange: [OSX] Add support for (un)locking the video buffer. 3 years ago
Michael Lutz 59e0d9618b Codechange: [Win32] Split the video driver into a base class and a GDI backend class. 3 years ago
Michael Lutz 2f25e9bdf8 Codechange: [OSX] Separate video driver into a base and a Quartz implementation. 3 years ago
Michael Lutz 421b599541 Codechange: [SDL2] Split driver in base-part and default backend 3 years ago
Patric Stout a303940372 Feature: [SDL2] OpenGL support 3 years ago
Michael Lutz a77b202767 Codechange: [SDL] Move dirty_rect to class scope. 3 years ago
Patric Stout e75858ce5e Codechange: [SDL2] Allow several places to hook into the SDL driver
This allows future subdrivers to use these to manage their
own flow.
3 years ago
Patric Stout 101e394475 Codechange: [SDL2] Move functions and variables to class-scope
This allows future subdrivers to override them.
3 years ago
Patric Stout 0d58bc9384 Codechange: [SDL2] Move SDLSurface code to its own function
This increases readability, and allow future subdrivers to not
use SDLSurface to draw.
3 years ago
Patric Stout 6098811b49 Codechange: [SDL2] Split Start() in a few more functions
This makes it a bit easier to follow what is going on, and
allow future subdrivers to hook into a few of these functions.

Reworked the code slighly while at it, to return early where
possible.
3 years ago
Michael Lutz 86c309ea75 Codechange: [OpenGL] Let OpenGL clear the pixel buffer if possible. 3 years ago
Michael Lutz ae7c63cc35 Codechange: [OpenGL] Use persistently mapped pixel buffers when supported. 3 years ago
Michael Lutz 200be7d20c Add: [OpenGL] Support for a separate animation buffer that stores the palette values of the screen in addition to the colour buffer. 3 years ago
Michael Lutz d62e302768 Change: [Win32] Prioritize the OpenGL video driver over the GDI one. 3 years ago
Michael Lutz 6bcc4884c2 Add: [OpenGL] Accelerated mouse cursor drawing. 3 years ago
Michael Lutz bcd15b4dd2 Codechange: [OpenGL] Initialize backing store to opaque alpha to allow blending effects. 3 years ago
Michael Lutz 3e49aff35c Codechange: Allow video drivers to handle the cursor themselves. 3 years ago
Michael Lutz f94b2e73e1 Codechange: [Win32] Use an OpenGL core context instead of a compatibility one. 3 years ago
Michael Lutz e8fc050b6e Add: [OpenGL] Support for 8bpp blitters. 3 years ago
Michael Lutz 320072c8dc Codechange: [OpenGL] Explicitly assign which framebuffer target receives the colour values. 3 years ago
Michael Lutz 821f30f735 Codechange: [OpenGL] Use GLSL version 1.50 if available. 3 years ago
Michael Lutz 90fd8f8cda Codechange: [OpenGL] Use generic vertex attributes in the shader program. 3 years ago
Michael Lutz acf59f6b68 Codechange: [OpenGL] Use shaders to display the video buffer on screen. 3 years ago
Michael Lutz b181859629 Change: [Win32] Disable VSync for OpenGL by default. 3 years ago
Michael Lutz 9a069faa01 Codechange: [Win32] Try to get an OpenGL 3.2+ context if possible. 3 years ago
Michael Lutz a990c497b5 Codechange: [OpenGL] Use a pixel buffer object to store the video buffer. 3 years ago
Michael Lutz 5af0cfd902 Codechange: [OpenGL] Use a vertex array object to store the vertex state for the video buffer. 3 years ago
Michael Lutz acf2ce35f7 Codechange: [OpenGL] Use a vertex buffer object to store the vertex data for the video buffer. 3 years ago
Michael Lutz 8706c36fc0 Codechange: [Win32] Move remaing global _wnd variables into the video driver. 3 years ago
Michael Lutz d6b6775888 Change: Lock the video buffer when drawing inside the game loop to properly account for threaded drawing. 3 years ago
Michael Lutz 73ed748deb Codechange: [Win32] Move the global video buffer pointer into the driver class. 3 years ago
Michael Lutz 5ad545dcc1 Codechange: [OpenGL] Only update the dirty parts of the video buffer texture. 3 years ago
Michael Lutz 3a77ade6b2 Codechange: [OpenGL] Enable driver debug messages if supported. 3 years ago
Michael Lutz d7b96a424f Codechange: [OpenGL] Use new-style extension testing introduced with OpenGL 3.0. 3 years ago
Michael Lutz ef478ade64 Add: [Win32] Video driver that uses OpenGL to transfer the video buffer to the screen. 3 years ago
Patric Stout 78d96dad2a
Fix #6319: [Win32] don't use clipping; draw whole screen every frame (#8726)
When we clip the region that is only been redrawn, something
weird happens on Windows. When pushing 60 frames per second on a
60Hz monitor, it appears that the clipped region is often shown
of another frame, instead of the current.

Examples of this are:
- pause the game, move your mouse to the left, and at the right
  speed it totally disappears.
- fast aircrafts seem to be in several places at once, weirdly
  lagging behind.
- in title screen, moving your mouse gives you the idea it is
  jumping places, instead of smooth movements.

In the end, if you do nothing, everything is correct, so it is
eventually consistent. Just when we are firing many BitBlt in
a clipped region, the in-between is not.

What goes wrong exactly, I honestly do not know. On every frame
that we push to the DC is a mouse painted, but visually it
sometimes appears like it is not. Recording with external software
shows it really is there.
It is also not our eyes playing tricks on us, as the first example
makes it really clear the mouse pointer really is not painted.

And to be clear, with the mouse this is easiest reproduceable,
as high-speed objects are influences by this most. But this happens
for all movement that redraws small regions.

Either way, not using clipped regions resolves the issue completely,
and there appears to be little to no penalty (I failed to measure
any impact of drawing the full screen). So better have a good game
than fast code, I guess?
3 years ago
Jonathan G Rennison 1c1d272b57 Merge branch 'master' into jgrpp 3 years ago
Patric Stout 88959f5595
Codechange: [OSX] remove final bits of old debugging code (#8714) 3 years ago
Jonathan G Rennison dfecdf3afb Merge branch 'master' into jgrpp
# Conflicts:
#	src/dock_gui.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
#	src/terraform_gui.cpp
#	src/vehicle.cpp
#	src/video/allegro_v.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/dedicated_v.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
3 years ago
Patric Stout e1b1608dc6
Fix ec1dd0bf: missing override causing compiler warnings (#8708) 3 years ago
Michael Lutz d16dc22fdf Codechange: Use C++-ism for zeroing. 3 years ago
Michael Lutz 5ca979b1e2 Fix: [OSX] Don't wait on the event loop for drawing. 3 years ago
Michael Lutz f3c192c63d Codechange: [OSX] Only keep a total dirty rect for drawing.
When drawing an 8bpp screen buffer, palette resolving was done for each
dirty rectangle. In areas with high activity, this would mean a pixel might
have been resolved multiple times. Also, if too many individual updates
were queued, the whole screen would be refreshed, even if unnecessary.

All other drivers only keep one overall dirty rect, so do it here as well.
3 years ago
Patric Stout 058f13bdf9 Remove: [SDL] SDL 1.3 never happened, so remove all the special code for it 3 years ago
Patric Stout 0e76d965f1 Codechange: deduplicate tick-handlers of all video drivers
They were all identical, so better put this in a single place
hoping it is less likely to break.
3 years ago
Patric Stout 7996fadb91 Change: [Win32] Remove force_full_redraw and display_hz settings
These were special settings only for the win32-drivers, and
introduced in the very first version we track.

Time kinda had caught up with those variables, so it is time to
say farewell.

force_full_redraw was most likely a debug functionality "in case
our dirty-rect fails". This should no longer be needed.

display_hz was cute, as it had a max of 120. That is kinda
out-dated information, but I also doubt anyone was really using
this.
3 years ago
Patric Stout 23d6f4eac9 Codechange: [Win32] simplify when/where GdiFlush() is called 3 years ago
Patric Stout ec1dd0bf61 Codechange: be consistent in what CheckPaletteAnim() does and when it is called
Additionally, make sure this is a class method. Later commits
will make use of this.
3 years ago
Patric Stout 790fa7102e Codechange: be consistent in naming the paint function Paint()
Also move this function to be a class member. This to allow
further deduplicating of code in a later commit.
3 years ago
Patric Stout 761efbb457 Codechange: use (Un)LockVideoBuffer() to manage video buffer 3 years ago
Patric Stout 661eb39ecc Codechange: move all input-handling of video-drivers into InputLoop 3 years ago
Patric Stout 38b4ae1c0e Codechange: [Win32] make fast-forward check the same as with other drivers
It was of all the drivers the only one doing this slightly different.
When trying to unify more code, that was rather annoying.
3 years ago
Patric Stout 08821f82b6 Fix: [Win32] run InteractiveRandom() once every tick, not once every message
Win32 was the only video driver doing this. It is just a bit too
much random.
3 years ago
Patric Stout 19fdbac287 Fix: [Win32] now we are drawing on a tick, no longer use WM_PAINT
WM_PAINT hits when-ever Windows feels like, but always after we
marked the screen as dirty. In result, it was lagging behind,
giving a sub-60fps experience.

With the new draw-tick there is no longer a need to be driven by
WM_PAINT, so it is better anyway to drive the drawing ourself. As
an added bonus this makes the win32 driver more like the others.
3 years ago
Jonathan G Rennison e95216b59d Merge branch 'master' into jgrpp
# Conflicts:
#	src/company_cmd.cpp
#	src/core/geometry_func.cpp
#	src/date.cpp
#	src/genworld_gui.cpp
#	src/gfx.cpp
#	src/object_gui.cpp
#	src/openttd.cpp
#	src/settings_type.h
#	src/video/allegro_v.cpp
#	src/video/dedicated_v.cpp
#	src/video/null_v.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
3 years ago
Patric Stout 932abe6d5c Fix fa170b9: [SDL2] forgot to use GetGameInterval where needed 3 years ago
Patric Stout 15a0ac2735 Fix cd4f0f95: [Allegro] driver failed to build because of missing include 3 years ago
Patric Stout c4df0f95ae Fix: during switching of game-mode, drawing could show closed windows that shouldn't be closed yet
The higher your refresh-rate, the more likely this is. Mostly you
notice this when creating a new game or when abandoning a game.

This is a bit of a hack to keep the old behaviour, as before this
patch the game was already freezing your mouse while it was changing
game-mode, and it does this too after this patch. Just now it
freezes too a few frames earlier, to prevent not drawing windows
people still expect to see.
3 years ago
Patric Stout fa170b9ace Feature: configurable refresh-rate and change default to 60fps
Most modern games run on 60 fps, and for good reason. This gives
a much smoother experiences.

As some people have monitors that can do 144Hz or even 240Hz, allow
people to configure the refresh rate. Of course, the higher you
set the value, the more time the game spends on drawing pixels
instead of simulating the game, which has an effect on simulation
speed.

The simulation will still always run at 33.33 fps, and is not
influences by this setting.
3 years ago
Patric Stout eb9b1ad68d Change: sleep till the next tick in the main loop
Sleep for 1ms (which is always (a lot) more than 1ms) is just
randomly guessing and hoping you hit your deadline, give or take.

But given we can calculate when our next frame is happening, we
can just sleep for that exact amount. As these values are often
a bit larger, it is also more likely the OS can schedule us back
in close to our requested target. This means it is more likely we
hit our deadlines, which makes the FPS a lot more stable.
3 years ago
Patric Stout ae7a2b9f02 Change: allow video-drivers to miss deadlines slightly
Before, every next frame was calculated from the current time.
If for some reason the current frame was drifting a bit, the
next would too, and the next more, etc etc. This meant we rarely
hit the targets we would like, like 33.33fps.

Instead, allow video-drivers to drift slightly, and schedule the
next frame based on the time the last should have happened. Only
if the drift gets too much, that deadlines are missed for longer
period of times, schedule the next frame based on the current
time.

This makes the FPS a lot smoother, as sleeps aren't as exact as
you might think.
3 years ago
Patric Stout c81c6e5eb7 Add: draw the screen at a steady pace, also during fast-forward
During fast-forward, the game was drawing as fast as it could. This
means that the fast-forward was limited also by how fast we could
draw, something that people in general don't expect.

To give an extreme case, if you are fully zoomed out on a busy
map, fast-forward would be mostly limited because of the time it
takes to draw the screen.

By decoupling the draw-tick and game-tick, we can keep the pace
of the draw-tick the same while speeding up the game-tick. To use
the extreme case as example again, if you are fully zoomed out
now, the screen only redraws 33.33 times per second, fast-forwarding
or not. This means fast-forward is much more likely to go at the
same speed, no matter what you are looking at.
3 years ago
Patric Stout 5bfa014505 Codechange: track _realtime_tick more accurate
_realtime_tick was reset every time the diff was calculated. This
means if it would trigger, say, every N.9 milliseconds, it would
after two iterations already drift a millisecond. This adds up
pretty quick.
3 years ago
Patric Stout 25f6851ca1 Codechange: switch all video drivers to std::chrono for keeping time
On all OSes we tested the std::chrono::steady_clock is of a high
enough resolution to do millisecond measurements, which is all we
need.

By accident, this fixes a Win32 driver bug, where we would never
hit our targets, as the resolution of the clock was too low to
do accurate millisecond measurements with (it was ~16ms resolution
instead).
3 years ago
Patric Stout 8e0d48a0f6
Fix: [SDL2] simplify what to redraw to prevent tearing (#8685)
When there are a lot of rects to redraw, of which one of the last
ones is almost the full screen, visual tearing happens over the
vertical axis. This is most visible when scrolling the map.

This can be prevented by using less rects. To simplify the situation,
and as solutions like OpenGL need this anyway, keep a single rect
that shows the biggest size that updates everything correctly.

Although this means it needs a bit more time redrawing where it
is strictly seen not needed, it also means less commands have
to be executed in the backend. In the end, this is a trade-off,
and from experiments it seems the approach of this commit gives
a better result.
3 years ago
Patric Stout 6de188d025
Fix 52317bb7: [SDL2] ensure we don't try to blit out of bounds (#8684)
During resizing, there can still be dirty-rects ready to blit based
on the old dimensions. X11 with shared memory enabled crashes if
you try to do this. So, instead, if we resize, reset the dirty-rects.

This is fine, as moments later we mark the whole (new) screen as
dirty anyway.
3 years ago
milek7 751f595bb6 Fix: VkMapping declarations violated C++ ODR rule. 3 years ago
Michael Lutz 8d780e0607 Add: [OSX] Automatic zoom level suggestion for Cocoa video driver. 3 years ago
Michael Lutz f175e38666 Add: [Win32] Automatic zoom level suggestion for Win32 video driver.
The zoom level suggestion is based on the DPI scaling set in Windows.
We use 150% scaling as the threshold for 2X zoom and 300% scaling
as the threshold for 4X zoom.
3 years ago
Michael Lutz 22f5aeab07 Feature: Automatic UI and font zoom levels when supported by the OS. 3 years ago
Michael Lutz f5555a6d26 Fix 9c872192: [OSX] Clear mouse button emulation flag. 3 years ago
Michael Lutz e5c3253642 Add: [OSX] Setting to disable HiDPI graphics rendering. 3 years ago
Michael Lutz 0fc763bc55 Change: [OSX] Render screen in full native resolution on HiDPI displays. 3 years ago
Michael Lutz 8906e9e0fd Codechange: Consistently use screen size and not driver resolution for determining window sizes. 3 years ago
Michael Lutz acca56b6a5 Cleanup: [OSX] Improve some comments. 3 years ago
Michael Lutz c78e559e88 Codechange: [OSX] Remove unused 'app active' flag. 3 years ago
Michael Lutz 9c8721922b Fix: [OSX] An emulated right mouse down event has to be followed by right mouse up. 3 years ago
Michael Lutz 649ff5f9f9 Codechange: [OSX] Use relative mouse handling during scrolling. 3 years ago
Michael Lutz 43326d11d8 Change: [OSX] Use a layer-backed view to speed up drawing. 3 years ago
Michael Lutz 2a8c3a2cf6 Codechange: [OSX] Align backing buffer pitch for a tiny bit performance. 3 years ago
Michael Lutz 94b76ce9a4 Cleanup: [OSX] Move event loop into video driver file. 3 years ago
Michael Lutz 23389e9491 Remove: [OSX] Startup splash screen.
It wasn't displayed anyway as it was never copied to the bundle.
3 years ago
Michael Lutz 063b90b97d Codechange: [OSX] Move key event handling to our view. 3 years ago
Michael Lutz f4bd54fedd Codechange: [OSX] Move mouse event handling to our NSView. 3 years ago
Michael Lutz bd42fc94cc Codechange: [OSX] Move some things from video driver to our NSView. 3 years ago
Michael Lutz 965ce12947 Codechange: [OSX] Use newer mouse tracking API. 3 years ago
Michael Lutz 42af13c141 Codechange: [OSX] Split drawing into its own subview.
This allows the drawing backend code to be independent
of any event or command handling.
3 years ago
Michael Lutz 60f30036f1 Codechange: [OSX] Drain autoreleased objects in each game loop cycle. 3 years ago
Michael Lutz 8aaf4ea098 Codechange: [OSX] Split Window and back buffer creation in Cocoa video driver. 3 years ago
Michael Lutz 0eff7de659 Cleanup: [OSX] Doxygen comment style in video driver. 3 years ago
Michael Lutz 8ced72ab10 Codechange: [OSX] Inline some functions that are used in only one place. 3 years ago
Michael Lutz 13134f9d64 Codechange: [OSX] Replace #define with modern code. 3 years ago
Michael Lutz 88f6c7a9f3 Codechange: [OSX] Fold remaining Cocoa video subdriver into the main driver. 3 years ago
Michael Lutz e6bea3961f Change: [OSX] Replace screen resolution list with suggested window sizes.
We never change the real screen resolution on OSX. As such, offering a list
of resolutions is pointless. Instead of that, offer the user a list of
commonly used window sizes up to the current screen size.
3 years ago
Michael Lutz 4db7837d06 Codechange: [OSX] There is only one subdriver left, remove virtual dispatch. 3 years ago
Patric Stout 52317bb7df Change: [SDL2] Remove unneeded delay of redrawing the screen
In testing, I could find no reason why this statement is here.

The comment is rather unclear (it states what it does, but not
why it would be needed).

This line of code was introduced with f4f40448, which gives no
further insight on why it would be needed to have it here.

As such, let's remove it and see if anyone else reports any
problems with it. If so, this commit can be reverted and a more
clear comment should be added what this line of code is dealing
with (the WHY, not the WHAT).
3 years ago
Patric Stout 2e1535389a Codechange: [SDL2] Don't use globals if we can do with locals 3 years ago
Patric Stout 2bbef6b5cf Codechange: [SDL2] Name paint function Paint(), like other drivers do
This reduces confusion when reading different drivers.
3 years ago
Patric Stout 569ce6c7b4 Fix 30e69c51: palette was not marked dirty when creating a new
This means the code depended that the caller did this for us
before MakePalette() is executed, which is neither a
requirement nor a promise the code makes.
3 years ago
Patric Stout 2c9084d48c
Fix #8029: [SDL2] disable draw-thread on wayland SDL video driver (#8648)
When the wayland SDL video driver is used, an EGL context is
created in the main thread. It is not allowed to update this
context from another thread, which is exactly what our draw-thread
is trying.

The other solution would be to move all of SDL into the
draw-thread, but that would introduce a whole scala of different
problems.

The wayland SDL backend is significantly faster than the
X11 SDL backend, but there is a performance hit nevertheless.
3 years ago
SamuXarick a4035af337
Codechange: Apply coding style (#8640)
* Fix: Missing or needed spaces

* Codechange: Remove space

* Codechange: Remove space

* Codechange: More missing spaces

* Codechange: Missing spaces

* Codechange: Remove space

* Codechange: Remove space
3 years ago
Jonathan G Rennison 650d5e014e Merge branch 'master' into jgrpp
# Conflicts:
#	src/ai/ai_gui.cpp
#	src/company_cmd.cpp
#	src/lang/estonian.txt
#	src/lang/german.txt
#	src/lang/hungarian.txt
#	src/lang/korean.txt
#	src/lang/slovak.txt
#	src/main_gui.cpp
#	src/video/sdl2_v.cpp
3 years ago
Jonathan G Rennison 7154f8859d Merge tag '1.11.0-beta1' into jgrpp
# Conflicts:
#	src/console_cmds.cpp
#	src/gfx_func.h
#	src/industry.h
#	src/lang/czech.txt
#	src/lang/estonian.txt
#	src/lang/german.txt
#	src/lang/indonesian.txt
#	src/lang/japanese.txt
#	src/lang/norwegian_bokmal.txt
#	src/lang/russian.txt
#	src/lang/slovak.txt
#	src/saveload/saveload.h
#	src/station_gui.cpp
#	src/town_gui.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/waypoint_gui.cpp
3 years ago
Jonathan G Rennison b7ddd486cf Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/CompileFlags.cmake
#	src/aircraft_cmd.cpp
#	src/blitter/32bpp_anim.cpp
#	src/cargopacket.cpp
#	src/cheat_gui.cpp
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/core/pool_func.hpp
#	src/date.cpp
#	src/economy.cpp
#	src/error_gui.cpp
#	src/ground_vehicle.cpp
#	src/ground_vehicle.hpp
#	src/group_gui.cpp
#	src/industry_cmd.cpp
#	src/lang/dutch.txt
#	src/lang/french.txt
#	src/lang/german.txt
#	src/linkgraph/linkgraph_gui.cpp
#	src/linkgraph/mcf.cpp
#	src/network/network_content.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_station.cpp
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/pathfinder/follow_track.hpp
#	src/pathfinder/yapf/yapf_common.hpp
#	src/saveload/saveload.cpp
#	src/settings_gui.cpp
#	src/station_cmd.cpp
#	src/station_kdtree.h
#	src/string_func.h
#	src/table/settings.ini
#	src/tgp.cpp
#	src/timetable_cmd.cpp
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/train_cmd.cpp
#	src/train_gui.cpp
#	src/tree_gui.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
#	src/viewport.cpp
#	src/viewport_sprite_sorter_sse4.cpp
#	src/window.cpp
3 years ago
Jonathan G Rennison f9956d88c3 Merge branch 'master' into jgrpp
# Conflicts:
#	src/aircraft_cmd.cpp
#	src/company_gui.cpp
#	src/lang/arabic_egypt.txt
#	src/lang/czech.txt
#	src/lang/esperanto.txt
#	src/lang/faroese.txt
#	src/lang/finnish.txt
#	src/lang/german.txt
#	src/lang/korean.txt
#	src/lang/latvian.txt
#	src/lang/malay.txt
#	src/lang/polish.txt
#	src/lang/spanish.txt
#	src/lang/spanish_MX.txt
#	src/lang/unfinished/urdu.txt
#	src/main_gui.cpp
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/road_cmd.cpp
#	src/settings_type.h
#	src/station_cmd.cpp
#	src/table/settings.ini
3 years ago
Jonathan G Rennison 6c3e5642f8 Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/CompileFlags.cmake
#	src/crashlog.cpp
#	src/fileio.cpp
#	src/fileio_func.h
#	src/fios_gui.cpp
#	src/ini_load.cpp
#	src/ini_type.h
#	src/lang/english.txt
#	src/lang/german.txt
#	src/lang/korean.txt
#	src/network/network_client.cpp
#	src/order_base.h
#	src/order_cmd.cpp
#	src/os/windows/win32.cpp
#	src/road_cmd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/settings.cpp
#	src/station_cmd.cpp
#	src/stdafx.h
#	src/table/settings.ini
#	src/tree_cmd.cpp
#	src/tree_gui.cpp
#	src/vehicle_base.h
#	src/video/cocoa/cocoa_v.mm
#	src/video/cocoa/event.mm
#	src/video/cocoa/wnd_quartz.mm
#	src/viewport.cpp
#	src/widgets/tree_widget.h
3 years ago
Patric Stout 0e54c32452 Codechange: [SDL2] Use MakeDirty() to force a redraw
The original code is "strictly correct", but just reads really
weird, and we use MakeDirty() in several other places instead too.
3 years ago
Patric Stout 30e69c518b Codechange: [SDL2] Rework how palette is updated
It now follows more what the Win32 driver does, and has far less
exceptions and special casing.

MakePalette creates the Palette and prepares surface.
UpdatePalette updates the Palette.
CheckPaletteAnim checks if UpdatePalette needs to be called and
  marks the whole screen dirty so DrawSurfaceToScreen will do a
  full redraw.
3 years ago
Patric Stout eb80fefd1d Fix: [SDL2] Display why SDL_CreateWindow() failed in case it does
All SDL_NNN errors print SDL_GetError, except for this one place.
3 years ago
Patric Stout 19345908cb Codechange: [SDL2] Split away CreateMainWindow from CreateMainSurface
This makes the code a bit more readable, as both intentions are
more clear, and there is less nesting in the main function.
3 years ago
Patric Stout 8c37e5c526 Codechange: [SDL2] reworked the different surfaces to make it more readable 3 years ago
Patric Stout 8de325f256 Codechange: [SDL2] Only prepare "caption" if you are going to us it 3 years ago
Patric Stout e41ec5b42e Codechange: [SDL2] Minor code cleanup to remove silly variable 3 years ago
Patric Stout 678031f9b3 Codechange: [SDL2] Only set _cur_palette, never _local_palette 3 years ago
Patric Stout f31b65825f Codechange: [SDL2] Move FindStartupDisplay to its own function 3 years ago
Patric Stout 6916fc76bd Codechange: [SDL2] reworked FindResolutions to be more like the rest
There was no default resolution fallback, and the code was different
from the win32 driver. It is now named the same and much more
similar.
3 years ago
Patric Stout a52d716c88 Codechange: [SDL2] remove include-protection
This is already done by CMake: if SDL2 is not detected, this file
is not included.
3 years ago
Jonathan G Rennison 39df1c49a1 Merge branch 'master' into jgrpp
# Conflicts:
#	src/fileio.cpp
#	src/group_gui.cpp
#	src/industry.h
#	src/lang/korean.txt
#	src/linkgraph/linkgraphjob.cpp
#	src/linkgraph/linkgraphjob.h
#	src/linkgraph/linkgraphschedule.cpp
#	src/linkgraph/linkgraphschedule.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/town_cmd.cpp
#	src/vehicle_gui.cpp
#	src/vehicle_gui_base.h
3 years ago
Jonathan G Rennison cb69611248 Merge branch 'master' into jgrpp
# Conflicts:
#	.github/changelog.sh
#	cmake/PackageDeb.cmake
#	src/network/network_client.cpp
#	src/settings_gui.cpp
3 years ago
Jonathan G Rennison 43980639de Merge branch 'master' into jgrpp
# Conflicts:
#	.gitignore
#	CMakeLists.txt
#	src/3rdparty/optional/optional.hpp
#	src/group_cmd.cpp
#	src/industry_cmd.cpp
#	src/misc_gui.cpp
#	src/video/sdl2_v.cpp
3 years ago
Patric Stout 1eceee915e Codechange: [SDL2/Win32] Be consistent how 0bpp blitters are not allowed
Sometimes it returned an usererror(), sometimes Start() failed.
Now it always fails on Start(), so nothing else has to check again
what blitter is used.

AfterBlitterChange() can never change to a 0bpp, so it is sufficient
to guard this with an assert().
3 years ago
Patric Stout 49df9c4155 Codechange: [Win32] Use _local_palette for most operations
Other drivers do this too, and this makes the world a bit more
the same.
3 years ago
Patric Stout 881d17d8f1 Codechange: [Win32] use CSleep() instead of Sleep() like everywhere else
Functional it is identical. Just helps future-us when searching
for sleeps.
3 years ago
Patric Stout 689404a4a1 Codechange: [Win32] Use return-early in RegisterWndClass() 3 years ago
Michael Lutz 7415964a4d Codechange: [Win32] Remove Windows 95 specific mouse tracking work-around. 3 years ago
frosch 540fdfbf5a
Fix 0e62a398c7f: Only center the window, when it is smaller than the screen. (#8581) 3 years ago
frosch 0e62a398c7
Add: [SDL2] video driver parameter to put OpenTTD on a particular display on start. By default use the display where the mouse cursor is. (#8572) 3 years ago
Michael Lutz fa60c1f8b9
Feature: Choose a sensible window size on a fresh OTTD config file. (#8536) 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Michael Lutz 979b4af6ca Revert 4ce53cb8: [OSX] Delayed fullscreen switch is not needed anymore.
The fix for #8067 solves the real issue, making this workaround unneeded.
3 years ago
Michael Lutz 6e8be3b03e Fix #8067: [OSX] Calculate title bar height instead of assuming a fixed value. 3 years ago
Michael Lutz 4ce53cb851 Fix: [OSX] Quitting in fullscreen mode would loose the original window size.
This replicates the behaviour on e.g. Windows, which saves the original window size.
3 years ago
Michael Lutz c860a247d3 Change: [OSX] Hide Dock and menu during fullscreen mode. 3 years ago
Michael Lutz 6ad5489d01 Codechange: [OSX] Silence some annoying warnings. 3 years ago
Michael Lutz 7bdaabf5f1 Cleanup: [OSX] Remove cargo cult back-buffer alpha setting on show/hide and instead simply initialise the buffer on allocation. 3 years ago
Michael Lutz a61a741683 Change: [OSX] Compiling the Cocoa/Quartz video driver cannot be disabled anymore. 3 years ago
Michael Lutz 9ccef816f9 Codechange: [OSX] Re-arrange the OSX video driver code by combining all drawing code and moving the window/event handling to a different file.
This is just a code move/rename, not a functionality change.
3 years ago
Jonathan G Rennison 343777e749 OSX: Temporary bodge for WindowQuartzSubdriver::SetPortAlphaOpaque issue 3 years ago
Michael Lutz 65f65ad2ad Codechange: Convert some more FIO functions to take std::string. 4 years ago
Michael Lutz f3326d34e7 Codechange: Use std::string in FIO search path handling. 4 years ago
Michael Lutz 0c6e8a8123 Codechange: Store file search paths as std::string. 4 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 4 years ago
Patric Stout 34051c10df
Doc: some comments for the win32 video driver (#8409)
Co-authored-by: Niels Martin Hansen <nielsm@indvikleren.dk>
4 years ago
Michael Lutz 4c1ee264a6
Fix: [OSX] Warning about ambiguous method (-Wobjc-multiple-method-names). (#8399) 4 years ago
Patric Stout d5b9f7ac37 Add: [Emscripten] use "relative mouse mode" with SDL2
This mode doesn't wrap the mouse constantly, but requests SDL
to lock the mouse pointer. This is needed, as with Emscripten
you are not allowed to change the mouse poisition (only to lock
it into place).
4 years ago
Patric Stout d15dc9f40f Add: support for emscripten (play-OpenTTD-in-the-browser)
Emscripten compiles to WASM, which can be loaded via
HTML / JavaScript. This allows you to play OpenTTD inside a
browser.

Co-authored-by: milek7 <me@milek7.pl>
4 years ago
Patric Stout 2da07f7615 Codechange: unroll the SDL2 main loop
This commit prepares for the next commit, as Emscripten needs to
have a way to trigger a single iteration of the main loop. To
keep the real changes more clear, this commit only unrolls the
loop, and makes no changes to the logic itself.
4 years ago
Jonathan G Rennison d85a529f87 Merge branch 'master' into jgrpp 4 years ago
Jonathan G Rennison 51477334be SDL2: Only pass a single rectangle to SDL_UpdateWindowSurfaceRects
This is to prevent screen tearing
4 years ago
Jonathan G Rennison 1298f49be6 SDL2: Update whole window surface if >= 80% needs updating 4 years ago
Charles Pigott 348c231e12 Codechange: Make codestyle for CMake files consistent for 'control' statements 4 years ago
Jonathan G Rennison 0bfae346c1 Allow using the hash key in hotkeys (SDL) 4 years ago
TechGeekNZ cf8ea74733 Update: Merge branch 'jgrpp_master_cmake' into jgrpp_cmake 4 years ago
nikolas c9aff698d0
Fix #8104: Always add WINDOW_RESIZABLE flag to SDL2 (#8211)
This fixes a bug that can reproduced with these steps:
* Start openttd in fullscreen mode
* Turn off fullscreen mode
* Try to resize the window. The window can't be resized.
4 years ago
TechGeekNZ fe1925931d Cleanup: Correct typographic errors in code comments. 4 years ago
Patric Stout 56d54cf60e Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.

Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.

This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.

Addtiionally, this heavily improves our detection of libraries, etc.
4 years ago
Jonathan G Rennison 43c538fa7d Merge branch 'master' into jgrpp
# Conflicts:
#	src/town_cmd.cpp
4 years ago
TechGeekNZ cdd2892c49 Codechange: Realign SDL driver with SDL2 driver to ease maintenance and emphasise differences. 4 years ago
Jonathan G Rennison 677940cfc6 Merge branch 'master' into jgrpp 4 years ago
Niels Martin Hansen 764497206a Fix #8066: Try another fallback colourspace if first one fails 4 years ago
Jonathan G Rennison f8d6e781ba Merge branch 'master' into jgrpp
# Conflicts:
#	projects/openttd_vs140.vcxproj.filters
#	projects/openttd_vs141.vcxproj.filters
#	projects/openttd_vs142.vcxproj.filters
#	src/base_consist.h
#	src/company_base.h
#	src/newgrf_config.cpp
#	src/newgrf_config.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/station_sl.cpp
#	src/settings.cpp
#	src/signs_base.h
#	src/string.cpp
#	src/string_func.h
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_cmd.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/null_v.cpp
4 years ago
Michael Lutz 37bc2f8064 Codechange: Use std::string in the driver and blitter selection code. 4 years ago
Jonathan G Rennison 197a4f2e3e fcitx: Use XLookupString instead of XLookupKeysym to fix modifier keys
See: #142
4 years ago
Jonathan G Rennison 74b6981d97 Merge branch 'master' into jgrpp
# Conflicts:
#	src/os/macosx/macos.mm
#	src/video/cocoa/cocoa_v.mm
#	src/video/cocoa/fullscreen.mm
#	src/video/cocoa/wnd_quartz.mm
#	src/video/cocoa/wnd_quickdraw.mm
4 years ago
Michael Lutz 9dd8b3d430 Remove: [OSX] Stuff that is pre-10.7 from the Cocoa/Quartz video driver. 4 years ago
Michael Lutz 0e5be3887c Remove: [OSX] Old fullscreen subdriver for pre 10.7 systems.
Since the move to C++11, building for pre 10.7 is not possible with the native
Apple tools. Also, due to bitrot, the file doesn't even compile anymore. While
this could be fixed, it shows that this subdriver is basically never used anymore.
4 years ago
Michael Lutz a31cbbf67f Remove: [OSX] QuickDraw video subdriver used for OSX versions up to 10.4.
Since the C++11 move, getting OpenTTD to compile and run for anything
below 10.7 basically requires building a custom compiler and libc++.
Also, the QuickDraw subdriver crashes on more modern OSX version. While this
is fixable, keeping the driver around is probably pointless.
4 years ago
Jonathan G Rennison 4c59dfb6b1 Fix data race during palette animation with threaded blitters 4 years ago
Jonathan G Rennison d210bc4d14 Merge branch 'master' into jgrpp
# Conflicts:
#	src/lang/korean.txt
#	src/saveload/afterload.cpp

Recalculate docking tile cache due to 57553cd8
4 years ago
Sebastian Pauka bd3a5876b0 Fix #7644: [Cocoa] Manually set colorspace to sRGB 4 years ago
Jonathan G Rennison dd99fd646d Merge branch 'master' into jgrpp
# Conflicts:
#	src/base_station_base.h
#	src/industry.h
#	src/industry_cmd.cpp
#	src/industry_gui.cpp
#	src/lang/korean.txt
#	src/os/macosx/crashlog_osx.cpp
#	src/station_cmd.cpp
#	src/town.h
#	src/town_cmd.cpp
#	src/town_gui.cpp
4 years ago
xdavidwu 8fe38afd2b Fix: [SDL2] Correct name of the video driver in debug log
SDL_GetVideoDriver(0) returns name of first video driver included in
the library, not the driver currently used.
SDL_GetCurrentVideoDriver() does what we want here.
4 years ago
Jonathan G Rennison cbdd9f84d8 Merge branch 'master' into jgrpp
# Conflicts:
#	src/console_gui.cpp
#	src/lang/korean.txt
#	src/video/sdl2_v.cpp
#	src/video/sdl2_v.h
#	src/window.cpp
#	src/window_gui.h
5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Jonathan G Rennison a15ace0f5b Fix #7783, Fix #7816: [SDL2] Fix input handling in edit context
In particular this fixes handling of the shift key
5 years ago
Jonathan G Rennison 81f159434d Codechange: Add EditBoxGainedFocus method to VideoDriver base class 5 years ago
Jonathan G Rennison 46f7c6a641 Change: [SDL2] Add an "unprintable" flag to struct VkMapping
SDL_Keysym::sym is not suitable for checking whether the character
is printable or not
5 years ago
Jonathan G Rennison d41378c00a Fix: [SDL2] Page down key not handled
SDLK_PAGEUP and SDLK_PAGEDOWN are not sequential
They must have separate entries in _vk_mapping
5 years ago
Jonathan G Rennison 3db399d7d9 Fix: [SDL2] Detection of backtick scancode
SDL_Keysym::scancode is a SDL_SCANCODE_* constant, not a raw scan code
5 years ago
Jonathan G Rennison ca3c72438e Merge branch 'master' into jgrpp
# Conflicts:
#	Makefile.bundle.in
#	src/os/macosx/string_osx.cpp
#	src/station_cmd.cpp
5 years ago
Jonathan G Rennison daf7cf1913 Fix: SDL2: Detection of backtick scancode
SDL_Keysym::scancode is a SDL_SCANCODE_* constant, not a raw scan code
5 years ago
Jonathan G Rennison 86953e1bef Change: SDL2: Add an "unprintable" flag to struct VkMapping
SDL_Keysym::sym is not suitable for checking whether the character
is printable or not
5 years ago
Jonathan G Rennison ab54beb3af Fix: SDL2: Page down key: SDLK_PAGEUP and SDLK_PAGEDOWN are not sequential
They must have separate entries in _vk_mapping
5 years ago
Nikolas Nyby 4884dcacba Fix #7784: up/down/home/end key behavior in SDL2
Closes #7784.
5 years ago
Michael Lutz d5a9bd404a Codechange: [OSX] Use std::unique_ptr with a custom deleter to simply memory management of Core Foundation types. 5 years ago
Jonathan G Rennison 5bf52ab736 SDL2: Fix Home and End keys not working in text editing contexts 5 years ago
Nikolas Nyby f13b184588 Codechange: Don't use SDL_CreateRGBSurfaceWithFormat()
This function requires libSDL 2.0.5 or higher. It looks like we don't
need to use it, and can just use the original SDL_CreateRGBSurface(),
with the masks set to 0, to trigger the default 8-bit format, which is
SDL_PIXELFORMAT_INDEX8.

Closes #7785

Note: this code path is activated by using an 8-bit blitter, like:

    ./bin/openttd -b 8bpp-simple
5 years ago
Jonathan G Rennison 299becbb2f SDL2: Fix up/down keys in console window 5 years ago
Jonathan G Rennison 67a725e813 SDL2: Handle Fcitx keypresses which do not generate an SDL_KEYDOWN 5 years ago
Jonathan G Rennison 87acac9700 SDL2: Fix handling of shift key in edit context 5 years ago
Jonathan G Rennison 29ed470e04 Fcitx: Fix edge cases around text handling and setup 5 years ago
Jonathan G Rennison 24b5cb0fdb IME: Add direct support for Fcitx IME input, with SDL2 on *nix/X11. 5 years ago
Jonathan G Rennison 34a6f3c72a Fix text input when not in edit box mode, fix backtick handling 5 years ago
Jonathan G Rennison 5d1578bb7f Fix IME positioning with SDL2 5 years ago
Jonathan G Rennison a4c677a571 Add basic IME support to SDL2 video driver 5 years ago
Jonathan G Rennison edfd378e93 Merge branch 'master' into jgrpp
# Conflicts:
#	source.list
#	src/blitter/32bpp_anim.cpp
#	src/linkgraph/linkgraphjob.cpp
#	src/order_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_type.h
5 years ago
Jonathan G Rennison 33f5e00700 Null video driver: Add driver parameter to run until exit 5 years ago
JMcKiern 04f659e768 Fix: Some typos found using codespell 5 years ago