Re: Konsole: lost focus of window or tab

2007-01-18 Thread Mikolaj Machowski
Dnia czwartek 18 styczeń 2007, Matthew Woehlke napisał:
 ...I am not a Vim hacker, but if you can rig Vim to handle some escape
 sequence, I may be able to help make Konsole understand/send them. A
 start might be to write a simple application that sends the sequence to
 turn on the function and then listens for them and takes some action
 (like beeping and/or printing a message with a time stamp) when it
 receives a notification. You could use that to test Konsole. (Read: if
 you write that, it will make me much more motivated to help you with
 hacking on Konsole :-).)

I am not Vim hacker, not even programmer. The only I am able to do is
simple shell thingy:


#!/bin/bash
read key
if [ `echo $key | grep '24' ` ]; then
echo -e 'you got it'
fi


24 should be replaced by escape code, if code is coming from terminal
maybe it should be ``read -e``, not just ``read``. In addition you have
to manually press enter to go further :( Works with codes of function
keys. 

m.



Re: Konsole: lost focus of window or tab

2007-01-18 Thread Mikolaj Machowski
Dnia czwartek 18 styczeń 2007, Bram Moolenaar napisał:
 Note that we also need one to enable/disable getting these events.  A
 program should only get the events when asked for.

Are you talking here about Vim part or Konsole part?

m.



Re: Konsole: lost focus of window or tab

2007-01-18 Thread Bram Moolenaar

Mikolaj Machowski wrote:

 Dnia czwartek 18 styczeñ 2007, Bram Moolenaar napisa³:
  Note that we also need one to enable/disable getting these events.  A
  program should only get the events when asked for.
 
 Are you talking here about Vim part or Konsole part?

Both.  The terminal emulater needs to support enable/disable for sending
focus events.  Vim must send the enable/disable when appropriate (e.g.,
it needs to be disabled when executing a shell command).  Although this
can perhaps be part of the already existing t_ke and t_ks codes.

-- 
I wonder how much deeper the ocean would be without sponges.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Konsole: lost focus of window or tab

2007-01-18 Thread Matthew Woehlke

Bram Moolenaar wrote:

Mikolaj Machowski wrote:


Dnia czwartek 18 styczeñ 2007, Bram Moolenaar napisa³:

Note that we also need one to enable/disable getting these events.  A
program should only get the events when asked for.

Are you talking here about Vim part or Konsole part?


Both.  The terminal emulater needs to support enable/disable for sending
focus events.  Vim must send the enable/disable when appropriate (e.g.,
it needs to be disabled when executing a shell command).  Although this
can perhaps be part of the already existing t_ke and t_ks codes.


So, just to make sure I am following, Vim does or does not currently 
understand any escape sequences for focus events? It sounds like no, 
but then what about A.J.'s comment about reacting to [focus] events for 
'the GUI and a few console versions where this can be detected'?



--
I wonder how much deeper the ocean would be without sponges.


It would be less deep, of course, since the sponges take up volume! :-)

--
Matthew
What a wonderful smell you've discovered! -- Princess Leia Organa



Re: Konsole: lost focus of window or tab

2007-01-18 Thread Mikolaj Machowski
Dnia piątek 19 styczeń 2007, Matthew Woehlke napisał:
 So, just to make sure I am following, Vim does or does not currently
 understand any escape sequences for focus events? It sounds like no,
 but then what about A.J.'s comment about reacting to [focus] events for
 'the GUI and a few console versions where this can be detected'?

From placement of focus related functions in Vim source looks like
currently such events are supported only in GUI and Win32 console. There
is no general code.

m.



Re: Konsole: lost focus of window or tab

2007-01-17 Thread Nikolai Weibull

On 1/17/07, Matthew Woehlke [EMAIL PROTECTED] wrote:


Mikolaj Machowski wrote:



 Is it possible to recognize if window or tab of Konsole lost focus
 through termcap/terminfo sequence?

 Or is it at least possible with dcop or any other way?

 I am investigating ways to support Vim FocusGain/FocusLost autoevents.



Long answer (short answer below):


[A really long answer]

Hi!

Sorry, but I just had to ask, what exactly are you responding to?  I
saw no suggestion of using DCOP in the vim-dev thread.  Did someone on
the kde list suggest it?  Just curious on what they were suggesting.

Thanks!

 nikolai


Re: Konsole: lost focus of window or tab

2007-01-17 Thread Matthew Woehlke

Nikolai Weibull wrote:

On 1/17/07, Matthew Woehlke wrote:

Mikolaj Machowski wrote:
 Is it possible to recognize if window or tab of Konsole lost focus
 through termcap/terminfo sequence?

 Or is it at least possible with dcop or any other way?

 I am investigating ways to support Vim FocusGain/FocusLost autoevents.



Long answer (short answer below):


[snip really long answer]

Hi!

Sorry, but I just had to ask, what exactly are you responding to?  I
saw no suggestion of using DCOP in the vim-dev thread.  Did someone on
the kde list suggest it?  Just curious on what they were suggesting.


Mikolaj Machowski though of it (see his original e-mail to kde-devel, 
quoted above). So this is a follow up of the previous thread, FocusLost 
and terminal functionality; also it raised a number of curiosity 
questions (about Vim) on my part, so I cross-posted. :-) (And because we 
are talking about Vim, of course.)


--
Matthew
HIPPOS feel unacknowledged. HIPPOS get angry.
 PRAISE HIPPOS
 HIPPOS seem somewhat placated.



Re: Konsole: lost focus of window or tab

2007-01-17 Thread Matthew Woehlke

Matthew Woehlke wrote:

Mikolaj Machowski wrote:

Is it possible to recognize if window or tab of Konsole lost focus
through termcap/terminfo sequence?

Or is it at least possible with dcop or any other way?

I am investigating ways to support Vim FocusGain/FocusLost autoevents.


[snip long answer]
[...and short answer, too]


Robert Knight says we should be able to add escape sequences to Konsole 
to support this. I might be able to help with the patching (although it 
is KDE4 that will really get the fix, anything for KDE3 does not seem 
likely to be accepted, so you would be patching your own local version), 
but someone Vim-side needs to tell us what Konsole needs to provide...


Does Vim already support notifications for some terminal emulators? If 
so, how do we go about adding Konsole to that list?


--
Matthew
HIPPOS feel unacknowledged. HIPPOS get angry.
 PRAISE HIPPOS
HIPPOS seem somewhat placated.



Re: Konsole: lost focus of window or tab

2007-01-17 Thread A.J.Mechelynck

Matthew Woehlke wrote:

Matthew Woehlke wrote:

Mikolaj Machowski wrote:

Is it possible to recognize if window or tab of Konsole lost focus
through termcap/terminfo sequence?

Or is it at least possible with dcop or any other way?

I am investigating ways to support Vim FocusGain/FocusLost autoevents.


[snip long answer]
[...and short answer, too]


Robert Knight says we should be able to add escape sequences to Konsole 
to support this. I might be able to help with the patching (although it 
is KDE4 that will really get the fix, anything for KDE3 does not seem 
likely to be accepted, so you would be patching your own local version), 
but someone Vim-side needs to tell us what Konsole needs to provide...


Does Vim already support notifications for some terminal emulators? If 
so, how do we go about adding Konsole to that list?




Sure. At the very least, it reacts to the notifications that a key has been 
pressed, or the mouse moved or clicked ;-) or, more seriously, to FocusGained 
and FocusLost events for the GUI and a few console versions where this can be 
detected. I suppose any notification mechanism would be OK, as long as Vim 
can be made to listen to it and trigger its (already defined) FocusGained and 
FocusLost events (q.v.). Do the termcap/terminfo libraries provide for 
representation of focus-related event signals? I don't know, but IMHO it would 
be easiest if they did; however, even if they don't, I suppose an appropriate 
event handler could be programmed into Vim, provided that there existed _any_ 
method to communicate those events unambiguously to a running program. If 
there are several incompatible ways to do it depending on OS and terminal, 
then I suppose it could be implemented via a configure argument and/or a 
configure library search, the way mouse handlers are already included or 
excluded at compile (or more precisely configure) time: see


vim --version | grep mouse


Best regards,
Tony.


Re: Konsole: lost focus of window or tab

2007-01-17 Thread Bram Moolenaar

Matthew Woehlke wrote:

 Matthew Woehlke wrote:
  Mikolaj Machowski wrote:
  Is it possible to recognize if window or tab of Konsole lost focus
  through termcap/terminfo sequence?
 
  Or is it at least possible with dcop or any other way?
 
  I am investigating ways to support Vim FocusGain/FocusLost autoevents.
  
  [snip long answer]
  [...and short answer, too]
 
 Robert Knight says we should be able to add escape sequences to Konsole 
 to support this. I might be able to help with the patching (although it 
 is KDE4 that will really get the fix, anything for KDE3 does not seem 
 likely to be accepted, so you would be patching your own local version), 
 but someone Vim-side needs to tell us what Konsole needs to provide...
 
 Does Vim already support notifications for some terminal emulators? If 
 so, how do we go about adding Konsole to that list?

Vim does check for some events, such as the xterm version response.  We
need to add termcap/terminfo codes for this internally (won't work
anywhere else).  Thus if you follow what's there in Vim it should not be
too complicated.

-- 
To define recursion, we must first define recursion.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Konsole: lost focus of window or tab

2007-01-17 Thread Mikolaj Machowski
Dnia środa 17 styczeń 2007, Matthew Woehlke napisał:
 Matthew Woehlke wrote:
  Mikolaj Machowski wrote:
  Is it possible to recognize if window or tab of Konsole lost focus
  through termcap/terminfo sequence?
 
  Or is it at least possible with dcop or any other way?
 
  I am investigating ways to support Vim FocusGain/FocusLost
  autoevents.
 
  [snip long answer]
  [...and short answer, too]

 Robert Knight says we should be able to add escape sequences to Konsole
 to support this. I might be able to help with the patching (although it
 is KDE4 that will really get the fix, anything for KDE3 does not seem
 likely to be accepted, so you would be patching your own local version),

I was waiting 2 years for Lists in VimL so I can wait several months for
KDE 4 ;)

 but someone Vim-side needs to tell us what Konsole needs to provide...

Looks like it should be similar communication like with mouse events.
Proper escape codes - I suppose there is no standard at the moment. If
Konsole would be first to do it there is chance that will become
standard.

 Does Vim already support notifications for some terminal emulators? If
 so, how do we go about adding Konsole to that list?

Comment in :ui.c:3010: says:

/*
 * Called when focus changed.  Used for the GUI or for systems where this 
can
 * be done in the console (Win32).
 */


m.



Re: Konsole: lost focus of window or tab

2007-01-17 Thread Mikolaj Machowski
Dnia środa 17 styczeń 2007, Matthew Woehlke napisał:

 I'm willing to (try to, at least) help get this working in 3.5.x if you
 can dig up what the needed escapes are (it sounds like there are already
 existing examples?)... it probably won't be accepted but you could use
 it locally, and of course submit it for porting to KDE4.

On kde-devel R. Knight said he can accept it to 3.5.7 release and later
maintain it for KDE 4.

Now, some start. I don't know much about term internals. I read
something yesterday and today so forgive me if I wrote something stupid.
Just seed for further discussion:

Base info according to man terminfo:

Variable String: focus_lost
Cap name:flo
TCapcode:fL
Description: terminal lost focus

Escape sequence: \E[1fl

Variable String: focus_gained
Cap name:fga
TCapcode:fG
Description: terminal gained focus

Escape sequence: \E[1fg

These sequences and names don't conflict with any other entry defined in
my /etc/termcap or /usr/share/terminfo/** .

m.



Re: Konsole: lost focus of window or tab

2007-01-17 Thread Bram Moolenaar

Mikolaj Machowski wrote:

 Dnia środa 17 styczeń 2007, Matthew Woehlke napisał:
 
  I'm willing to (try to, at least) help get this working in 3.5.x if you
  can dig up what the needed escapes are (it sounds like there are already
  existing examples?)... it probably won't be accepted but you could use
  it locally, and of course submit it for porting to KDE4.
 
 On kde-devel R. Knight said he can accept it to 3.5.7 release and later
 maintain it for KDE 4.
 
 Now, some start. I don't know much about term internals. I read
 something yesterday and today so forgive me if I wrote something stupid.
 Just seed for further discussion:
 
 Base info according to man terminfo:
 
 Variable String: focus_lost
 Cap name:flo
 TCapcode:fL
 Description: terminal lost focus
 
 Escape sequence: \E[1fl
 
 Variable String: focus_gained
 Cap name:fga
 TCapcode:fG
 Description: terminal gained focus
 
 Escape sequence: \E[1fg
 
 These sequences and names don't conflict with any other entry defined in
 my /etc/termcap or /usr/share/terminfo/** .

There are some rules about escape sequences, I think ending in fl or
fg is not good.  Try asking Thomas Dickey, he has a good overview of
the codes.

Note that we also need one to enable/disable getting these events.  A
program should only get the events when asked for.

-- 
hundred-and-one symptoms of being an internet addict:
38. You wake up at 3 a.m. to go to the bathroom and stop and check your e-mail
on the way back to bed.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///