824 |
private void SendMaximizeMessage |
private void SendMaximizeMessage |
825 |
(IntPtr display, XWindow handle, bool maximize) |
(IntPtr display, XWindow handle, bool maximize) |
826 |
{ |
{ |
827 |
XEvent xevent = new XEvent(); |
XEvent xevent = new XEvent(); |
828 |
xevent.xany.type = (int)(Xsharp.Events.EventType.ClientMessage); |
xevent.xany.type = (int)(Xsharp.Events.EventType.ClientMessage); |
829 |
xevent.xany.window = handle; |
xevent.xany.window = handle; |
830 |
xevent.xclient.message_type = Xlib.XInternAtom |
xevent.xclient.message_type = Xlib.XInternAtom |
831 |
(display, "_NET_WM_STATE", XBool.False); |
(display, "_NET_WM_STATE", XBool.False); |
1928 |
Xlib.Xlong[] data; |
Xlib.Xlong[] data; |
1929 |
|
|
1930 |
switch((Xsharp.Events.EventType)(xevent.xany.type__)) |
switch((Xsharp.Events.EventType)(xevent.xany.type__)) |
1931 |
{ |
{ |
1932 |
case Xsharp.Events.EventType.ClientMessage: |
case Xsharp.Events.EventType.ClientMessage: |
1933 |
{ |
{ |
1934 |
// Handle messages from the window manager. |
// Handle messages from the window manager. |
1935 |
if(xevent.xclient.message_type == dpy.wmProtocols) |
if(xevent.xclient.message_type == dpy.wmProtocols) |
1975 |
OnBeginInvokeMessage((IntPtr)xevent.xclient.l(0)); |
OnBeginInvokeMessage((IntPtr)xevent.xclient.l(0)); |
1976 |
} |
} |
1977 |
} |
} |
1978 |
break; |
break; |
1979 |
|
|
1980 |
case Xsharp.Events.EventType.PropertyNotify: |
case Xsharp.Events.EventType.PropertyNotify: |
1981 |
{ |
{ |
1982 |
// Handle a property change notification. |
// Handle a property change notification. |
1983 |
if(xevent.xproperty.atom == dpy.wmState) |
if(xevent.xproperty.atom == dpy.wmState) |
2057 |
OnBeginInvokeMessage((IntPtr)xevent.xclient.l(0)); |
OnBeginInvokeMessage((IntPtr)xevent.xclient.l(0)); |
2058 |
} |
} |
2059 |
} |
} |
2060 |
break; |
break; |
2061 |
|
|
2062 |
case Xsharp.Events.EventType.FocusIn: |
case Xsharp.Events.EventType.FocusIn: |
2063 |
{ |
{ |
2064 |
// This window has received the focus. |
// This window has received the focus. |
2065 |
PrimaryFocusIn(); |
PrimaryFocusIn(); |
2066 |
} |
} |
2067 |
break; |
break; |
2068 |
|
|
2069 |
case Xsharp.Events.EventType.FocusOut: |
case Xsharp.Events.EventType.FocusOut: |
2070 |
{ |
{ |
2071 |
// This window has lost the focus. |
// This window has lost the focus. |
2072 |
if(hasPrimaryFocus) |
if(hasPrimaryFocus) |
2079 |
OnPrimaryFocusOut(); |
OnPrimaryFocusOut(); |
2080 |
} |
} |
2081 |
} |
} |
2082 |
break; |
break; |
2083 |
|
|
2084 |
case Xsharp.Events.EventType.KeyPress: |
case Xsharp.Events.EventType.KeyPress: |
2085 |
{ |
{ |
2086 |
// Convert the event into a symbol and a string. |
// Convert the event into a symbol and a string. |
2087 |
if(keyBuffer == IntPtr.Zero) |
if(keyBuffer == IntPtr.Zero) |
2155 |
widget = widget.Parent; |
widget = widget.Parent; |
2156 |
} |
} |
2157 |
} |
} |
2158 |
break; |
break; |
2159 |
|
|
2160 |
case Xsharp.Events.EventType.KeyRelease: |
case Xsharp.Events.EventType.KeyRelease: |
2161 |
{ |
{ |
2162 |
// Convert the event into a symbol and a string. |
// Convert the event into a symbol and a string. |
2163 |
if(keyBuffer == IntPtr.Zero) |
if(keyBuffer == IntPtr.Zero) |
2189 |
widget = widget.Parent; |
widget = widget.Parent; |
2190 |
} |
} |
2191 |
} |
} |
2192 |
break; |
break; |
2193 |
|
|
2194 |
|
case Xsharp.Events.EventType.ButtonPress: |
2195 |
|
{ |
2196 |
|
if ((xevent.xbutton.button == ButtonName.Button4) || |
2197 |
|
(xevent.xbutton.button == ButtonName.Button5)) |
2198 |
|
return; |
2199 |
|
} |
2200 |
|
break; |
2201 |
|
|
2202 |
case Xsharp.Events.EventType.ButtonRelease: |
case Xsharp.Events.EventType.ButtonRelease: |
2203 |
{ |
{ |
2204 |
// Handle mouse wheel events. |
// Handle mouse wheel events. |
2206 |
// Sanity check |
// Sanity check |
2207 |
if ((xevent.xbutton.button != ButtonName.Button4) && |
if ((xevent.xbutton.button != ButtonName.Button4) && |
2208 |
(xevent.xbutton.button != ButtonName.Button5)) |
(xevent.xbutton.button != ButtonName.Button5)) |
2209 |
return; |
break; |
2210 |
|
|
2211 |
// Dispatch the event. |
// Dispatch the event. |
2212 |
widget = focusWidget; |
widget = focusWidget; |
2217 |
{ |
{ |
2218 |
if (io.DispatchWheelEvent (ref xevent)) |
if (io.DispatchWheelEvent (ref xevent)) |
2219 |
{ |
{ |
2220 |
break; |
return; |
2221 |
} |
} |
2222 |
} |
} |
2223 |
if (widget == this) |
if (widget == this) |
2227 |
widget = widget.Parent; |
widget = widget.Parent; |
2228 |
} |
} |
2229 |
} |
} |
2230 |
break; |
break; |
2231 |
|
|
2232 |
case Xsharp.Events.EventType.ConfigureNotify: |
case Xsharp.Events.EventType.ConfigureNotify: |
2233 |
{ |
{ |
2234 |
// The window manager may have caused us to move/resize. |
// The window manager may have caused us to move/resize. |
2235 |
if(xevent.xconfigure.window != xevent.window) |
if(xevent.xconfigure.window != xevent.window) |
2281 |
} |
} |
2282 |
} |
} |
2283 |
} |
} |
2284 |
break; |
break; |
2285 |
|
|
2286 |
case Xsharp.Events.EventType.ReparentNotify: |
case Xsharp.Events.EventType.ReparentNotify: |
2287 |
{ |
{ |
2288 |
// We may have been reparented by the window manager. |
// We may have been reparented by the window manager. |
2289 |
if(xevent.xreparent.window != (XWindow)handle) |
if(xevent.xreparent.window != (XWindow)handle) |
2306 |
OnMoveResize(x, y, width, height); |
OnMoveResize(x, y, width, height); |
2307 |
} |
} |
2308 |
} |
} |
2309 |
break; |
break; |
2310 |
|
|
2311 |
case Xsharp.Events.EventType.MapNotify: |
case Xsharp.Events.EventType.MapNotify: |
2312 |
{ |
{ |
2313 |
// The window manager mapped us to the screen. |
// The window manager mapped us to the screen. |
2314 |
if(Parent is CaptionWidget) |
if(Parent is CaptionWidget) |
2326 |
OnMapStateChanged(); |
OnMapStateChanged(); |
2327 |
} |
} |
2328 |
} |
} |
2329 |
break; |
break; |
2330 |
|
|
2331 |
case Xsharp.Events.EventType.UnmapNotify: |
case Xsharp.Events.EventType.UnmapNotify: |
2332 |
{ |
{ |
2333 |
// We were unmapped from the screen. If "mapped" |
// We were unmapped from the screen. If "mapped" |
2334 |
// is true, then we are being iconified by the window |
// is true, then we are being iconified by the window |