Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 592796d

Browse files
author
livecodeali
committed
Merge remote-tracking branch 'upstream/develop-7.0' into merge-develop-7.0_07.10.15
2 parents 1724560 + 3f6512c commit 592796d

File tree

9 files changed

+98
-35
lines changed

9 files changed

+98
-35
lines changed

docs/notes/bugfix-14638.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ensure the old stack rect is restored when leaving fullscreen mode
2+

docs/notes/bugfix-14640.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Linux: force the LiveCode window to the top when going fullscreen
2+

docs/notes/bugfix-16111.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Save As dialog always opens in a folder deep in LiveCode's app bundle

engine/src/answer.cpp

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,21 @@ void MCAnswer::exec_ctxt(MCExecContext& ctxt)
346346
MCAutoStringRef t_initial_resolved;
347347
if (*t_initial != nil)
348348
{
349-
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
350-
if (!MCS_resolvepath(*t_initial, &t_initial_resolved))
349+
// We only want to resolve the path if it is relative
350+
// (otherwise it will be created where LiveCode is located)
351+
if (MCStringContains(*t_initial, MCSTR("/"), kMCStringOptionCompareExact))
351352
{
352-
ctxt . LegacyThrow(EE_NO_MEMORY);
353-
return;
353+
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
354+
if (!MCS_resolvepath(*t_initial, &t_initial_resolved))
355+
{
356+
ctxt . LegacyThrow(EE_NO_MEMORY);
357+
return;
358+
}
359+
}
360+
else
361+
{
362+
// We simply take the initial path as it is
363+
t_initial_resolved = *t_initial;
354364
}
355365
}
356366

@@ -383,11 +393,21 @@ void MCAnswer::exec_ctxt(MCExecContext& ctxt)
383393
MCAutoStringRef t_initial_resolved;
384394
if (*t_initial != nil)
385395
{
386-
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
387-
if (!MCS_resolvepath(*t_initial, &t_initial_resolved))
396+
// We only want to resolve the path if it is relative
397+
// (otherwise it will be created where LiveCode is located)
398+
if (MCStringContains(*t_initial, MCSTR("/"), kMCStringOptionCompareExact))
388399
{
389-
ctxt . LegacyThrow(EE_NO_MEMORY);
390-
return;
400+
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
401+
if (!MCS_resolvepath(*t_initial, &t_initial_resolved))
402+
{
403+
ctxt . LegacyThrow(EE_NO_MEMORY);
404+
return;
405+
}
406+
}
407+
else
408+
{
409+
// We simply take the initial path as it is
410+
t_initial_resolved = *t_initial;
391411
}
392412
}
393413

@@ -636,11 +656,18 @@ Exec_errors MCAnswer::exec_file(MCExecPoint& ep, const char *p_title)
636656
t_initial_resolved = nil;
637657

638658
if (!t_error && t_initial != nil)
639-
{
640-
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
641-
t_initial_resolved = MCS_get_canonical_path(t_initial);
642-
if (nil == t_initial_resolved)
643-
t_error == EE_NO_MEMORY;
659+
{
660+
// We only want to resolve the path if the path is relative (otherwise
661+
// it will be created at the current folder - which is /Applications)
662+
if (strchr(t_initial, '/'))
663+
{
664+
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
665+
t_initial_resolved = MCS_get_canonical_path(t_initial);
666+
if (nil == t_initial_resolved)
667+
t_error = EE_NO_MEMORY;
668+
}
669+
else
670+
t_initial_resolved = strclone(t_initial);
644671
}
645672

646673
if (!t_error)
@@ -702,11 +729,18 @@ Exec_errors MCAnswer::exec_folder(MCExecPoint& ep, const char *p_title)
702729
t_initial_resolved = nil;
703730

704731
if (!t_error && t_initial != nil)
705-
{
706-
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
707-
t_initial_resolved = MCS_get_canonical_path(t_initial);
708-
if (nil == t_initial_resolved)
709-
t_error == EE_NO_MEMORY;
732+
{
733+
// We only want to resolve the path if the path is relative (otherwise
734+
// it will be created at the current folder - which is /Applications)
735+
if (strchr(t_initial, '/'))
736+
{
737+
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
738+
t_initial_resolved = MCS_get_canonical_path(t_initial);
739+
if (nil == t_initial_resolved)
740+
t_error = EE_NO_MEMORY;
741+
}
742+
else
743+
t_initial_resolved = strclone(t_initial);
710744
}
711745

712746
if (!t_error)

engine/src/ask.cpp

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,21 @@ void MCAsk::exec_ctxt(class MCExecContext& ctxt)
265265
MCAutoStringRef t_initial_resolved;
266266
if (*t_initial != nil)
267267
{
268-
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
269-
if (!MCS_resolvepath(*t_initial, &t_initial_resolved))
268+
// We only want to resolve the path if it is relative
269+
// (otherwise it will be created where LiveCode is located)
270+
if (MCStringContains(*t_initial, MCSTR("/"), kMCStringOptionCompareExact))
270271
{
271-
ctxt . LegacyThrow(EE_NO_MEMORY);
272-
return;
272+
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
273+
if (!MCS_resolvepath(*t_initial, &t_initial_resolved))
274+
{
275+
ctxt . LegacyThrow(EE_NO_MEMORY);
276+
return;
277+
}
278+
}
279+
else
280+
{
281+
// We simply take the initial path as it is
282+
t_initial_resolved = *t_initial;
273283
}
274284
}
275285

@@ -421,10 +431,20 @@ Exec_errors MCAsk::exec_file(MCExecPoint& ep, const char *p_title)
421431

422432
if (!t_error && t_initial != nil)
423433
{
424-
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
425-
t_initial_resolved = MCS_get_canonical_path(t_initial);
426-
if (nil == t_initial_resolved)
427-
t_error == EE_NO_MEMORY;
434+
// We only want to resolve the path if the path is relative (otherwise
435+
// it will be created at the current folder - which is /Applications)
436+
if (strchr(t_initial, '/'))
437+
{
438+
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
439+
t_initial_resolved = MCS_get_canonical_path(t_initial);
440+
if (nil == t_initial_resolved)
441+
t_error = EE_NO_MEMORY;
442+
}
443+
else
444+
{
445+
// Simply copy the file path
446+
t_initial_resolved = strclone(*t_initial);
447+
}
428448
}
429449

430450
if (!t_error)

engine/src/exec-interface-stack.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ void MCStack::SetFullscreen(MCExecContext& ctxt, bool setting)
344344
// IM-2014-01-16: [[ StackScale ]] Save the old rect here as view_setfullscreen() will update the stack rect
345345
if (setting)
346346
old_rect = rect;
347+
else
348+
rect = old_rect;
347349

348350
// IM-2014-02-12: [[ Bug 11783 ]] We may also need to reset the fonts on Windows when
349351
// fullscreen is changed

engine/src/linux.stubs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ gdk libgdk-x11-2.0.so.0
153153
gdk_window_set_modal_hint: (pointer, integer) -> ()
154154
gdk_window_set_geometry_hints: (pointer, pointer, integer) -> ()
155155
gdk_window_fullscreen: (pointer) -> ()
156+
gdk_window_unfullscreen: (pointer) -> ()
156157
gdk_window_set_type_hint: (pointer, integer) -> ()
157158
gdk_window_set_override_redirect: (pointer, integer) -> ()
158159
gdk_window_set_group: (pointer, pointer) -> ()

engine/src/lnxstack.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,6 @@ void MCStack::setsizehints(void)
213213

214214
gdk_window_set_geometry_hints(window, &t_geo, GdkWindowHints(t_flags));
215215
}
216-
217-
// Use the window manager to set to full screen.
218-
if (getextendedstate(ECS_FULLSCREEN))
219-
{
220-
gdk_window_fullscreen(window);
221-
}
222216
}
223217

224218
void MCStack::sethints()
@@ -273,7 +267,7 @@ void MCStack::sethints()
273267

274268
gdk_window_set_type_hint(window, t_type_hint);
275269

276-
if (mode >= WM_PULLDOWN && mode <= WM_LICENSE)
270+
if ((mode >= WM_PULLDOWN && mode <= WM_LICENSE) || getextendedstate(ECS_FULLSCREEN))
277271
{
278272
gdk_window_set_override_redirect(window, TRUE);
279273
}
@@ -556,7 +550,14 @@ MCRectangle MCStack::view_device_setgeom(const MCRectangle &p_rect,
556550
if (t_width != p_rect.width || t_height != p_rect.height)
557551
gdk_window_resize(window, p_rect.width, p_rect.height);
558552
}
559-
553+
554+
// Set the fullscreen-ness of the window appropriately
555+
// Use the window manager to set to full screen.
556+
if (getextendedstate(ECS_FULLSCREEN))
557+
gdk_window_fullscreen(window);
558+
else
559+
gdk_window_unfullscreen(window);
560+
560561
return t_old_rect;
561562
}
562563

libfoundation/src/foundation-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,14 @@ struct __MCString: public __MCValue
247247
MCStringRef string;
248248
struct
249249
{
250-
double numeric_value;
251250
uindex_t char_count;
252251
union
253252
{
254253
unichar_t *chars;
255254
char_t *native_chars;
256255
};
257256
uindex_t capacity;
257+
double numeric_value;
258258
};
259259
};
260260
};

0 commit comments

Comments
 (0)