World: r3wp
[!REBOL3 Host Kit]
older newer | first last |
ssolie 4-Nov-2010 [773x2] | line 1 line 2 |
thanks :) | |
Andreas 4-Nov-2010 [775] | do you have a window opening for the window gob already :) ? |
ssolie 4-Nov-2010 [776] | yes I do.. just need to handle some events now so I can make it quit as well |
Andreas 4-Nov-2010 [777] | very nice :) |
ssolie 4-Nov-2010 [778] | one small step at a time |
Carl 5-Nov-2010 [779] | nice! |
Cyphre 5-Nov-2010 [780x2] | Andreas, I got this in OSX when compiling your test files: http://cyphre.mysteria.cz/tests/osx-exports.txt |
( gcc version 4.0.0 (Apple Computer, Inc. build 5026) Apple Computer, Inc. version cctools-590.obj~12 ) | |
Carl 6-Nov-2010 [782] | Ah, so about the same as mine. |
ssolie 6-Nov-2010 [783] | I found this line in the host-kit when handling the closing of a window: Close_Window(gob); // Needs to be removed - should be done by REBOL event handling My question is how do I do this the right way? I think I need to do an RL_Event(EVT_CLOSE) and then somehow wait for REBOL to notify me. How will REBOL notify me it is ready to perform EVT_CLOSE? |
ssolie 7-Nov-2010 [784] | Would CTRL-C map to the EVT_INTERRUPT event? I'm asking because when I do this: >> wait system/view/event-port R3 never returns and I cannot interrupt it. I'd like to fix this is possible. |
Anton 7-Nov-2010 [785] | Esc key is supposed to interrupt it, isn't it? |
Carl 7-Nov-2010 [786x8] | Steve, on window close issue, we need to decide. The issue is this: when use hits a close button (or causes OS-side close event), do we close the window at the host layer, or do we send an event, allowing the higher layer to pre-empt the close. |
=user | |
Arguments can be made both ways. The win32 code currently sends EVT_CLOSE, but also calls Close_Window(). | |
Steve, a few comments on script interrupt... Yes, currently, we use CTRL-C. But, it's purpose must be better defined, because there are really 2 types of interrupts that we want to process. | |
1. script interrupt: does a halt 2. program interrupt: does an exit | |
Because the host-kit side cannot know the state of execution in the core, it is necessary to use RL_Escape() to signal the event. | |
What we want eventually is for host-kit to detect ESC, and call RL_Escape for that too. But, that requires that we use raw stdio processing (or use an OS that's good enough to detect and signal us on a specific key press), so it's not implemented yet. | |
Notice that on Windows, your WAIT example above will interrupt as expected on CTRL-C. So that part of the basic mechanism is implemented. | |
Anton 7-Nov-2010 [794] | +1 Close_Window() in host layer. The scenarios I'm thinking of (eg. where an app delays the closing of the window to dialog you with "data is not saved!") seem pretty cheap in this day and age, and justifiably should not be allowed to preempt the window close. There could be scenarios I haven't thought of, though. |
ssolie 7-Nov-2010 [795x4] | Amiga has CTRL-D which means interrupt script and CTRL-C which means interrupt command (from the shell). |
By script I mean a shell script but it could also mean REBOL script. :) | |
It is also possible for a window close to fail if the EVT_CLOSE event cannot be queued. This situation is currently ignored in the Windows implementation. | |
I just implemented CTRL-C checking in OS event handler and I call RL_Escape() when it is detected. Seems to work fine now. On Amiga, all signals must be explicitly checked for. This is both good and bad of course. The control is nice but the code duplication for things like CTRL-C is not. | |
Pekr 7-Nov-2010 [799x3] | Inability to catch window close is a defect in desing, easy as that ... |
I can't imagine my browser does not ask me, if I want to save tonnes of opened tabs. Why should we miss that R2 feature? | |
I think that insert-event-func was good mechanism to use .... | |
ssolie 7-Nov-2010 [802] | So you mean that the OS should be able to control the closing of the window and REBOL should not be able to interrupt that? |
Pekr 7-Nov-2010 [803] | exactly the opposite ... |
ssolie 7-Nov-2010 [804] | Ah, so REBOL is in control and the OS must obey. |
Pekr 7-Nov-2010 [805] | Rebol can be in control, but does not have to be. IIRC in R2, you used something like insert-event-func, which inserted your handler into an event loop, where you could catch such events .... |
ssolie 7-Nov-2010 [806x2] | As it is now, I simply post an EVT_CLOSE event and if successful, close the window. There is no opportunity to receive information from R3 on whether the EVT_CLOSE was successful or not. |
The EVT_CLOSE may fail if out of memory only. | |
Pekr 7-Nov-2010 [808x2] | I don't understand low level implementations much, but once again - I regard eventual non-ability to control such behaviour as windows closure from my script, a defect, not a feature :-) |
... and R3 should add flexibility in comparison to R2, not to remove it ... | |
ssolie 7-Nov-2010 [810] | As it stands right now, R3 accepts the EVT_CLOSE and can do nothing to stop it. |
Pekr 7-Nov-2010 [811x2] | I don't know how R2 did it, but IIRC it was possible ... |
I don't use it in my scripts. Maybe I used it once. But - I don't want to explain to eventual client, that REBOL as a platform can't offer such a feature as a dialog box warning before the close of the window happens ... | |
ssolie 7-Nov-2010 [813x2] | In user terms, if I hit the close gadget on my window then it closes. The only time it may not close is if the event queue is full. There is no "are you sure?" opportunity. This is why I asked about it. :) |
I suppose I should go file a bug report right now so we don't forget... | |
Henrik 7-Nov-2010 [815] | If you don't have the ability to intercept the closing of the window, then you will cause data loss in apps, and not giving the program a chance to clean up (temp files, file locks, etc.) when quitting. Tthis deals with more than plain warnings of window closure. This is a UI and app specific behavior issue and should really not be controlled on a low level. |
Gregg 7-Nov-2010 [816] | I'm with Petr and Henrik here. We need to get the event and not have our process end before we can clean up. Hard terminating an runaway or zombie is a different issue. |
ssolie 7-Nov-2010 [817x2] | I am currently doing cleanup in the RDC_QUIT vector of the OS Events device. |
Filed a bug report.. bbl | |
Cyphre 7-Nov-2010 [819] | Carl, Andreas: I tried to update the Xcode to 2.5 but the compiled result of the test from Andreas is the same as with the older version :-/ |
Andreas 7-Nov-2010 [820x3] | Ha, Cyphre! |
I think I figured it out even for older toolchains. | |
Would you like to help me testing? | |
older newer | first last |