Skip to content
Permalink
Browse files

more 4712 & gcc warning

  • Loading branch information...
alabuzhev committed Jun 21, 2016
1 parent 5c049e5 commit af5da1abaadbf6e9c4277830bc283443376b8ab4
Showing with 76 additions and 58 deletions.
  1. +6 −0 far/changelog
  2. +58 −0 far/interf.cpp
  3. +2 −0 far/interf.hpp
  4. +7 −57 far/keyboard.cpp
  5. +2 −0 far/sqlite.c
  6. +1 −1 far/vbuild.m4
@@ -1,3 +1,9 @@
drkns 21.06.2016 21:33:36 +0200 - build 4720

1. Продолжение 4712.

2. gcc warning.

drkns 20.06.2016 00:20:17 +0200 - build 4719

1. Переменные в ExcludeCmds не разворачивались при использовании в автодополнении.
@@ -327,6 +327,7 @@ void InitConsole(int FirstInit)
if(Global->Opt->WindowMode)
{
Console().ResetPosition();
AdjustConsoleScreenBufferSize(false);
}
else
{
@@ -1291,3 +1292,60 @@ void fix_coordinates(int& X1, int& Y1, int& X2, int& Y2)
fix(0, Y1, ScrY);
fix(0, Y2, ScrY);
}

void AdjustConsoleScreenBufferSize(bool TransitionFromFullScreen)
{
if (!Global->Opt->WindowMode)
return;

COORD Size;
if (!Console().GetSize(Size))
return;

if (!Global->Opt->WindowModeStickyX || !Global->Opt->WindowModeStickyY)
{
// TODO: Do not use console functions directly
// Add a way to bypass console buffer abstraction layer
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo(Console().GetOutputHandle(), &csbi))
{
if (!Global->Opt->WindowModeStickyX)
{
Size.X = csbi.dwSize.X;
}
if (!Global->Opt->WindowModeStickyY)
{
Size.Y = csbi.dwSize.Y;
}
}
}

if (TransitionFromFullScreen)
{
// Exiting fullscreen in Windows 10 is broken:
// They try to fit the window with scrollbars into old size (witout scrollbars),
// thus reducing the window dimensions by (scrollbar_size / console_character_size).
// This doesn't happen with regular maximize/restore though.
// Windows gets better and better every day.

CONSOLE_FONT_INFO FontInfo;
if (GetCurrentConsoleFont(Console().GetOutputHandle(), FALSE, &FontInfo))
{
const auto FixX = Round(static_cast<SHORT>(GetSystemMetrics(SM_CXVSCROLL)), FontInfo.dwFontSize.X);
const auto FixY = Round(static_cast<SHORT>(GetSystemMetrics(SM_CYHSCROLL)), FontInfo.dwFontSize.Y);

Size.X += FixX;
Size.Y += FixY;

SMALL_RECT WindowRect;
if (Console().GetWindowRect(WindowRect))
{
WindowRect.Right += FixX;
WindowRect.Bottom += FixY;
Console().SetWindowRect(WindowRect);
}
}
}

SetConsoleScreenBufferSize(Console().GetOutputHandle(), Size);
}
@@ -203,6 +203,8 @@ void RemoveHighlights(string& Str);
bool IsConsoleFullscreen();
bool IsConsoleSizeChanged();

void AdjustConsoleScreenBufferSize(bool TransitionFromFullScreen);

class consoleicons:noncopyable
{
public:
@@ -83,8 +83,6 @@ static clock_t KeyPressedLastTime;
static int ShiftState=0;
static int LastShiftEnterPressed=FALSE;

static bool LastConsoleFullscreen = false;

/* ----------------------------------------------------------------- */
static const std::pair<int, int> Table_KeyToVK[] =
{
@@ -869,9 +867,13 @@ static DWORD __GetInputRecord(INPUT_RECORD *rec,bool ExcludeMacro,bool ProcessMo

if (rec->EventType==WINDOW_BUFFER_SIZE_EVENT || IsConsoleSizeChanged())
{
auto IsFullscreen = [] { DWORD DisplayMode = 0; return IsWindows10OrGreater() && Console().GetDisplayMode(DisplayMode) && DisplayMode & CONSOLE_FULLSCREEN; };
// BUGBUG If initial mode was fullscreen - first transition will not be detected
static auto StoredConsoleFullscreen = false;

SCOPE_EXIT { LastConsoleFullscreen = IsFullscreen(); };
DWORD DisplayMode = 0;
const auto CurrentConsoleFullscreen = IsWindows10OrGreater() && Console().GetDisplayMode(DisplayMode) && DisplayMode & CONSOLE_FULLSCREEN;
const auto TransitionFromFullScreen = StoredConsoleFullscreen && !CurrentConsoleFullscreen;
StoredConsoleFullscreen = CurrentConsoleFullscreen;

int PScrX=ScrX;
int PScrY=ScrY;
@@ -887,59 +889,7 @@ static DWORD __GetInputRecord(INPUT_RECORD *rec,bool ExcludeMacro,bool ProcessMo
PrevScrX=PScrX;
PrevScrY=PScrY;

if (Global->Opt->WindowMode)
{
COORD Size;
if (Console().GetSize(Size))
{
if (!Global->Opt->WindowModeStickyX || !Global->Opt->WindowModeStickyY)
{
// TODO: Do not use console functions directly
// Add a way to bypass console buffer abstraction layer
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo(Console().GetOutputHandle(), &csbi))
{
if (!Global->Opt->WindowModeStickyX)
{
Size.X = csbi.dwSize.X;
}
if (!Global->Opt->WindowModeStickyY)
{
Size.Y = csbi.dwSize.Y;
}
}
}

if (LastConsoleFullscreen && !IsFullscreen())
{
// Exiting fullscreen in Windows 10 is broken:
// They try to fit the window with scrollbars into old size (witout scrollbars),
// thus reducing the window dimensions by (scrollbar_size / console_character_size).
// This doesn't happen with regular maximize/restore though.
// Windows gets better and better every day.

CONSOLE_FONT_INFO FontInfo;
if (GetCurrentConsoleFont(Console().GetOutputHandle(), FALSE, &FontInfo))
{
const auto FixX = Round(static_cast<SHORT>(GetSystemMetrics(SM_CXVSCROLL)), FontInfo.dwFontSize.X);
const auto FixY = Round(static_cast<SHORT>(GetSystemMetrics(SM_CYHSCROLL)), FontInfo.dwFontSize.Y);

Size.X += FixX;
Size.Y += FixY;

SMALL_RECT WindowRect;
if (Console().GetWindowRect(WindowRect))
{
WindowRect.Right += FixX;
WindowRect.Bottom += FixY;
Console().SetWindowRect(WindowRect);
}
}
}

SetConsoleScreenBufferSize(Console().GetOutputHandle(), Size);
}
}
AdjustConsoleScreenBufferSize(TransitionFromFullScreen);

if (Global->WindowManager)
{
@@ -42,6 +42,7 @@ WARNING_DISABLE_GCC("-Warray-bounds")
WARNING_DISABLE_GCC("-Wunused-but-set-variable")
WARNING_DISABLE_GCC("-Wcast-qual")

#ifdef _MSC_VER
#include <windows.h>

// SQlite 3.12 suddenly started using rand_s function, which depends on RtlGenRandom (SystemFunction036), which is not available in Win2k.
@@ -58,6 +59,7 @@ static int rand_s(unsigned int* randomValue)
*randomValue = rand();
return 0;
}
#endif

#include "thirdparty/sqlite/sqlite3.c"

@@ -1 +1 @@
m4_define(BUILD,4719)m4_dnl
m4_define(BUILD,4720)m4_dnl

0 comments on commit af5da1a

Please sign in to comment.
You can’t perform that action at this time.