about summary refs log tree commit diff stats
path: root/dwm.c
Commit message (Expand)AuthorAgeFilesLines
* Button passthrough when client is not focusedMarkus Teich2017-03-281-10/+11
* cleanupMarkus Teich2017-03-281-34/+30
* applied Markus' tagset purge of alternative view on _NET_ACTIVE_WINDOW eventAnselm R Garbe2016-12-051-20/+18
* applied Ivan Delalande's NET_SUPPORTING_WM_CHECK patch for gtk3 compatibilityAnselm R Garbe2016-12-051-2/+14
* applied Markus' decouple color-scheme patchAnselm R Garbe2016-12-051-5/+7
* applied Markus' clarify status text padding patchAnselm R Garbe2016-12-051-2/+2
* die() consistency: always add newlineHiltjo Posthuma2016-08-121-5/+5
* import new drw from libsl and minor fixes.Markus Teich2016-06-261-46/+39
* Configure geometry before applying rulesEric Pruitt2016-06-241-6/+7
* fix fullscreen clients not resized on X display resolution changeHiltjo Posthuma2015-12-191-1/+6
* code-style consistency 6.1Hiltjo Posthuma2015-11-081-433/+503
* unboolificationHiltjo Posthuma2015-11-081-71/+70
* sort include + whitespace fixHiltjo Posthuma2015-11-081-3/+3
* separate program-specific c99 bool and X11Hiltjo Posthuma2015-11-081-70/+72
* setfullscreen: don't process the property twiceQuentin Rameau2015-11-071-2/+2
* sync updated drw code from dmenuHiltjo Posthuma2015-10-201-4/+6
* dwm: use ecalloc, prevent theoretical overflowHiltjo Posthuma2015-10-201-6/+3
* cleanup, dont use c++ style commentsHiltjo Posthuma2015-10-201-4/+4
* dwm: cleanup: free schemes and cursors as arrayHiltjo Posthuma2015-10-201-9/+8
* Add Xft and follback-fonts support to graphics libEric Pruitt2015-03-131-10/+10
* applied Hiltjo's resize/move limitationAnselm R Garbe2014-08-111-2/+11
* same as before with dwm.c as wellAnselm R Garbe2014-05-291-1/+1
* applied Lukas' focus suggestion at startup, thanksAnselm R Garbe2013-08-271-0/+1
* applied improved version of Martti Kühne's dmenu/multi monitor approach from...Anselm R Garbe2013-08-021-0/+2
* applied Julian's enum approach,Anselm R Garbe2013-06-191-25/+24
* finished libsl/drw integrationAnselm R Garbe2013-06-161-183/+70
* renamed draw into drwAnselm R Garbe2013-04-171-1/+1
* continued with draw.c abstraction, also started util.{h,c} implementation, th...Anselm R Garbe2012-12-081-13/+1
* reverting the xkb dependency, I don't care if this function is deprecated, it...anselm@garbe.us2012-11-181-9/+2
* reverting to plain X11 fonts in order to implement draw.c defaultanselm@garbe.us2012-11-181-36/+66
* compile fixanselm@garbe.us2012-11-171-2/+2
* applied Neil Klopfstein's patch, slightly modifiedanselm@garbe.us2012-11-171-2/+8
* starting with initial draw.hanselm@garbe.us2012-11-171-0/+2
* incorporating Xft instead of cairo, cairo provides far too many optionsanselm@garbe.us2012-11-021-66/+36
* reverted to old updategeom() after several complains, we need to optimize the...anselm@garbe.us2012-07-081-53/+70
* applied James Turner's XkbKeycodeToKeysym patch, thanksanselm@garbe.us2012-06-231-1/+2
* drastically changed updategeom() handling, see comment in updategeom() for de...anselm@garbe.us2012-06-231-70/+53
* reversed Andreas Amann's fullscreen fix with the approach proposed by Gary La...anselm@garbe.us2012-06-231-11/+10
* added kludge to fix some input focus misbehavior in gedit and anjuta, thanks ...anselm@garbe.us2012-04-151-1/+2
* applied Andreas Amanns' netwm_client_list patch, but with some indentation fixesanselm@garbe.us2012-03-251-1/+20
* applied Andreas Amann's netwm_active_window patch, thxanselm@garbe.us2012-03-251-3/+12
* applied Andreas Amann fullscreen fix, some minor modificationsanselm@garbe.us2012-03-171-3/+10
* unfocus on slow sloppy monitor focusConnor Lane Smith2012-02-101-0/+1
* applied Eckehard Berns fix fix, sorry that this took so longanselm@garbe.us2012-02-081-3/+5
* applied Eckehard Berns barwin leak fix and his suggestion to deal with restac...anselm@garbe.us2012-01-121-3/+3
* add sloppy monitor focusConnor Lane Smith2011-11-151-3/+19
* calculate window/monitor intersectionConnor Lane Smith2011-11-061-15/+19
* honour fullscreen hint on mapConnor Lane Smith2011-11-061-56/+66
* testing Brians multiscreen issue fixanselm@garbe.us2011-11-041-9/+9
* make ewmh dialog windows floatChristoph Lohmann2011-11-021-1/+27
t: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//: Automatically aggregate functions starting with 'test-' into a test suite
//: called 'run-tests'. Running this function will run all tests.
//:
//: This is actually SubX's first (trivial) compiler. We generate all the code
//: needed for the 'run-tests' function.
//:
//: By convention, temporary functions needed by tests will start with
//: '_test-'.

//: We don't rely on any transforms running in previous layers, but this layer
//: knows about labels and will emit labels for previous layers to transform.
:(after "Begin Transforms")
// Begin Level-4 Transforms
Transform.push_back(create_test_function);
// End Level-4 Transforms

:(code)
void test_run_test() {
  Reg[ESP].u = 0x100;
  run(
      "== 0x1\n"  // code segment
      "main:\n"
      "  e8/call run-tests/disp32\n"  // 5 bytes
      "  f4/halt\n"                   // 1 byte
      "test-foo:\n"  // offset 7
      "  01 d8\n"  // just some unique instruction: add EBX to EAX
      "  c3/return\n"
  );
  // check that code in test-foo ran (implicitly called by run-tests)
  CHECK_TRACE_CONTENTS(
      "run: 0x00000007 opcode: 01\n"
  );
}

void create_test_function(program& p) {
  if (p.segments.empty()) return;
  segment& code = p.segments.at(0);
  trace(3, "transform") << "-- create 'run-tests'" << end();
  vector<line> new_insts;
  for (int i = 0;  i < SIZE(code.lines);  ++i) {
    line& inst = code.lines.at(i);
    for (int j = 0;  j < SIZE(inst.words);  ++j) {
      const word& curr = inst.words.at(j);
      if (*curr.data.rbegin() != ':') continue;  // not a label
      if (!starts_with(curr.data, "test-")) continue;
      string fn = drop_last(curr.data);
      new_insts.push_back(call(fn));
    }
  }
  if (new_insts.empty()) return;  // no tests found
  code.lines.push_back(label("run-tests"));
  code.lines.insert(code.lines.end(), new_insts.begin(), new_insts.end());
  code.lines.push_back(ret());
}

string to_string(const segment& s) {
  ostringstream out;
  for (int i = 0;  i < SIZE(s.lines);  ++i) {
    const line& l = s.lines.at(i);
    for (int j = 0;  j < SIZE(l.words);  ++j) {
      if (j > 0) out << ' ';
      out << to_string(l.words.at(j));
    }
    out << '\n';
  }
  return out.str();
}

line call(string s) {
  line result;
  result.words.push_back(call());
  result.words.push_back(disp32(s));
  return result;
}

word call() {
  word result;
  result.data = "e8";
  result.metadata.push_back("call");
  return result;
}

word disp32(string s) {
  word result;
  result.data = s;
  result.metadata.push_back("disp32");
  return result;
}

line ret() {
  line result;
  result.words.push_back(word());
  result.words.back().data = "c3";
  result.words.back().metadata.push_back("return");
  return result;
}