Con-handler window option

Have a question about our Software Developer Kit? Ask them here.
User avatar
gdridi
Posts: 64
Joined: Sat Aug 11, 2012 10:17 am

Con-handler window option

Post by gdridi »

Hello,

Hope you the best.

Can someone try to open a console in an already opened window ?

This is documented in SDK autodocs con-handler file entry.

I m doing :
Newshell WINDOW "CON://///WINDOW 0x502c34ab"

The hex at the end is the address of an (another) already open window.

Is this correct ? I try under AOSFEu0 without success.

- - -

Though, the documentation (in the SDK for con-handler) is clear.

I try and try without success…

Can someone try this feature ?

Regards
DGILLES
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: Con-handler window option

Post by thomasrapp »

I am quite sure I once tried it successfully. At least on OS3.

Try the hex value without 0x in front of it.
Steady
Posts: 25
Joined: Tue Aug 30, 2011 3:23 am
Location: Melbourne, Australia
Contact:

Re: Con-handler window option

Post by Steady »

I just looked at the os3 source and you are right about the window option. It also handles 0x for the parameter so that's not the problem. Maybe you just need to remove the space between WINDOW and your window value, so try WINDOW0x502c34ab

Yes, I know it is not OS4 but backwards compatibility should be retained.
User avatar
gdridi
Posts: 64
Joined: Sat Aug 11, 2012 10:17 am

Re: Con-handler window option

Post by gdridi »

Some tools:

Twin.c:
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/intuition.h>

struct Library *SysBase; /* EXEC library base */
struct ExecIFace *IExec;

struct Library *GraphicsBase;
struct GraphicsIFace *IGraphics;

int main() {
SysBase = *(struct Library **)4;
IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface;

GraphicsBase = IExec->OpenLibrary("graphics.library", 0L);
IGraphics = (struct GraphicsIFace *)
IExec->GetInterface(GraphicsBase, "main", 1, NULL);
struct Window * win = (struct Window *)0x5c05c170;
IGraphics->Move(win->RPort, 100, 100);
IGraphics->Text(win->RPort, "ABC", 3);
}

- - - - - -

Mwin.c:
#include <stdio.h>

#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/intuition.h>

struct Library *SysBase; /* EXEC library base */
struct ExecIFace *IExec;

struct Library *GraphicsBase;
struct GraphicsIFace *IGraphics;

struct Library *IntuitionBase;
struct IntuitionIFace *IIntuition;

int main() {
SysBase = *(struct Library **)4;
IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface;
struct Window * win = NULL;

GraphicsBase = IExec->OpenLibrary("graphics.library", 0L);
IGraphics = (struct GraphicsIFace *)
IExec->GetInterface(GraphicsBase, "main", 1, NULL);

IntuitionBase = IExec->OpenLibrary("intuition.library", 0L);
IIntuition = (struct IntuitionIFace *)
IExec->GetInterface(IntuitionBase, "main", 1, NULL);

win = IIntuition->OpenWindowTags(NULL,
// WA_PubScreen, my_screen,
// WA_RMBTrap, TRUE,
// WA_NoCareRefresh, TRUE, Mettre SMART_REFRESH avec pour éviter un bug avec la < 40.1
WA_Flags, /*WFLG_BACKDROP|WFLG_BORDERLESS|*/WFLG_ACTIVATE, // virer borderless pour regler la position de la fenetre
// WA_IDCMP, IDCMP_VANILLAKEY|IDCMP_RAWKEY,
WA_Top, 100,
// WA_Left, 0,
WA_Height, 200,
// WA_Width, 3 * my_tf->tf_XSize,
// WA_Width, 19 * my_tf->tf_XSize,
//WA_CustomScreen, my_screen,
TAG_END);


printf("%lx\n", (long)win);
// struct Window * win = (struct Window *)0x5c05c170;
// IGraphics->Move(win->RPort, 100, 100);
// IGraphics->Text(win->RPort, "ABC", 3);
}

- - -
Regards
DGILLES
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: Con-handler window option

Post by thomasrapp »

You are right, it does not work on OS4.

The following code works on OS3. On OS4 apparently the WINDOW part is completely ignored and it opens a new window on the Workbench screen.

Code: Select all

/* Open a shell on a custom screen */


#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>

#include <stdio.h>


int main (void)

{
struct Screen *scr;

if ((scr = OpenScreenTags (NULL,
		SA_LikeWorkbench,TRUE,
		TAG_END)))
	{
	struct Window *win;

	if ((win = OpenWindowTags (NULL,
			WA_CustomScreen,scr,
			WA_Flags, WFLG_ACTIVATE | WFLG_BORDERLESS | WFLG_NOCAREREFRESH,
			TAG_END)))
		{
		char conname[50];
		BPTR con;

		sprintf (conname,"CON://///WINDOW %lx",win);

		if ((con = Open (conname,MODE_READWRITE)))
			{
			Execute ("",con,(BPTR)0);
			Close (con);
			}

		if (scr->FirstWindow == win)
			CloseWindow (win);
		}

	CloseScreen (scr);
	}

return (RETURN_OK);
}
User avatar
gdridi
Posts: 64
Joined: Sat Aug 11, 2012 10:17 am

Re: Con-handler window option

Post by gdridi »

thomasrapp wrote: Fri Aug 27, 2021 5:03 pm You are right, it does not work on OS4.

The following code works on OS3. On OS4 apparently the WINDOW part is completely ignored and it opens a new window on the Workbench screen.

Code: Select all

/* Open a shell on a custom screen */


#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>

#include <stdio.h>


int main (void)

{
struct Screen *scr;

if ((scr = OpenScreenTags (NULL,
		SA_LikeWorkbench,TRUE,
		TAG_END)))
	{
	struct Window *win;

	if ((win = OpenWindowTags (NULL,
			WA_CustomScreen,scr,
			WA_Flags, WFLG_ACTIVATE | WFLG_BORDERLESS | WFLG_NOCAREREFRESH,
			TAG_END)))
		{
		char conname[50];
		BPTR con;

		sprintf (conname,"CON://///WINDOW %lx",win);

		if ((con = Open (conname,MODE_READWRITE)))
			{
			Execute ("",con,(BPTR)0);
			Close (con);
			}

		if (scr->FirstWindow == win)
			CloseWindow (win);
		}

	CloseScreen (scr);
	}

return (RETURN_OK);
}
Great,
No interface -> reference: what are your C compilation and linking lines ?

We are two on this (open) ticket !
Because if you search for a window you have to look for the right screen where it is opened and exists. So is the Screen option might be give all along with the window option ?

Nice

Best wishes,
From DGILLES
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Con-handler window option

Post by tonyw »

Sorry, gdridi,

I only just found the PMs waiting for me (I haven't logged on for ages).

Try the option "Legacy". That should force the con-handler to use the given window address. The "0x" is optional.

[The console (device driver) uses the window specification passed to it by the con-handler. The console device will open a window with a menu, scrollbar, etc, unless you specify the "Legacy" option in the window specification.]

I can't remember the history of the window open options (it was many years ago now). Perhaps the documentation is out of date. I'll take a look and see what has changed or been left out, or whatever...
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Con-handler window option

Post by tonyw »

OK, some reading shows that the "Legacy" option was added (to the con-handler) in 2012 and documented in "con-handler.doc", which is not in the SDK.

You will find it in SYS:Documentation/con-handler.doc. That is the latest, the SDK Autodocs/ only has the console.device documentation. I'll fix that for the next SDK release.

If you don't have the con-handler.doc file from the OS4 Documentation directory, I can provide it.
cheers
tony
User avatar
gdridi
Posts: 64
Joined: Sat Aug 11, 2012 10:17 am

Re: Con-handler window option

Post by gdridi »

tonyw wrote: Sun Aug 29, 2021 11:27 am OK, some reading shows that the "Legacy" option was added (to the con-handler) in 2012 and documented in "con-handler.doc", which is not in the SDK.

You will find it in SYS:Documentation/[KICKSTART]/con-handler.doc. That is the latest, the SDK Autodocs/ only has the console.device documentation. I'll fix that for the next SDK release.

If you don't have the con-handler.doc file from the OS4 Documentation directory, I can provide it.
No file uptodate With AOS4.1FEu0

Would like you to provide the doc, thank you.

DGILLES
User avatar
gdridi
Posts: 64
Joined: Sat Aug 11, 2012 10:17 am

Re: Con-handler window option

Post by gdridi »

Hello,

Try :

Code: Select all

Newshell window con://///legacy/window0xaabbccdd
The cursor appears in the window which address is 0xaabbccdd but no more /-(

Can someone test ? I think I have to try the Thomas above solution…

DG
Post Reply