/** Utility method to get the native window ID for a Java {@link Window} * as a <code>long</code> value. * This method is primarily for X11-based systems, which use an opaque * <code>XID</code> (usually <code>long int</code>) to identify windows. * @throws HeadlessException if the current VM is running headless */ public static long getWindowID(Window w) throws HeadlessException { return getComponentID(w); }
private static X11.Window getDrawable(Component w) { int id = (int)Native.getComponentID(w); if (id == X11.None) return null; return new X11.Window(id); }
private static X11.Window getDrawable(Component w) { int id = (int)Native.getComponentID(w); if (id == X11.None) return null; return new X11.Window(id); }
/** Utility method to get the native window pointer for a heavyweight Java * {@link Component} as a {@link Pointer} value. This method is primarily * for w32, which uses the <code>HANDLE</code> type (actually * <code>void *</code>) to identify windows. * @throws HeadlessException if the current VM is running headless */ public static Pointer getComponentPointer(Component c) throws HeadlessException { return new Pointer(getComponentID(c)); }
componentId = Native.getComponentID(component); if (componentId != 0) { return componentId;
private long getComponentId(Component component) { if (!RuntimeUtil.isMac()) { return Native.getComponentID(component); } else { return OsxComponentId.getOsxComponentId(component); } }
/** * Sets the native window for the {@link Element} to use to display video. * * @param window A native window to use to display video, or <tt>null</tt> to * stop using the previously set window. * @deprecated use {@link org.gstreamer.swing.XOverlaySwing#setWindowHandle(java.awt.Component)} instead */ @Deprecated public void setWindowHandle(java.awt.Component window) { if (window == null) { setWindowHandle(0); return; } if (window.isLightweight()) throw new IllegalArgumentException("Component must be a native window"); if (Platform.isWindows()) GSTXOVERLAY_API.gst_x_overlay_set_window_handle(this, Native.getComponentPointer(window)); else setWindowHandle(Native.getComponentID(window)); }
/** * Sets the native window for the {@link Element} to use to display video. * * @param window A native window to use to display video, or <tt>null</tt> to * stop using the previously set window. */ public void setWindowHandle(java.awt.Component window) { long nativeWindow = 0; if (window != null) { if (window.isLightweight()) { throw new IllegalArgumentException("Component must be a native window"); } if (Platform.isWindows()) { nativeWindow = Pointer.nativeValue(Native.getComponentPointer(window)); } else { nativeWindow = Native.getComponentID(window); } } setWindowHandle(nativeWindow); } }
/** * Sets the native window for the {@link Element} to use to display video. * * @param window A native window to use to display video, or <tt>null</tt> to * stop using the previously set window. */ public void setWindowHandle(java.awt.Component window) { if (window == null) { setWindowHandle(0); return; } if (window.isLightweight()) throw new IllegalArgumentException("Component must be a native window"); if (Platform.isWindows()) GSTVIDEOOVERLAY_API.gst_video_overlay_set_window_handle(this, Native.getComponentPointer(window)); else setWindowHandle(Native.getComponentID(window)); }
/** * Sets the native window for the {@link Element} to use to display video. * * @param window A native window to use to display video, or <tt>null</tt> to * stop using the previously set window. */ public void setWindowHandle(java.awt.Component window) { if (window == null) { setWindowHandle(0); return; } if (window.isLightweight()) throw new IllegalArgumentException("Component must be a native window"); if (Platform.isWindows()) GSTXOVERLAY_API.gst_x_overlay_set_window_handle(this, Native.getComponentPointer(window)); else setWindowHandle(Native.getComponentID(window)); }
int videoSurfaceComponentId = (int)Native.getComponentID(canvas);
/** * Set the full-screen state of the window. * * @param fullScreen <code>true</code> to set full-screen; <code>false</code> to exit full-screen */ void setFullScreen(boolean fullScreen) { HWND hWnd = getHWND(Native.getComponentID(window)); if (fullScreen) { windowState = getWindowState(hWnd); ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_STYLE, windowState.getStyle() & ~(WS_CAPTION | WS_THICKFRAME)); ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_EXSTYLE, windowState.getExStyle() & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); MONITORINFO monitorInfo = getMonitorInfo(hWnd); RECT rect = monitorInfo.rcMonitor; ExtendedUser32.INSTANCE.SetWindowPos(hWnd, null, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); } else { ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_STYLE, windowState.getStyle()); ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_EXSTYLE, windowState.getExStyle()); ExtendedUser32.INSTANCE.SetWindowPos(hWnd, null, windowState.getLeft(), windowState.getTop(), windowState.getRight() - windowState.getLeft(), windowState.getBottom() - windowState.getTop(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); if (windowState.getMaximized()) { ExtendedUser32.INSTANCE.SendMessage(hWnd, User32.WM_SYSCOMMAND, new WPARAM(WinUser.SC_MAXIMIZE), new LPARAM(0)); } } }