Georg Baum wrote:
Am Mittwoch, 3. Januar 2007 10:33 schrieb Abdelrazak Younes:
Georg Baum wrote:
Note also that the concept of "internal selction" is wrong. The
selection
as implemented in LyX (following the concept at freedesktop.org) is
always
global. If you want to change that then this needs to be discussed
first.
I did not touch yet the X11 Selection only the system Clipboard. This is
just naming, "isInternal()" as "was it set from within the
application?". Do you prefer owns()?
No, this was not about naming. What I meant was: LyX does not care whether
the selection was set from within or not. It simply sends the selection to
the X server when it has one, and gets the current selection back when it
is requested. Therefore a Selection::isInternal() method is only
confusing, because it is not needed.
Well, what you say is not fully correct, this isInternal() method could
be used in LFUN_MOUSE_PRESS in place of the local paste_internally
variable. Besides, this code is wrong because the Selection clipboard
should be filled in at selection time, not at mouse-press time.
I was planning to solve that after my other patch is in but now is as
good a time to discuss this. So, do you agree with me?
Besides that the comment is wrong.
Indeed, I'll change that.
lyx::frontend::GuiSelection is BTW exactly the place where a real selection
with middle mouse paste could be emulated on windows: Just store the
string in put(), return it back in get() and clear it in haveSelection()
if needed. Then the only thing that would be missing for Enrico is a
connection of this emulated selection to the external clipboard, but you
could even do that without destroying the simple mental model of
selection: In lyx::frontend::GuiSelection::get(), return the system
clipboard if it was set from outside of LyX and the LyX internal selection
is empty.
This could even be implemented without any #ifdef by simply using
qApp->clipboard()->supportsSelection(), and would work automatically on
all platforms that don't have a selection. This way, no preference setting
would be needed, and the behaviour on windows and X11 would be as
identical as possible. Or did I miss anything?
I have to think a bit more about that but at first glance this looks
like workable. Do you want to implement that? I can do it if you want.
Abdel.