Skip to content

Commit

Permalink
tap on titlebar stroke input fix again; v1.2.5;
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rgb committed Jul 4, 2016
1 parent c1c95f6 commit 2cb4e0d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Milton.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

[Setup]
AppName=Milton
AppVersion=1.2.4
AppVersion=1.2.5
DefaultDirName={pf}\Milton
DefaultGroupName=Milton
;UninstallDisplayIcon={app}\Milton.exe
Compression=lzma2
SolidCompression=yes
OutputBaseFilename=MiltonSetup_1.2.4
OutputBaseFilename=MiltonSetup_1.2.5
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64

Expand Down
8 changes: 6 additions & 2 deletions src/milton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ static void milton_stroke_input(MiltonState* milton_state, MiltonInput* input)
// Cleared to be appended.
if (passed_inspection && ws->num_points < STROKE_MAX_POINTS-1)
{
// TODO: Add interpolation points here based on angle between consecutive points.
// Once that's added, enable mouse input smoothing.

if (milton_brush_smoothing_enabled(milton_state))
{
Expand Down Expand Up @@ -1306,8 +1308,10 @@ void milton_update(MiltonState* milton_state, MiltonInput* input)
point);
render_flags |= MiltonRenderFlags_UI_UPDATED;
}
if(input->flags & MiltonInputFlags_CLICKUP) {
if (!(milton_state->flags & MiltonStateFlags_IGNORE_NEXT_CLICKUP)) {
if(input->flags & MiltonInputFlags_CLICKUP)
{
if (!(milton_state->flags & MiltonStateFlags_IGNORE_NEXT_CLICKUP))
{
milton_switch_mode(milton_state, MiltonMode_PEN);
milton_update_brushes(milton_state);
}
Expand Down
20 changes: 8 additions & 12 deletions src/milton_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,24 @@
// - Fixed address root_arena
// - very large root_arena
// - Runtime renderer implementation switching with F4
#define MILTON_DEBUG 1
#define MILTON_DEBUG 0

#define MILTON_ZOOM_DEBUG 1
// If MILTON_DEBUG is 0, MILTON_ZOOM_DEBUG will be 0 too!
#if !MILTON_DEBUG
#undef MILTON_ZOOM_DEBUG
#define MILTON_ZOOM_DEBUG 0
#endif
#define MILTON_ZOOM_DEBUG 0
// If MILTON_DEBUG is 0, MILTON_ZOOM_DEBUG will be 0 too!
#if !MILTON_DEBUG
#undef MILTON_ZOOM_DEBUG
#define MILTON_ZOOM_DEBUG 0
#endif

#define MILTON_MULTITHREADED 1

#define MILTON_ENABLE_PROFILING 1
#define MILTON_ENABLE_PROFILING 0

#define MAX_NUM_WORKERS 64
// Force things to be a bit slower
#define RESTRICT_NUM_WORKERS_TO_2 0


// 0 - Use strict SRGB definition
// 1 - Use a power curve of 2.
#define FAST_GAMMA 0

// Large files get impractical to save in a blocking function.
// Disabled for now. This was implemented when a bug was causing files to be huge.
// Hopefully milton will never need this. Leaving it just in case.
Expand Down
2 changes: 1 addition & 1 deletion src/milton_unity_build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include "persist.cc"
#include "gui.cc"
#include "software_renderer.cc"
#include "hardware_renderer.cc"
//#include "hardware_renderer.cc"
#include "memory.cc"
#if MILTON_DEBUG
#include "tests.cc"
Expand Down
37 changes: 21 additions & 16 deletions src/sdl_milton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ MiltonInput sdl_event_loop(MiltonState* milton_state, PlatformState* platform_st
b32 was_pen_down = EasyTab->PenInProximity && !platform_state->is_pointer_down;
for (int pi = 0; pi < EasyTab->NumPackets; ++pi)
{
if (EasyTab->PosX >= 0 && EasyTab->PosY >= 0) // Quick n' dirty is-inside-client-rect test
bool is_down = EasyTab->Pressure[pi] > 0 && EasyTab->PenInProximity;
if (is_down)
{
bool is_down = EasyTab->Pressure[pi] > 0 && EasyTab->PenInProximity;
if (is_down)
got_pen = true;
v2i point = { EasyTab->PosX[pi], EasyTab->PosY[pi] };
if (point.x >= 0 && point.y >= 0)
{
got_pen = true;
if (platform_state->num_point_results < MAX_INPUT_BUFFER_ELEMS)
{
v2i point = { EasyTab->PosX[pi], EasyTab->PosY[pi] };
milton_input.points[platform_state->num_point_results++] = point;
}
if (platform_state->num_pressure_results < MAX_INPUT_BUFFER_ELEMS)
Expand Down Expand Up @@ -224,7 +224,7 @@ MiltonInput sdl_event_loop(MiltonState* milton_state, PlatformState* platform_st
platform_state->pan_start = { event.button.x, event.button.y };
platform_state->pan_point = platform_state->pan_start; // No huge pan_delta at beginning of pan.
}
else
else if (point.x >= 0 && point.y >= 0)
{
if (platform_state->num_point_results < MAX_INPUT_BUFFER_ELEMS)
{
Expand Down Expand Up @@ -271,13 +271,16 @@ MiltonInput sdl_event_loop(MiltonState* milton_state, PlatformState* platform_st
{
if (!platform_state->is_panning)
{
if (platform_state->num_point_results < MAX_INPUT_BUFFER_ELEMS)
if (input_point.x >= 0 && input_point.y >= 0)
{
milton_input.points[platform_state->num_point_results++] = input_point;
}
if (platform_state->num_pressure_results < MAX_INPUT_BUFFER_ELEMS)
{
milton_input.pressures[platform_state->num_pressure_results++] = NO_PRESSURE_INFO;
if (platform_state->num_point_results < MAX_INPUT_BUFFER_ELEMS)
{
milton_input.points[platform_state->num_point_results++] = input_point;
}
if (platform_state->num_pressure_results < MAX_INPUT_BUFFER_ELEMS)
{
milton_input.pressures[platform_state->num_pressure_results++] = NO_PRESSURE_INFO;
}
}
}
else if (platform_state->is_panning)
Expand Down Expand Up @@ -562,6 +565,8 @@ MiltonInput sdl_event_loop(MiltonState* milton_state, PlatformState* platform_st
}
}
platform_state->is_pointer_down = false;

platform_state->num_point_results = 0;
}

if (platform_state->panning_fsm == PanningFSM_MOUSE_PANNING)
Expand Down Expand Up @@ -703,9 +708,9 @@ int milton_main()
win_rect.left + snap_threshold >= res_rect.left))
{
// Our prefs weren't right. Let's maximize.
SetWindowPos(hwnd, HWND_TOP, 100,100, win_rect.right-100, win_rect.bottom -100, SWP_SHOWWINDOW);
platform_state.width = win_rect.right - 100;
platform_state.height = win_rect.bottom - 100;
SetWindowPos(hwnd, HWND_TOP, 20,20, win_rect.right-20, win_rect.bottom -20, SWP_SHOWWINDOW);
platform_state.width = win_rect.right - 20;
platform_state.height = win_rect.bottom - 20;
ShowWindow(hwnd, SW_MAXIMIZE);
}
}
Expand Down Expand Up @@ -736,7 +741,7 @@ int milton_main()

// Every X ms, call this callback to send us an event so we don't wait for user input.
// Called periodically to force updates that don't depend on user input.
SDL_AddTimer(100,
SDL_AddTimer(200,
[](u32 interval, void *param)
{
SDL_Event event;
Expand Down

0 comments on commit 2cb4e0d

Please sign in to comment.