Just some notes.  Fun stuff if you don't know about this yet.

But a note about X Window lists first.
   I didn't include the demo code because it LOOKS more dangerous than
   it is.  The thing is, you can send (at least KDE) to the BOTTOM of a
   window list which will remove all your taskbar stuff, and docked
   windows, leaving you with a full image of the desktop.  And this
   situation persists until you can change focus.  I can do this
   easily, but someone with a different setup might not be able to find
   a window to focus on, though I'd think clicking in the upper left
   corner might do the trick because I've noticed that there are
   several windows there, that are only 1 x 1 pixel !!


So let's start with the scary one. Then some minor toys to play with follow.

*/// //////////////////////////////////////////////////
/// X Window lists.

// How do I get a list of windows that I can use to set
// zorder with?

}//
...
 Window root = RootWindow (display, screen);
 Window dummywindow;
 Window *children;
 unsigned int nchildren, i;
 XWindowAttributes attr;
 nchildren = nTopWindows = 0;
XQueryTree (fl_display, root, &dummywindow, &dummywindow, &children, &nchildren);
 for (i = 0; i < nchildren; i++)
 {
   if (XGetWindowAttributes(fl_display, children[i], &attr) &&
       (attr.map_state == IsViewable))
   {
     Window aTopWindow = children[i];
     // do something with aTopWindow, maybe add to a list.
     nTopWindows ++;
   }
 }
 XFree(children);
 // do something with nTopWindows or copied list of top windows.

}//

/// //////////////////////////////////////////////////
/// key bindings can be used to manipulate a text
/// edit widget.  The bindings are listed in
/// Fl_Text_Edit.cxx and the parameter 'c' will be
/// the control/shift or whatever mask.

Example:
}//

// Adds functions to an already existing Fl_Text_Editor widget so it's fluid- // compatible. Init with aClass(objName); where 'objName' is a Text_Editor named
// in fluid.

class aClass
{
 public:
   aClass(Fl_Text_Editor* text_editor);
   void append(char* s);
Fl_Text_Editor* te;
};

aClass::aClass(Fl_Text_Editor* text_editor)
{
 // must be done after make_window runs so the object
 // really exists...
 te = text_editor;
}

void aClass::append(char* s)
{ // in order to make sure we're at the end of the buffer we
 // precede appending with a call to simulate ctrl-end and
 // to make sure it's visible after appending, we ctrl-end
 // again afterward.

 Fl_Text_Editor::kf_ctrl_move(FL_End, te);
 te->buffer()->append(s);
 Fl_Text_Editor::kf_ctrl_move(FL_End, te);
return; }
/// //////////////////////////////////////////////////
/// No hang on exit(0)

// Under some circumstances (creating objects on the
// fly?) the window may not be able to close on its
// own.  If this is a problem in an application...

 #include <signal.h> // SIGKILL
 #include <stdlib.h> // exit();
 // not sure where getpid() comes from.  maybe <unistd.h>

 void cbQuit(Fl_Button* b, void* params)
 {
   kill(SIGKILL, getpid());
   exit(0);
 }
*
I haven't checked if this leaves memory leaks or anything but it does clean 'em out of the process table (like xkill or ksysguard or gnome-system-monitor).


_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to