Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Running ControlExample example programfailsunderHP-UX

 
Steve,

Oops! sorry for the delay. Please, refer to the
C code below. Actually, both the code sent by
you and the code listed below works.

#include <stdio.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>

main (int argc, char **argv)
{
    Widget shellHandle;
    Display *xDisplay;
    XtAppContext xtContext;
    XEvent xEvent;
    Window xWindow;
    GC xGC;
    XPoint *ppts;
    short xPoints[] = {10, 10, 100, 100, 100, 10};

    XtToolkitInitialize();
    xtContext = XtCreateApplicationContext();
    xDisplay = XtOpenDisplay(xtContext, NULL, NULL, NULL,
        0, 0, &argc, 0);
 

    /* Initialize the Toolkit */
    shellHandle = XtAppCreateShell(NULL, NULL,
       topLevelShellWidgetClass,
       xDisplay, NULL, 0);
 
    XtResizeWidget(shellHandle, 200, 200, 0);
    XtRealizeWidget (shellHandle);
 
    /* Check and dispatch events forever */
    while (True)
      {
 XtAppNextEvent(xtContext, &xEvent);
 XtDispatchEvent(&xEvent);
 
 switch (xEvent.type)
   {
   case Expose:
     {
       xWindow = XtWindow(shellHandle);
 
       if (xWindow != NULL)
  {
    xGC = XCreateGC(xDisplay, xWindow, 0, NULL);
    XFillPolygon(xDisplay, xWindow, xGC, (XPoint *)xPoints, 3, 0, 0);
    XFreeGC(xDisplay, xGC);
  }
     }
   default:
     break;
   }
      }
}

-Sri

Steve_Northover@xxxxxxx wrote:

 
So, you need to translate the Java code to C and see if this works.
Please post the C code when you are done.  Thanks.

Steve
 
 
 

Mike_Wilson@xxxxxxx
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

03/01/02 11:23 AM
Please respond to platform-swt-dev


        To:        platform-swt-dev@xxxxxxxxxxx
        cc: 
        Subject:        Re: [platform-swt-dev] Running ControlExample example program   failsunderHP-UX

 

Well, if this code fails, but the equivalent C version works, then the problem is some bad interaction with HP-UX in the implementations of those particular OS.xxx methods. This ought to be reasonably easy to find by inspecting their implementations. That's why it makes sense to run the low level version.

If however, the matching C code version fails, then you have a bug in the HP-UX Xt library which you have to either workaround or get fixed with HP's help.

McQ.
 
 

Sridhar Bidigalu <sridhar@xxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx 

03/01/2002 10:46 AM 
Please respond to platform-swt-dev 


       To:        platform-swt-dev@xxxxxxxxxxx 
       cc: 
       Subject:        Re: [platform-swt-dev] Running ControlExample example program   failsunderHP-UX

 
 

Steve,

I sent a email on this yesterday, probably it did not go thru., since
I sent it from my home email account.

Same behavior, no changes, shell pops up without polygon get drawn.

-Sri
 

Steve_Northover@xxxxxxx wrote:

Does this code work on HPUX?

Steve
public static void main (String [] args) {
      OS.XtToolkitInitialize ();
     int [] argc = new int [] {0};
     final int xtContext = OS.XtCreateApplicationContext ();
     int xDisplay = OS.XtOpenDisplay (xtContext, null, null, null, 0, 0, argc, 0);
     int widgetClass = OS.TopLevelShellWidgetClass ();
     int shellHandle = OS.XtAppCreateShell (null, null, widgetClass, xDisplay, null, 0);
      OS.XtResizeWidget (shellHandle, 200, 200, 0);
      OS.XtRealizeWidget (shellHandle);
     short [] xPoints = {10, 10, 100, 100, 100, 10};
      XAnyEvent xEvent = new XAnyEvent ();
     while (true) {
              OS.XtAppNextEvent (xtContext, xEvent);
              OS.XtDispatchEvent (xEvent);
            //Bogus to do this really ...
              if (xEvent.type == OS.Expose) {
                    int xWindow = OS.XtWindow (shellHandle);
                    if (xWindow != 0) {
                            int xGC = OS.XCreateGC (xDisplay, xWindow, 0, null);
                              OS.XFillPolygon(xDisplay, xWindow, xGC, xPoints, xPoints.length / 2, OS.Complex, OS.CoordModeOrigin);
                              OS.XFreeGC (xDisplay, xGC);
                      }
              }
      }
}
 
 
 

Boris_Shingarov@xxxxxxx 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx 

02/28/02 01:58 PM 
Please respond to platform-swt-dev 


      To:        platform-swt-dev@xxxxxxxxxxx 
      cc: 
      Subject:        Re: [platform-swt-dev] Running ControlExample example program  failsunderHP-UX

 
 
 

Sridhar,

This means we need to proceed with an OS.* calls test.
Steve:  you have a pile of those in your image, could you share one?
P.S.: Drawing to Canvas vs. Shell should make no difference, as Shells are Canvases.
 
 

Sridhar Bidigalu <sridhar@xxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx 

02/28/2002 01:29 PM 
Please respond to platform-swt-dev 


     To:        platform-swt-dev@xxxxxxxxxxx 
     cc: 
     Subject:        Re: [platform-swt-dev] Running ControlExample example program  failsunderHP-UX

 
 
 
 
 

Grant,

I modified the sample examples you sent with ...

e.gc.drawPolyline(points);

and it draws the polyline.  Looks like fillPolygon fails to draw.
Same behavior on the canvas too. But, it does not hang as it use
to, running the "controlexample" or the "eclipse" itself using the
fillPolygon, shell popsup without fillPolygon.

-Sri

Grant_Gayed@xxxxxxx wrote:

> Sridhar,
>
> Can you try the following shorter example and let us know if it hangs:
>
> import org.eclipse.swt.events.*;
> import org.eclipse.swt.graphics.*;
> import org.eclipse.swt.widgets.*;
>
> public class TestFillPolygon {
>       public static void main (String[] args) {
>             final int[] points = new int[] {771,6,771,16,766,11};
>             final Display display = new Display ();
>             Shell shell = new Shell (display);
>             shell.setBounds (10, 10, 800, 90);
>             shell.addPaintListener(new PaintListener () {
>                   public void paintControl (PaintEvent e) {
>                         Color colour = new Color(display,new
> RGB(222,233,244));
>                         e.gc.setBackground(colour);
>                         colour.dispose();
>                         e.gc.fillPolygon(points);
>                   }
>             });
>             shell.open ();
>             while (!shell.isDisposed ()) {
>                   if (!display.readAndDispatch ()) display.sleep ();
>             }
>             display.dispose ();
>       }
> }
>
> Grant
>
> Mike,
>
> Thanks for the response. Yes, the arguments look reasonable enough and I
> have already gone
> thru. listing out the <xy> points, the drawable, display and the GC with
> their respective style
> and mode, which is the default(Complex & CoordModeOrigin). Also, tried with
> the different
> combinations of shape and mode arguments, no change. Created a simple
> example C program,
> which contains the same points as the one in the controlexample program,
> and the XFillPolygon
> works fine. I have attached the controlexample log file where it list out
> the debug info. of the
> JNI code before hanging in XFillPolygon. And also, note that, by replacing
> it with XDrawLines
> draws the lines on the arrow button of the Tab widget and runs the
> controlexample pgm just
> fine.
>
> I will go thru. more thoroughly on the HP documentation for any hints or
> specifics for the above
> problem to occur.
>
> Thanks
> -Sri
>
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
 
 
 


Back to the top