コード例 #1
0
ファイル: Window.cs プロジェクト: jbnivoit/projects
  /**
   * @see #wm_protocols()
   */
  public bool wm_protocol (String name) {
    Atom protocol = (Atom) Atom.intern (display, name);
    Enum list = wm_protocols ();

    while (list.more ())
      if (list.next4 () == protocol.id) return true;

    return false;
  }
コード例 #2
0
ファイル: Salt.cs プロジェクト: jbnivoit/projects
        public Salt(String [] args)
            : base(args)
        {
            String res_name  = option.option("res-name", "resource name of windows", "");
            String res_class = option.option("res-class", "resource class of windows", "");
            String message   = option.option("message", "message to be sent", "");

            about("0.1", "send string to top-level windows",
                  "Stephen Tse <*****@*****.**>",
                  "http://escher.sourceforge.net/");

            if (help_option)
            {
                return;
            }

            for (gnu.x11.Enum e = display.default_root.tree().children();
                 e.more();)
            {
                Window             window     = (Window)e.next();
                Window.WMClassHint class_hint = window.wm_class_hint();

                if (class_hint == null)
                {
                    continue;
                }
                if (!class_hint.Equals(res_name, res_class))
                {
                    continue;
                }

                if (window.attributes().override_redirect() ||
                    window.attributes().map_state()
                    != Window.AttributesReply.VIEWABLE ||
                    window.wm_name() == null)
                {
                    continue;
                }


                for (int i = 0; i < message.Length; i++)
                {
                    send_key(window, message[i]);
                }

                // keep loop to salt all matched apps
            }

            display.close();
        }