Hi again!

> 
> > Is 8 bytes right, not 8 bits?
> 
> Umm - I see my notation is unclear. I'll better put it in words:
> 
> You divide pixelformat->size, which is in bits, by eight, what gives you the
> step size in bytes.

Yea, yea I know what you mean.
 
> Unless you have <8 BPP (yes, S3 cards do have a linear 4-bit mode), that 
> should always result in a whole integer.

No, I haven't

> > If I'm at the last pixel of a row, the jump should be only the size of one
> > pixel, or pixelPointer++ to get to the first pixel of the next row. 
> 
> Yes, but only, if there is no padding. The graphics hardware may (for whatever
> reason) decide to set a frame with a larger xvirtual and even that might not
> correspond to the framebuffer layout, as there might be extra padding
> areas that may not be used in each line. IIRC the MediaGX chipset does this
> to gain alignment advantages and use less bandwidth by having precalculated
> "compressed" lines in the extra space.

But 

        pixelPointer += stride - mode.virt.x;

should work for all cards?

> That's strange. However there was a SEGV problem with ggiClose for quite 
> some time. I hope the latest Changes by Marcus fixed that. Please try with
> a recent snapshot.

My ggilib is from february or so, didn't want to build a new ggi lib. But
yes, I'll take the time and get me the new one.
 
> > I'd like to change the mouse pointer pixmap, how can I do that with ggi?
> 
> ? GGI has no notion of a mouse-pointer. If you want one, you got to generate 
> it yourself.

mouse pointer, this image that traveles around the screen, when the mouse
is moved. When I run a ggi programm I get only a white pixel that moves.
If I'm not totatly wrong I remember that I've read some where that the
graphic cards have extra suport for cursors/mouse pointers. As this would
be a hardware feature I expected to gain control with a ggi function. So
there is no

XCreatePixmapCursor
XDefineCursor
XFreeCursor

for ggi?

But if ggi doesn't control the cursor appearance, who decides that in my
ggi apps only a whit dot is drawn?

> It sets a rectangle that limits the area that is drawn to. This is interesting 
> when drawing into divided regions like "windows" or "Cockpits" with
> routines that do not necessarily care about giving proper coordinates.
> 
> It will inhibit any drawing outside the clipping region. Note, that
> Directbuffer access can usually bypass this mechanism.

I did some testruns yesterday, nice!

> >   while ( 1 )
> >     {
> >       if ( ( eventMask = ggiEventPoll( visual, emPtrButton | emKeyPress,
> > &theTimer ) ) < 0 )
> >     {
> >       fail( "Error in event poll\n" );
> >     }
> 
> > Why do I still get events when neither a key nor a mouse button was
> > pressed???
> 
> What kind of events do you get ?

I got emZero's. Strange that this disapeared when I recompiled it.
I want the application to wait for either a mousbutton event or a 
keyboard key press event. 
I'm not interested in the pointer movement events. 
Therefore is set:

  if( ggiSetEventMask( visual, emPtrButton | emKeyPress ) != 0 )
    {
      fail( "Couldn't set event mask\n" );
    }

after this I have the main loop that should do something if a mouse 
button was pressed or should break the loop if a key was pressed;

It looks like this:

  while ( 1 )
    {
      if ( ( eventMask = ggiEventPoll( visual, emPtrButton | emKeyPress, NULL ) ) < 0 )
        {
          fail( "Error in event poll\n" );
        }

      if ( ggiEventRead( visual, &theEvent, emAll ) == 0 )
        {
          fail( "Error in reading new event!\n" );
        }

      if ( eventMask == emKeyPress )
        {
          break;
        }

      if ( eventMask != emPtrButtonPress )
        {
          //should not happen
          continue;
        }

        .. do some stuff
    }

running the application showed that if a mouse button was pressed and released
 one time, lots of events were received by EventPoll; looking at 

theEvent.any.type

showed that there were lots of pointer movement events. But I didn't want
 them, I set the event mask so that it shouldn't receive other events 
than I want. 
Using gdb and looking at 

theEvent.pmove.x/y

showed that I seam to get all queued pointer positions befor and after the
 mouse press event for the time sequenz where the pointer was in the
window ( I'm using the X target).

I therefore altered the loop so that it reads all similar events out of the
 queue:

  gii_event_type theEventType;

  ...

  while ( 1 )
    {
      if ( ( eventMask = ggiEventPoll( visual, emPtrButton | emKeyPress, NULL ) ) < 0 )
        {
          fail( "Error in event poll\n" );
        }

      if ( ggiEventRead( visual, &theEvent, emAll ) == 0 )
        {
          fail( "Error in reading new event!\n" );
        }
      theEventType = theEvent.any.type;

      while( ggiEventsQueued( visual, emAll ) != 0 )
        {
          if ( ggiEventRead( visual, &theEvent, emAll ) == 0 )
            {
              fail( "Error in reading new event!\n" );
            }
          if ( theEvent.any.type != theEventType )
            {
              break;
            }
        }

      if ( eventMask == emKeyPress )
        {
          break;
        }

      if ( eventMask != emPtrButtonPress )
        {
          continue;
        }
      ... do some stuff

    }

Obviously this is dissatisfying. 

Why do I get events that I don't want to get?
Is there a better solution?

How do I have to code it when I want to know the position, where the button
 press and release event happened?

Do I have to cache the positions delivered by pointer movement events all
 the time and use the last position befor the button press event happened?

At least this was the way I did it in a test application and it seamed to
work although moving the cursor around in the window ( again I used the X
target ) caused 30 - 40 percent of cpu load on a Pentium 100. Using top
showed that the X server was the one who consumed the cpu resource.


One more question arose yesterday.
I would like to read a rectangular region out of the frame buffer. I
guess that ggiGetBox would help me in what I want to do.

But how should the functions ggiPutBox and ggiGetBox be used in respect of
the buffer that has to be specified?

What size should the buffer have? What type?

What datas are written into this buffer (format)?


gr. matthias

Reply via email to