Ejemplo n.º 1
0
Archivo: main.c Proyecto: bartman/wmii
int
main(int argc, char *argv[]) {
	char *s;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;

	setlocale(LC_CTYPE, "");

	initdisplay();

	s = ARGF();
	if(s && !getulong(s, &win.w))
		usage();
	if (!s)
		win.w = getfocus();

	if(argc)
		usage();

	click(&win, Pt(1, 1));

	XCloseDisplay(display);
	return 0;
}
Ejemplo n.º 2
0
// ---------------------------------------------------------------------
void Form::signalevent(Child *c, QKeyEvent *e)
{
  if (NoEvents || closed) return;
  string ctype="";
  string loc = locale;
  evtform=this;
  if (c) {
    ctype=c->type;
    evtchild=c;
    c->setform();
    sysmodifiers=c->sysmodifiers;
    if (sysmodifiers.empty())
      sysmodifiers=getsysmodifiers();
    sysdata=c->sysdata;
    loc = (""!=c->locale)?c->locale:locale;
  } else {
    evtchild=0;
    if (event=="fkey") {
      int k=e->key();
      if ((e->modifiers() & Qt::ControlModifier) && k>=Qt::Key_A && k<=Qt::Key_Z) {
        fakeid=(char)e->key()+32;  // lower case
        fakeid=fakeid + "ctrl" + string( (e->modifiers() & Qt::ShiftModifier) ? "shift" : "" );
      } else if ((e->modifiers() & Qt::ControlModifier) && k>=Qt::Key_0 && k<=Qt::Key_9) {
        fakeid=(char)e->key();  // turn to string
        fakeid=fakeid + "ctrl" + string( (e->modifiers() & Qt::ShiftModifier) ? "shift" : "" );
      } else if ((e->modifiers() & Qt::ControlModifier) && k>=Qt::Key_Home && k<=Qt::Key_PageDown) {
        string keynames[] = {"home", "end", "left", "up", "right", "down", "pgup", "pgdn"} ;
        fakeid=keynames[e->key()-Qt::Key_Home];  // select event name
        fakeid=fakeid + "ctrl" + string( (e->modifiers() & Qt::ShiftModifier) ? "shift" : "" );
      } else if (k>=Qt::Key_F1 && k<=Qt::Key_F35) {
        ostringstream ostr;
        ostr << e->key()+1-Qt::Key_F1;
        fakeid="f"+ ostr.str() + string((e->modifiers() & Qt::ControlModifier) ? "ctrl" : "") + string((e->modifiers() & Qt::ShiftModifier) ? "shift" : "");
      }
    }
  }
  string fc=getfocus();
  if (fc.size()) lastfocus=fc;

  string cmd=("wdhandlerx_jqtide_ '" + loc + "'") + '\0' + evtform->state(1);
  // paint events in isigraph/opengl have priority, because all the graphics must
  // be drawn WHILE THE Qt PAINT EVENT IS ACTIVE, and not wait for the callback
  //  queue to be scheduled.
  bool  b=(ctype=="isigraph" || ctype=="opengl") && c->event=="paint";
  if (b)
    jcon->cmddop(cmd);
  else
    jcon->cmddo(cmd);
}
Ejemplo n.º 3
0
bool draw::dodialog(int id) {
	auto temp_execute = current_execute;
	current_execute = 0;
	if(temp_execute) {
		temp_execute();
		return true;
	}
	switch(id) {
	case KeyTab:
	case KeyTab | Shift:
	case KeyTab | Ctrl:
	case KeyTab | Ctrl | Shift:
		id = getnext(getfocus(), id);
		if(id)
			setfocus(id, true);
		return true;
	}
	return false;
}
Ejemplo n.º 4
0
// ---------------------------------------------------------------------
string Form::state(int evt)
{
  string c,c1,e,r,s,ec;

  if (evt) {
    if (evtchild) {
      c=evtchild->eid;
      e=evtchild->event;
      ec=evtchild->locale;
    } else {
      c=fakeid;
      e=event;
    }
    c1=(c.empty()) ? string("") : (c+"_") ;
    r+=spair("syshandler",id+"_handler");
    r+=spair("sysevent",id+"_"+c1+e);
    r+=spair("sysdefault",id+"_default");
    r+=spair("sysparent",id);
    r+=spair("syschild",c);
    r+=spair("systype",e);
    r+=spair("syslocalec",ec);
  }

  // need only syslocale (not syslocalep, syslocalec)?...  in isigraph
  r+=spair("syslocalep",locale);
  r+=spair("syshwndp",hsform());
  r+=spair("syshwndc",hschild());
  r+=spair("syslastfocus",lastfocus);
  r+=spair("sysfocus",getfocus());
  r+=spair("sysmodifiers",sysmodifiers);
  r+=spair("sysdata",sysdata);

  for (int i=0; i<children.size(); i++)
    s+=children.at(i)->state();

  return r+s;
}