Drag and drop



I have previously posted on this list about creating a WM protocol to
allow the WM to not raise window when a drag is initiating.  This would
allow the WM to have the following behavior:
On ButtonPress, raise the window if it is not the start of a drag
operation.
If it is the start of a drag operation, raise on ButtonRelease instead

Following is a proposal for a very simple protocol that I think gets the
job done rather elegantly.  This would be added to the protocols section
of the WM spec.  The thing that worries me right now is the specific
reference to the ButtonPress event only.  Is there any other input event
that we would want to include here?

	<sect2>
		<title>_NET_WM_MAY_ACTIVATE</title>
		<para>
This protocol allows the Window Manager to improve window activation
semantics by allowing the Client window to participate in the
decision.  The motivation for this protocol is so that the Window
Manager can determine for example that a ButtonPress event is the
start of a drag and drop operation and the Client window should not be
raised.  If a Client uses this protocol, the Client MUST list
_NET_WM_MAY_ACTIVATE in the WM_PROTOCOLS property of the client
window.
		</para>
		<programlisting><![CDATA[
type = ClientMessage
window = the root window
message_type = WM_PROTOCOLS
format = 32
data.l[0] = _NET_WM_MAY_ACTIVATE
data.l[1] = timestamp
data.l[2] = the respective client window
other data.l[] elements = 0
]]></programlisting>
		<para>
When a Client window receives a ButtonPress event, the Client MAY send
a _NET_WM_MAY_ACTIVATE message to the root window.  The timestamp
value MUST be the timestamp for the ButtonPress event.  The Client
SHOULD send this message only if possibly raising the Client window
above other windows on the screen would result in undesirable effects,
such as if the ButtonPress could be the start of a drag and drop.
When a Window Manager sees this ClientMessage, the Window Manager MAY
raise and/or focus the Client window.
		</para>
	</sect2>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]