当前位置: 首页>>代码示例>>Java>>正文


Java X11.Window方法代码示例

本文整理汇总了Java中com.sun.jna.platform.unix.X11.Window方法的典型用法代码示例。如果您正苦于以下问题:Java X11.Window方法的具体用法?Java X11.Window怎么用?Java X11.Window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jna.platform.unix.X11的用法示例。


在下文中一共展示了X11.Window方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSystemIdleTime

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
@Override
public long getSystemIdleTime () {
	X11.Window window = null;
	XScreenSaverInfo info = null;
	Display display = null;

	long idleMillis = 0L;
	try {
		display = X11.INSTANCE.XOpenDisplay(null);
		window = X11.INSTANCE.XDefaultRootWindow(display);
		info = new XScreenSaverInfo();
		Xss.INSTANCE.XScreenSaverQueryInfo(display, window, info);
		idleMillis = info.idle.longValue();
	} finally {
		info = null;

		if (display != null) X11.INSTANCE.XCloseDisplay(display);
		display = null;
	}
	return idleMillis;
}
 
开发者ID:kotcrab,项目名称:arget,代码行数:22,代码来源:X11LinuxIdleTimeCounter.java

示例2: getWindows

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns all windows managed by the window manager.
 * 
 * @return all windows managed by the window manager
 * @throws X11Exception thrown if X11 window errors occurred
 */
public Window[] getWindows() throws X11Exception {
  byte[] bytes;
  Window rootWindow = getRootWindow();

  try {
    bytes = rootWindow.getProperty(X11.XA_WINDOW, "_NET_CLIENT_LIST");
  } catch (X11Exception e) {
    try {
      bytes = rootWindow.getProperty(X11.XA_CARDINAL, "_WIN_CLIENT_LIST");
    } catch (X11Exception e1) {
      throw new X11Exception("Cannot get client list properties (_NET_CLIENT_LIST or _WIN_CLIENT_LIST)");
    }
  }

  Window[] windowList = new Window[bytes.length / X11.Window.SIZE];

  for (int i = 0; i < windowList.length; i++) {
    windowList[i] = new Window(this, new X11.Window(bytesToInt(bytes, X11.XID.SIZE * i)));
  }

  return windowList;
}
 
开发者ID:xwizard,项目名称:1de,代码行数:29,代码来源:X.java

示例3: getIdleTimeMillis

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
@Override
public long getIdleTimeMillis()
{
	X11.Window window = null;
	XScreenSaverInfo info = null;
	Display display = null;

	long idleMillis = 0L;
	try
	{
		display = X11.INSTANCE.XOpenDisplay(null);
		if (display == null) {
			display = X11.INSTANCE.XOpenDisplay(":0.0");
		}
		if (display == null) {
			throw new RuntimeException("Could not find a display, please setup your DISPLAY environment variable");
		}
		window = X11.INSTANCE.XDefaultRootWindow(display);
		info = new XScreenSaverInfo();
		Xss.INSTANCE.XScreenSaverQueryInfo(display, window, info);
		idleMillis = info.idle.longValue();
	}
	catch(UnsatisfiedLinkError e)
	{
		throw new RuntimeException(e.getMessage(), e);
	}
	finally
	{
		info = null;
		if (display != null) {
			X11.INSTANCE.XCloseDisplay(display);
		}
		display = null;
	}
	return idleMillis;
}
 
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:37,代码来源:X11IdleTimeDetector.java

示例4: getX11Window

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the X11 window object.
 * 
 * @return X11 window
 */
public X11.Window getX11Window() {
  return x11Window;
}
 
开发者ID:xwizard,项目名称:1de,代码行数:9,代码来源:X.java

示例5: Window

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Creates the window.
 * 
 * @param display display where the window is allocated
 * @param x11Window X11 window
 */
public Window(X.Display display, X11.Window x11Window) {
  this.display = display;
  this.x11Window = x11Window;
}
 
开发者ID:xwizard,项目名称:1de,代码行数:11,代码来源:X.java

示例6: getWindowProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as window.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as window
 * @throws X11Exception thrown if X11 window errors occurred
 */
public Window getWindowProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
  int windowId = getIntProperty(xa_prop_type, xa_prop_name);
  X11.Window x11Window = new X11.Window(windowId);
  return new Window(display, x11Window);
}
 
开发者ID:xwizard,项目名称:1de,代码行数:14,代码来源:X.java


注:本文中的com.sun.jna.platform.unix.X11.Window方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。