本文整理汇总了C#中System.Windows.Forms.XSizeHints类的典型用法代码示例。如果您正苦于以下问题:C# XSizeHints类的具体用法?C# XSizeHints怎么用?C# XSizeHints使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSizeHints类属于System.Windows.Forms命名空间,在下文中一共展示了XSizeHints类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: XGetWMNormalHints
internal extern static void XGetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints, out IntPtr supplied_return);
开发者ID:nlhepler,项目名称:mono,代码行数:1,代码来源:XplatUIX11.cs
示例2: _XSetWMNormalHints
internal extern static void _XSetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints);
开发者ID:nlhepler,项目名称:mono,代码行数:1,代码来源:XplatUIX11.cs
示例3: SystrayAdd
internal override bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt)
{
GetSystrayManagerWindow();
if (SystrayMgrWindow != IntPtr.Zero) {
XSizeHints size_hints;
Hwnd hwnd;
hwnd = Hwnd.ObjectFromHandle(handle);
DriverDebug("Adding Systray Whole:{0:X}, Client:{1:X}", hwnd.whole_window.ToInt32(), hwnd.client_window.ToInt32());
// Oh boy.
if (hwnd.client_window != hwnd.whole_window) {
Keyboard.DestroyICForWindow (hwnd.client_window);
XDestroyWindow(DisplayHandle, hwnd.client_window);
hwnd.client_window = hwnd.whole_window;
}
/* by virtue of the way the tests are ordered when determining if it's PAINT
or NCPAINT, client_window == whole_window will always be PAINT. So, if we're
waiting on an nc_expose, drop it and remove the hwnd from the list (unless
there's a pending expose). */
if (hwnd.nc_expose_pending) {
hwnd.nc_expose_pending = false;
if (!hwnd.expose_pending)
hwnd.Queue.Paint.Remove (hwnd);
}
// We are going to be directly mapped by the system tray, so mark as mapped
// so we can later properly unmap it.
hwnd.mapped = true;
size_hints = new XSizeHints();
size_hints.flags = (IntPtr)(XSizeHintsFlags.PMinSize | XSizeHintsFlags.PMaxSize | XSizeHintsFlags.PBaseSize);
size_hints.min_width = 24;
size_hints.min_height = 24;
size_hints.max_width = 24;
size_hints.max_height = 24;
size_hints.base_width = 24;
size_hints.base_height = 24;
XSetWMNormalHints(DisplayHandle, hwnd.whole_window, ref size_hints);
int[] atoms = new int[2];
atoms [0] = 1; // Version 1
atoms [1] = 1; // we want to be mapped
// This line cost me 3 days...
XChangeProperty(DisplayHandle, hwnd.whole_window, _XEMBED_INFO, _XEMBED_INFO, 32, PropertyMode.Replace, atoms, 2);
// Need to pick some reasonable defaults
tt = new ToolTip();
tt.AutomaticDelay = 350;
tt.InitialDelay = 250;
tt.ReshowDelay = 250;
tt.ShowAlways = true;
if ((tip != null) && (tip != string.Empty)) {
tt.SetToolTip(Control.FromHandle(handle), tip);
tt.Active = true;
} else {
tt.Active = false;
}
SendNetClientMessage(SystrayMgrWindow, _NET_SYSTEM_TRAY_OPCODE, IntPtr.Zero, (IntPtr)SystrayRequest.SYSTEM_TRAY_REQUEST_DOCK, hwnd.whole_window);
return true;
}
tt = null;
return false;
}
开发者ID:nlhepler,项目名称:mono,代码行数:73,代码来源:XplatUIX11.cs
示例4: XSetZoomHints
internal extern static void XSetZoomHints(IntPtr display, IntPtr window, ref XSizeHints hints);
开发者ID:nlhepler,项目名称:mono,代码行数:1,代码来源:XplatUIX11.cs
示例5: GetMessage
//.........这里部分代码省略.........
if (Caret.Visible == true) {
ShowCaret();
Caret.Paused = false;
}
msg.message = Msg.WM_PAINT;
break;
}
case XEventName.DestroyNotify: {
// This is a bit tricky, we don't receive our own DestroyNotify, we only get those for our children
hwnd = Hwnd.ObjectFromHandle(xevent.DestroyWindowEvent.window);
// We may get multiple for the same window, act only one the first (when Hwnd still knows about it)
if ((hwnd != null) && (hwnd.client_window == xevent.DestroyWindowEvent.window)) {
CleanupCachedWindows (hwnd);
DriverDebug("Received X11 Destroy Notification for {0}", XplatUI.Window(hwnd.client_window));
msg.hwnd = hwnd.client_window;
msg.message=Msg.WM_DESTROY;
hwnd.Dispose();
} else {
goto ProcessNextMessage;
}
break;
}
case XEventName.ClientMessage: {
if (Dnd.HandleClientMessage (ref xevent)) {
goto ProcessNextMessage;
}
if (xevent.ClientMessageEvent.message_type == AsyncAtom) {
XplatUIDriverSupport.ExecuteClientMessage((GCHandle)xevent.ClientMessageEvent.ptr1);
goto ProcessNextMessage;
}
if (xevent.ClientMessageEvent.message_type == HoverState.Atom) {
msg.message = Msg.WM_MOUSEHOVER;
msg.wParam = GetMousewParam(0);
msg.lParam = (IntPtr) (xevent.ClientMessageEvent.ptr1);
return true;
}
if (xevent.ClientMessageEvent.message_type == (IntPtr)PostAtom) {
DebugHelper.Indent ();
DebugHelper.WriteLine (String.Format ("Posted message:" + (Msg) xevent.ClientMessageEvent.ptr2.ToInt32 () + " for 0x{0:x}", xevent.ClientMessageEvent.ptr1.ToInt32 ()));
DebugHelper.Unindent ();
msg.hwnd = xevent.ClientMessageEvent.ptr1;
msg.message = (Msg) xevent.ClientMessageEvent.ptr2.ToInt32 ();
msg.wParam = xevent.ClientMessageEvent.ptr3;
msg.lParam = xevent.ClientMessageEvent.ptr4;
if (msg.message == (Msg)Msg.WM_QUIT)
return false;
else
return true;
}
if (xevent.ClientMessageEvent.message_type == _XEMBED) {
#if DriverDebugXEmbed
Console.WriteLine("GOT EMBED MESSAGE {0:X}, detail {1:X}", xevent.ClientMessageEvent.ptr2.ToInt32(), xevent.ClientMessageEvent.ptr3.ToInt32());
#endif
if (xevent.ClientMessageEvent.ptr2.ToInt32() == (int)XEmbedMessage.EmbeddedNotify) {
XSizeHints hints = new XSizeHints();
IntPtr dummy;
XGetWMNormalHints(DisplayHandle, hwnd.whole_window, ref hints, out dummy);
hwnd.width = hints.max_width;
hwnd.height = hints.max_height;
hwnd.ClientRect = Rectangle.Empty;
SendMessage(msg.hwnd, Msg.WM_WINDOWPOSCHANGED, IntPtr.Zero, IntPtr.Zero);
}
}
if (xevent.ClientMessageEvent.message_type == WM_PROTOCOLS) {
if (xevent.ClientMessageEvent.ptr1 == WM_DELETE_WINDOW) {
SendMessage (msg.hwnd, Msg.WM_SYSCOMMAND, (IntPtr)SystemCommands.SC_CLOSE, IntPtr.Zero);
msg.message = Msg.WM_CLOSE;
return true;
}
// We should not get this, but I'll leave the code in case we need it in the future
if (xevent.ClientMessageEvent.ptr1 == WM_TAKE_FOCUS) {
goto ProcessNextMessage;
}
}
goto ProcessNextMessage;
}
default: {
goto ProcessNextMessage;
}
}
return true;
}
开发者ID:nlhepler,项目名称:mono,代码行数:101,代码来源:XplatUIX11.cs
示例6: SetWindowMinMax
internal void SetWindowMinMax (IntPtr handle, Rectangle maximized, Size min, Size max, CreateParams cp)
{
Hwnd hwnd;
XSizeHints hints;
IntPtr dummy;
hwnd = Hwnd.ObjectFromHandle(handle);
if (hwnd == null) {
return;
}
min.Width = Math.Max (min.Width, SystemInformation.MinimumWindowSize.Width);
min.Height = Math.Max (min.Height, SystemInformation.MinimumWindowSize.Height);
hints = new XSizeHints();
XGetWMNormalHints(DisplayHandle, hwnd.whole_window, ref hints, out dummy);
if ((min != Size.Empty) && (min.Width > 0) && (min.Height > 0)) {
if (cp != null)
min = TranslateWindowSizeToXWindowSize (cp, min);
hints.flags = (IntPtr)((int)hints.flags | (int)XSizeHintsFlags.PMinSize);
hints.min_width = min.Width;
hints.min_height = min.Height;
}
if ((max != Size.Empty) && (max.Width > 0) && (max.Height > 0)) {
if (cp != null)
max = TranslateWindowSizeToXWindowSize (cp, max);
hints.flags = (IntPtr)((int)hints.flags | (int)XSizeHintsFlags.PMaxSize);
hints.max_width = max.Width;
hints.max_height = max.Height;
}
if (hints.flags != IntPtr.Zero) {
// The Metacity team has decided that they won't care about this when clicking the maximize icon,
// they will maximize the window to fill the screen/parent no matter what.
// http://bugzilla.ximian.com/show_bug.cgi?id=80021
XSetWMNormalHints(DisplayHandle, hwnd.whole_window, ref hints);
}
if ((maximized != Rectangle.Empty) && (maximized.Width > 0) && (maximized.Height > 0)) {
if (cp != null)
maximized.Size = TranslateWindowSizeToXWindowSize (cp);
hints.flags = (IntPtr)XSizeHintsFlags.PPosition;
hints.x = maximized.X;
hints.y = maximized.Y;
hints.width = maximized.Width;
hints.height = maximized.Height;
// Metacity does not seem to follow this constraint for maximized (zoomed) windows
XSetZoomHints(DisplayHandle, hwnd.whole_window, ref hints);
}
}
开发者ID:nlhepler,项目名称:mono,代码行数:53,代码来源:XplatUIX11.cs
示例7: SystrayAdd
public bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt)
{
IntPtr SystrayMgrWindow;
Xlib.XGrabServer (display);
SystrayMgrWindow = Xlib.XGetSelectionOwner (display, Atoms._NET_SYSTEM_TRAY_S);
Xlib.XUngrabServer (display);
if (SystrayMgrWindow != IntPtr.Zero) {
XSizeHints size_hints;
X11Hwnd hwnd;
hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(handle);
#if DriverDebug
Console.WriteLine("Adding Systray Whole:{0:X}, Client:{1:X}",
hwnd.WholeWindow.ToInt32(), hwnd.ClientWindow.ToInt32());
#endif
// Oh boy.
if (hwnd.ClientWindow != hwnd.WholeWindow) {
Xlib.XDestroyWindow (display, hwnd.ClientWindow);
hwnd.ClientWindow = hwnd.WholeWindow;
try {
hwnd.Queue.Lock ();
/* by virtue of the way the tests are ordered when determining if it's PAINT
or NCPAINT, ClientWindow == WholeWindow will always be PAINT. So, if we're
waiting on an nc_expose, drop it and remove the hwnd from the list (unless
there's a pending expose). */
hwnd.PendingNCExpose = false;
}
finally {
hwnd.Queue.Unlock ();
}
}
size_hints = new XSizeHints();
size_hints.flags = (IntPtr)(XSizeHintsFlags.PMinSize | XSizeHintsFlags.PMaxSize | XSizeHintsFlags.PBaseSize);
size_hints.min_width = 24;
size_hints.min_height = 24;
size_hints.max_width = 24;
size_hints.max_height = 24;
size_hints.base_width = 24;
size_hints.base_height = 24;
Xlib.XSetWMNormalHints (display, hwnd.WholeWindow, ref size_hints);
int[] atoms = new int[2];
atoms [0] = 1; // Version 1
atoms [1] = 1; // we want to be mapped
// This line cost me 3 days...
Xlib.XChangeProperty (display,
hwnd.WholeWindow, Atoms._XEMBED_INFO, Atoms._XEMBED_INFO, 32,
PropertyMode.Replace, atoms, 2);
// Need to pick some reasonable defaults
tt = new ToolTip();
tt.AutomaticDelay = 100;
tt.InitialDelay = 250;
tt.ReshowDelay = 250;
tt.ShowAlways = true;
if ((tip != null) && (tip != string.Empty)) {
tt.SetToolTip(Control.FromHandle(handle), tip);
tt.Active = true;
} else {
tt.Active = false;
}
SendNetClientMessage (SystrayMgrWindow,
Atoms._NET_SYSTEM_TRAY_OPCODE,
IntPtr.Zero,
(IntPtr)SystrayRequest.SYSTEM_TRAY_REQUEST_DOCK,
hwnd.WholeWindow);
return true;
}
tt = null;
return false;
}
开发者ID:BrzVlad,项目名称:mono,代码行数:85,代码来源:X11Display.cs
示例8: CreateWindow
//.........这里部分代码省略.........
hwnd.parent = Hwnd.ObjectFromHandle(cp.Parent);
hwnd.initial_style = cp.WindowStyle;
hwnd.initial_ex_style = cp.WindowExStyle;
if (StyleSet (cp.Style, WindowStyles.WS_DISABLED)) {
hwnd.enabled = false;
}
ClientWindow = IntPtr.Zero;
Size XWindowSize = TranslateWindowSizeToXWindowSize (cp);
Rectangle XClientRect = TranslateClientRectangleToXClientRectangle (hwnd, cp.control);
lock (XlibLock) {
WholeWindow = XCreateWindow(DisplayHandle, ParentHandle, X, Y, XWindowSize.Width, XWindowSize.Height, 0, (int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput, IntPtr.Zero, new UIntPtr ((uint)ValueMask), ref Attributes);
if (WholeWindow != IntPtr.Zero) {
ValueMask &= ~(SetWindowValuemask.OverrideRedirect | SetWindowValuemask.SaveUnder);
if (CustomVisual != IntPtr.Zero && CustomColormap != IntPtr.Zero) {
ValueMask = SetWindowValuemask.ColorMap;
Attributes.colormap = CustomColormap;
}
ClientWindow = XCreateWindow(DisplayHandle, WholeWindow, XClientRect.X, XClientRect.Y, XClientRect.Width, XClientRect.Height, 0, (int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput, CustomVisual, new UIntPtr ((uint)ValueMask), ref Attributes);
}
}
if ((WholeWindow == IntPtr.Zero) || (ClientWindow == IntPtr.Zero)) {
throw new Exception("Could not create X11 windows");
}
hwnd.Queue = ThreadQueue(Thread.CurrentThread);
hwnd.WholeWindow = WholeWindow;
hwnd.ClientWindow = ClientWindow;
DriverDebug("Created window {0:X} / {1:X} parent {2:X}, Style {3}, ExStyle {4}", ClientWindow.ToInt32(), WholeWindow.ToInt32(), hwnd.parent != null ? hwnd.parent.Handle.ToInt32() : 0, (WindowStyles)cp.Style, (WindowExStyles)cp.ExStyle);
if (!StyleSet (cp.Style, WindowStyles.WS_CHILD)) {
if ((X != unchecked((int)0x80000000)) && (Y != unchecked((int)0x80000000))) {
XSizeHints hints;
hints = new XSizeHints();
hints.x = X;
hints.y = Y;
hints.flags = (IntPtr)(XSizeHintsFlags.USPosition | XSizeHintsFlags.PPosition);
XSetWMNormalHints(DisplayHandle, WholeWindow, ref hints);
}
}
lock (XlibLock) {
XSelectInput(DisplayHandle, hwnd.whole_window, new IntPtr ((int)(SelectInputMask | EventMask.StructureNotifyMask | EventMask.PropertyChangeMask | Keyboard.KeyEventMask)));
if (hwnd.whole_window != hwnd.client_window)
XSelectInput(DisplayHandle, hwnd.client_window, new IntPtr ((int)(SelectInputMask | EventMask.StructureNotifyMask | Keyboard.KeyEventMask)));
}
if (ExStyleSet (cp.ExStyle, WindowExStyles.WS_EX_TOPMOST))
SetTopmost(hwnd.whole_window, true);
SetWMStyles(hwnd, cp);
// set the group leader
XWMHints wm_hints = new XWMHints ();
wm_hints.flags = (IntPtr)(XWMHintsFlags.InputHint | XWMHintsFlags.StateHint | XWMHintsFlags.WindowGroupHint);
wm_hints.input = !StyleSet (cp.Style, WindowStyles.WS_DISABLED);
wm_hints.initial_state = StyleSet (cp.Style, WindowStyles.WS_MINIMIZE) ? XInitialState.IconicState : XInitialState.NormalState;
if (ParentHandle != RootWindow) {
wm_hints.window_group = hwnd.whole_window;
} else {
wm_hints.window_group = ParentHandle;
}
lock (XlibLock) {
XSetWMHints(DisplayHandle, hwnd.whole_window, ref wm_hints );
}
if (StyleSet (cp.Style, WindowStyles.WS_MINIMIZE)) {
SetWindowState(hwnd.Handle, FormWindowState.Minimized);
} else if (StyleSet (cp.Style, WindowStyles.WS_MAXIMIZE)) {
SetWindowState(hwnd.Handle, FormWindowState.Maximized);
}
// for now make all windows dnd enabled
Dnd.SetAllowDrop (hwnd, true);
// Set caption/window title
Text(hwnd.Handle, cp.Caption);
SendMessage (hwnd.Handle, Msg.WM_CREATE, (IntPtr)1, IntPtr.Zero /* XXX unused */);
SendParentNotify (hwnd.Handle, Msg.WM_CREATE, int.MaxValue, int.MaxValue);
if (StyleSet (cp.Style, WindowStyles.WS_VISIBLE)) {
hwnd.visible = true;
MapWindow(hwnd, WindowType.Both);
if (!(Control.FromHandle(hwnd.Handle) is Form))
SendMessage(hwnd.Handle, Msg.WM_SHOWWINDOW, (IntPtr)1, IntPtr.Zero);
}
return hwnd.Handle;
}
开发者ID:nlhepler,项目名称:mono,代码行数:101,代码来源:XplatUIX11.cs
示例9: GetMessage
//.........这里部分代码省略.........
}
return true;
case XEventName.DestroyNotify:
// This is a bit tricky, we don't receive our own DestroyNotify, we only get those for our children
hwnd = (X11Hwnd)Hwnd.ObjectFromHandle(xevent.DestroyWindowEvent.window);
// We may get multiple for the same window, act only one the first (when Hwnd still knows about it)
if ((hwnd != null) && (hwnd.ClientWindow == xevent.DestroyWindowEvent.window)) {
CleanupCachedWindows (hwnd);
#if DriverDebugDestroy
Console.WriteLine("Received X11 Destroy Notification for {0}", XplatUI.Window(hwnd.ClientWindow));
#endif
msg.hwnd = hwnd.ClientWindow;
msg.message=Msg.WM_DESTROY;
hwnd.Dispose();
}
else
goto ProcessNextMessage;
return true;
case XEventName.ClientMessage:
if (Dnd.HandleClientMessage (ref xevent))
goto ProcessNextMessage;
if (xevent.ClientMessageEvent.message_type == Atoms.AsyncAtom) {
XplatUIDriverSupport.ExecuteClientMessage((GCHandle)xevent.ClientMessageEvent.ptr1);
goto ProcessNextMessage;
}
if (xevent.ClientMessageEvent.message_type == HoverState.Atom) {
msg.message = Msg.WM_MOUSEHOVER;
msg.wParam = GetMousewParam(0);
msg.lParam = (IntPtr) (xevent.ClientMessageEvent.ptr1);
return true;
}
if (xevent.ClientMessageEvent.message_type == Atoms.PostAtom) {
msg.hwnd = xevent.ClientMessageEvent.ptr1;
msg.message = (Msg) xevent.ClientMessageEvent.ptr2.ToInt32 ();
msg.wParam = xevent.ClientMessageEvent.ptr3;
msg.lParam = xevent.ClientMessageEvent.ptr4;
// if we posted a WM_QUIT message, make sure we return
// false here as well.
if (msg.message == (Msg)Msg.WM_QUIT)
return false;
else
return true;
}
if (xevent.ClientMessageEvent.message_type == Atoms._XEMBED) {
#if DriverDebugXEmbed
Console.WriteLine("GOT EMBED MESSAGE {0:X}, detail {1:X}",
xevent.ClientMessageEvent.ptr2.ToInt32(), xevent.ClientMessageEvent.ptr3.ToInt32());
#endif
if (xevent.ClientMessageEvent.ptr2.ToInt32() == (int)XEmbedMessage.EmbeddedNotify) {
XSizeHints hints = new XSizeHints();
IntPtr dummy;
Xlib.XGetWMNormalHints (display, hwnd.WholeWindow, ref hints, out dummy);
hwnd.width = hints.max_width;
hwnd.height = hints.max_height;
hwnd.ClientRect = Rectangle.Empty;
SendMessage(msg.hwnd, Msg.WM_WINDOWPOSCHANGED, IntPtr.Zero, IntPtr.Zero);
}
}
if (xevent.ClientMessageEvent.message_type == Atoms.WM_PROTOCOLS) {
if (xevent.ClientMessageEvent.ptr1 == Atoms.WM_DELETE_WINDOW) {
msg.message = Msg.WM_CLOSE;
return true;
}
// We should not get this, but I'll leave the code in case we need it in the future
if (xevent.ClientMessageEvent.ptr1 == Atoms.WM_TAKE_FOCUS) {
goto ProcessNextMessage;
}
}
goto ProcessNextMessage;
case XEventName.PropertyNotify:
// The Hwnd's themselves handle this
hwnd.PropertyChanged (xevent);
goto ProcessNextMessage;
}
} while (true);
msg.hwnd= IntPtr.Zero;
msg.message = Msg.WM_ENTERIDLE;
return true;
}
开发者ID:BrzVlad,项目名称:mono,代码行数:101,代码来源:X11Display.cs
示例10: SystrayAdd
internal override bool SystrayAdd (IntPtr handle, string tip, Icon icon, out ToolTip tt)
{
GetSystrayManagerWindow ();
if (SystrayMgrWindow != IntPtr.Zero) {
uint[] atoms;
XSizeHints size_hints;
Hwnd hwnd;
hwnd = Hwnd.ObjectFromHandle (handle);
#if DriverDebug
Console.WriteLine("Adding Systray Whole:{0:X}, Client:{1:X}", hwnd.whole_window.ToInt32(), hwnd.client_window.ToInt32());
#endif
XUnmapWindow (DisplayHandle, hwnd.whole_window);
XUnmapWindow (DisplayHandle, hwnd.client_window);
// Oh boy.
gdk_window_destroy (gdk_window_lookup (hwnd.client_window));
hwnd.client_window = hwnd.whole_window;
size_hints = new XSizeHints ();
size_hints.flags = (IntPtr)(XSizeHintsFlags.PMinSize | XSizeHintsFlags.PMaxSize | XSizeHintsFlags.PBaseSize);
size_hints.min_width = icon.Width;
size_hints.min_height = icon.Height;
size_hints.max_width = icon.Width;
size_hints.max_height = icon.Height;
size_hints.base_width = icon.Width;
size_hints.base_height = icon.Height;
XSetWMNormalHints (DisplayHandle, hwnd.whole_window, ref size_hints);
atoms = new uint [2];
atoms [0] = 1; // Version 1
atoms [1] = 0; // We're not mapped
// This line cost me 3 days...
XChangeProperty (DisplayHandle, hwnd.whole_window, NetAtoms [(int)NA._XEMBED_INFO], NetAtoms [(int)NA._XEMBED_INFO], 32, PropertyMode.Replace, atoms, 2);
// Need to pick some reasonable defaults
tt = new ToolTip ();
tt.AutomaticDelay = 100;
tt.InitialDelay = 250;
tt.ReshowDelay = 250;
tt.ShowAlways = true;
if ((tip != null) && (tip != string.Empty)) {
tt.SetToolTip (Control.FromHandle (handle), tip);
tt.Active = true;
} else {
tt.Active = false;
}
// Make sure the window exists
XSync (DisplayHandle, hwnd.whole_window);
SendNetClientMessage (SystrayMgrWindow, (IntPtr)NetAtoms [(int)NA._NET_SYSTEM_TRAY_OPCODE], IntPtr.Zero, (IntPtr)SystrayRequest.SYSTEM_TRAY_REQUEST_DOCK, hwnd.whole_window);
return true;
}
tt = null;
return false;
}
开发者ID:BrzVlad,项目名称:mono,代码行数:65,代码来源:XplatUIX11GTK.cs
示例11: SetWindowMinMax
internal override void SetWindowMinMax (IntPtr handle, Rectangle maximized, Size min, Size max)
{
Hwnd hwnd;
XSizeHints hints;
hwnd = Hwnd.ObjectFromHandle (handle);
if (hwnd == null) {
return;
}
hints = new XSizeHints ();
if (min != Size.Empty) {
hints.flags = (IntPtr)((int)hints.flags | (int)XSizeHintsFlags.PMinSize);
hints.min_width = min.Width;
hints.min_height = min.Height;
}
if (max != Size.Empty) {
hints.flags = (IntPtr)((int)hints.flags | (int)XSizeHintsFlags.PMaxSize);
hints.max_width = max.Width;
hints.max_height = max.Height;
}
XSetWMNormalHints (DisplayHandle, hwnd.whole_window, ref hints);
if (maximized != Rectangle.Empty) {
hints.flags = (IntPtr)XSizeHintsFlags.PPosition;
hints.x = maximized.X;
hints.y = maximized.Y;
hints.width = maximized.Width;
hints.height = maximized.Height;
// Metacity does not seem to follow this constraint for maximized (zoomed) windows
XSetZoomHints (DisplayHandle, hwnd.whole_window, ref hints);
}
}
开发者ID:BrzVlad,项目名称:mono,代码行数:37,代码来源:XplatUIX11GTK.cs
示例12: CreateWindow
public virtual void CreateWindow (CreateParams cp)
{
if (WholeWindow != IntPtr.Zero || ClientWindow != IntPtr.Zero)
throw new Exception ("createwindow called a second time on live X11Hwnd");
XSetWindowAttributes Attributes;
int x;
int y;
int width;
int height;
IntPtr ParentHandle;
SetWindowValuemask ValueMask;
Attributes = new XSetWindowAttributes();
x = cp.X;
y = cp.Y;
width = cp.Width;
height = cp.Height;
initial_ex_style = (WindowExStyles) cp.ExStyle;
/* Figure out our parent handle */
if (cp.Parent != IntPtr.Zero)
// the parent handle is specified in the CreateParams
ParentHandle = Hwnd.ObjectFromHandle(cp.Parent).ClientWindow;
else if (StyleSet (cp.Style, WindowStyles.WS_CHILD))
// a child control with an unassigned parent gets created under the FosterParent
ParentHandle = display.FosterParent.Handle;
else
// for all other cases, the parent is the root window
ParentHandle = display.RootWindow.Handle;
ValueMask = SetWindowValuemask.BitGravity | SetWindowValuemask.WinGravity;
Attributes.bit_gravity = Gravity.NorthWestGravity;
Attributes.win_gravity = Gravity.NorthWestGravity;
// Save what's under the toolwindow
if (ExStyleSet (cp.ExStyle, WindowExStyles.WS_EX_TOOLWINDOW)) {
Attributes.save_under = true;
ValueMask |= SetWindowValuemask.SaveUnder;
}
// If we're a popup without caption we override the WM
if (StyleSet (cp.Style, WindowStyles.WS_POPUP) && !StyleSet (cp.Style, WindowStyles.WS_CAPTION)) {
Attributes.override_redirect = true;
ValueMask |= SetWindowValuemask.OverrideRedirect;
}
// Default position on screen, if window manager doesn't place us somewhere else
if (!StyleSet (cp.Style, WindowStyles.WS_CHILD)
&& !StyleSet (cp.Style, WindowStyles.WS_POPUP)) {
if (x<0) x = 50;
if (y<0) y = 50;
}
// minimum width/height
if (width<1) width=1;
if (height<1) height=1;
X = x;
Y = y;
Width = width;
Height = height;
Parent = Hwnd.ObjectFromHandle (cp.Parent);
Enabled = !StyleSet (cp.Style, WindowStyles.WS_DISABLED);
ClientWindow = IntPtr.Zero;
WholeWindow = Xlib.XCreateWindow (display.Handle, ParentHandle,
X, Y, Width, Height, 0,
(int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput,
IntPtr.Zero, new UIntPtr ((uint)ValueMask), ref Attributes);
if (WholeWindow == IntPtr.Zero)
throw new Exception ("Coult not create X11 nc window");
ValueMask &= ~(SetWindowValuemask.OverrideRedirect | SetWindowValuemask.SaveUnder);
if (display.CustomVisual != IntPtr.Zero && display.CustomColormap != IntPtr.Zero) {
ValueMask |= SetWindowValuemask.ColorMap;
Attributes.colormap = display.CustomColormap;
}
ClientWindow = Xlib.XCreateWindow (display.Handle, WholeWindow,
ClientRect.X, ClientRect.Y, ClientRect.Width, ClientRect.Height, 0,
(int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput,
display.CustomVisual, new UIntPtr ((uint)ValueMask), ref Attributes);
if (ClientWindow == IntPtr.Zero)
throw new Exception("Could not create X11 client window");
#if DriverDebug || DriverDebugCreate
Console.WriteLine("Created window {0:X} / {1:X} parent {2:X}, Style {3}, ExStyle {4}", ClientWindow.ToInt32(), WholeWindow.ToInt32(), Parent != null ? Parent.Handle.ToInt32() : 0, (WindowStyles)cp.Style, (WindowExStyles)cp.ExStyle);
#endif
if (!StyleSet (cp.Style, WindowStyles.WS_CHILD)) {
if ((X != unchecked((int)0x80000000)) && (Y != unchecked((int)0x80000000))) {
XSizeHints hints;
hints = new XSizeHints();
hints.x = X;
//.........这里部分代码省略.........
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:101,代码来源:X11Hwnd.cs
示例13: SetMinMax
public void SetMinMax (Rectangle maximized, Size min, Size max)
{
XSizeHints hints;
IntPtr dummy;
hints = new XSizeHints();
Xlib.XGetWMNormalHints (display.Handle, WholeWindow, ref hints, out dummy);
if ((min != Size.Empty) && (min.Width > 0) && (min.Height > 0)) {
hints.flags = (IntPtr)((int)hints.flags | (int)XSizeHintsFlags.PMinSize);
hints.min_width = min.Width;
hints.min_height = min.Height;
}
if ((max != Size.Empty) && (max.Width > 0) && (max.Height > 0)) {
hints.flags = (IntPtr)((int)hints.flags | (int)XSizeHintsFlags.PMaxSize);
hints.max_width = max.Width;
hints.max_height = max.Height;
}
if (hints.flags != IntPtr.Zero)
Xlib.XSetWMNormalHints (display.Handle, WholeWindow, ref hints);
if ((maximized != Rectangle.Empty) && (maximized.Width > 0) && (maximized.Height > 0)) {
hints.flags = (IntPtr)XSizeHintsFlags.PPosition;
hints.x = maximized.X;
hints.y = maximized.Y;
hints.width = maximized.Width;
hints.height = maximized.Height;
// Metacity does not seem to follow this constraint for maximized (zoomed) windows
Xlib.XSetZoomHints (display.Handle, WholeWindow, ref hints);
}
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:34,代码来源:X11Hwnd.cs
注:本文中的System.Windows.Forms.XSizeHints类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论