Cursor in Framebuffer

Linux specific questions.
Post Reply
nimdays
Posts: 236
Joined: May 29, 2014 22:01
Location: West Java, Indonesia

Cursor in Framebuffer

Post by nimdays »

I don't see the cursor in framebuffer, how to enable that if possible?

Code: Select all

screenres 800,600,32
dim as integer x,y,b
do
   getmouse(x,y,,b)
   screenlock
   cls
   circle(x,y),4,&hffff00
   line (10,10)-(100,100),,B
   screenunlock
   sleep(16,1)
loop until multikey (&h01)  

end
Thanks.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Cursor in Framebuffer

Post by fxm »

Are you talking about the text cursor?
The text cursor is never visible in graphics mode (only in console mode).
paul doe
Moderator
Posts: 1733
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Cursor in Framebuffer

Post by paul doe »

Hi nimdays,

You may want to have a look at this topic: viewtopic.php?f=7&t=26018. Some other member has had the same inquiry, and a solution was implemented. See if it helps.

Regards,
Paul
nimdays
Posts: 236
Joined: May 29, 2014 22:01
Location: West Java, Indonesia

Re: Cursor in Framebuffer

Post by nimdays »

fxm wrote:Are you talking about the text cursor?
The text cursor is never visible in graphics mode (only in console mode).
I'm sorry, I mean the circle should be visible and follow the mouse.
I tried that from the console, and only the rect was there.
Do you think that the problem?
paul doe wrote:Hi nimdays,

You may want to have a look at this topic: viewtopic.php?f=7&t=26018. Some other member has had the same inquiry, and a solution was implemented. See if it helps.

Regards,
Paul
Thanks, I'll take a look.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Cursor in Framebuffer

Post by D.J.Peters »

Code: Select all

screenres 800,600,32
dim as integer mx,my,mb
dim as integer x,y
do
   if getmouse(mx,my,,mb)=0 then
     x=mx : y=my
   end if  
   screenlock
     cls
     circle(x,y),4,&hffff00
   screenunlock
   sleep(16,1)
loop until multikey (&h01) 
nimdays
Posts: 236
Joined: May 29, 2014 22:01
Location: West Java, Indonesia

Re: Cursor in Framebuffer

Post by nimdays »

D.J.Peters wrote:

Code: Select all

screenres 800,600,32
dim as integer mx,my,mb
dim as integer x,y
do
   if getmouse(mx,my,,mb)=0 then
     x=mx : y=my
   end if  
   screenlock
     cls
     circle(x,y),4,&hffff00
   screenunlock
   sleep(16,1)
loop until multikey (&h01) 
It doesn't work without X
I saw this gfx_driver_fbdev.c from the source.
I don't know.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Cursor in Framebuffer

Post by fxm »

For all the programs above, the circle following the movement of the mouse pointer is clearly visible.
I do not see where is your problem?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Cursor in Framebuffer

Post by D.J.Peters »

In the past if your linux boot and primary the kernel drivers switched to the frame buffer mode
you could run FBGFX stuff (screen, screenres ...) without a X-server desktop running.

In this case FBGFX used the frame buffer gfx driver.
(implemented in "gfx_driver_fbdev.c")

First time I saw it I was thinking "what gfx in textmode" but the frame buffer devices
looks at boot time as a text mode but it isn't.

May be this nice feature are disabled in current versions of FB or not compatible with your frame buffer setup ?

You can use all or the most FreeBVASIC amd FBGFX commands as function to get an error code.

var error = screen(...) or screenres(...)
if error then
print "error: can't switch to gfx mode !"
beep : sleep : end 1
end if

from here you can use line, circle ...

Joshy
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Cursor in Framebuffer

Post by D.J.Peters »

Tested on Slackware 32 and 64-bit and It works.
The key are you must use the same bit depth as the frame buffer device !
(you can use screeninfo to get the bit depth of your frame buffer)

Joshy

Code: Select all

dim as integer mx,my,mb
dim as integer x,y
dim as integer w,h,b

screeninfo w,h,b
var ret = screenres(w,h,b)
if ret then
  print "error: can't set mode: " & w & " x " & h & " " & b 
  beep : sleep : end 1
end if

do
  if getmouse(mx,my,,mb)=0 then
    x=mx : y=my
  end if  
  screenlock
    cls
    circle(x,y),4,&hffff00
  screenunlock
  sleep(16,1)
loop until multikey (&h01) 
nimdays
Posts: 236
Joined: May 29, 2014 22:01
Location: West Java, Indonesia

Re: Cursor in Framebuffer

Post by nimdays »

D.J.Peters wrote:Tested on Slackware 32 and 64-bit and It works.
The key are you must use the same bit depth as the frame buffer device !
(you can use screeninfo to get the bit depth of your frame buffer)

Joshy

Code: Select all

dim as integer mx,my,mb
dim as integer x,y
dim as integer w,h,b

screeninfo w,h,b
var ret = screenres(w,h,b)
if ret then
  print "error: can't set mode: " & w & " x " & h & " " & b 
  beep : sleep : end 1
end if

do
  if getmouse(mx,my,,mb)=0 then
    x=mx : y=my
  end if  
  screenlock
    cls
    circle(x,y),4,&hffff00
  screenunlock
  sleep(16,1)
loop until multikey (&h01) 
Thanks a bunch Man, It works :)
The real cursor is white,not black like my X
And root access is required.

Btw, This is my grub menu

Code: Select all

title Tiny Core 8
kernel /boot/vmlinuz vga=792 tce=sda1
initrd /boot/tiny.gz
Post Reply