Skip to content

Commit

Permalink
Can draw xpm pixmaps with spaces in the color names (such as the ones in
Browse files Browse the repository at this point in the history
/usr/X11/include/X11/icons).
Esc closes the modal window, not the window the cursor is in, if a modal
window is up.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@632 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
spitzak committed Jul 27, 1999
1 parent df045b0 commit f7e0e76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
7 changes: 4 additions & 3 deletions src/Fl.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl.cxx,v 1.24.2.10 1999/07/22 21:37:03 bill Exp $"
// "$Id: Fl.cxx,v 1.24.2.11 1999/07/27 17:24:13 bill Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -508,7 +508,8 @@ int Fl::handle(int event, Fl_Window* window)

// make Escape key close windows:
if (event_key()==FL_Escape) {
window->do_callback();
w = modal(); if (!w) w = window;
w->do_callback();
return 1;
}

Expand Down Expand Up @@ -694,5 +695,5 @@ int fl_old_shortcut(const char* s) {
}

//
// End of "$Id: Fl.cxx,v 1.24.2.10 1999/07/22 21:37:03 bill Exp $".
// End of "$Id: Fl.cxx,v 1.24.2.11 1999/07/27 17:24:13 bill Exp $".
//
11 changes: 4 additions & 7 deletions src/fl_draw_pixmap.cxx
@@ -1,5 +1,5 @@
//
// "$Id: fl_draw_pixmap.cxx,v 1.4 1999/01/07 19:17:38 mike Exp $"
// "$Id: fl_draw_pixmap.cxx,v 1.4.2.1 1999/07/27 17:24:13 bill Exp $"
//
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -181,9 +181,6 @@ int fl_draw_pixmap(/*const*/char*const* data, int x, int y, Fl_Color bg) {
previous_word = p;
while (*p && !isspace(*p)) p++;
}
// copy the color name and look it up:
char name[256];
char *q; for (q = name; *p && !isspace(*p); *q++ = *p++); *q++ = 0;
uchar *c = (uchar *)&d.colors[index&255];
#ifdef U64
*(U64*)c = 0;
Expand All @@ -192,10 +189,10 @@ int fl_draw_pixmap(/*const*/char*const* data, int x, int y, Fl_Color bg) {
#endif
#endif
#ifdef WIN32
if (fl_parse_color(name, c[0], c[1], c[2])) {;
if (fl_parse_color(p, c[0], c[1], c[2])) {;
#else
XColor x;
if (XParseColor(fl_display, fl_colormap, name, &x)) {
if (XParseColor(fl_display, fl_colormap, p, &x)) {
c[0] = x.red>>8; c[1] = x.green>>8; c[2] = x.blue>>8;
#endif
} else { // assumme "None" or "#transparent" for any errors
Expand Down Expand Up @@ -244,5 +241,5 @@ int fl_draw_pixmap(/*const*/char*const* data, int x, int y, Fl_Color bg) {
}

//
// End of "$Id: fl_draw_pixmap.cxx,v 1.4 1999/01/07 19:17:38 mike Exp $".
// End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.1 1999/07/27 17:24:13 bill Exp $".
//
11 changes: 6 additions & 5 deletions test/pixmap_browser.cxx
@@ -1,5 +1,5 @@
//
// "$Id: pixmap_browser.cxx,v 1.5 1999/01/07 19:18:00 mike Exp $"
// "$Id: pixmap_browser.cxx,v 1.5.2.1 1999/07/27 17:24:14 bill Exp $"
//
// Another pixmap test program for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -61,16 +61,17 @@ int load_file(const char *name) {
if (data) {
for (int i=numlines; i--;) delete[] data[i];
}
char buffer[1024];
#define BUFSIZE 2048
char buffer[BUFSIZE];
int i = 0;
while (fgets(buffer,1024,f)) {
while (fgets(buffer, BUFSIZE, f)) {
if (buffer[0] != '\"') continue;
char *p = buffer;
char *q = buffer+1;
while (*q != '\"') {
if (*q == '\\') switch (*++q) {
case '\n':
fgets(q,(buffer+1024)-q,f); break;
fgets(q,(buffer+BUFSIZE)-q,f); break;
case 0:
break;
case 'x': {
Expand Down Expand Up @@ -164,5 +165,5 @@ int main(int argc, char **argv) {
}

//
// End of "$Id: pixmap_browser.cxx,v 1.5 1999/01/07 19:18:00 mike Exp $".
// End of "$Id: pixmap_browser.cxx,v 1.5.2.1 1999/07/27 17:24:14 bill Exp $".
//

0 comments on commit f7e0e76

Please sign in to comment.