Cursor in Framebuffer

Linux specific questions.
nimdays
Posts: 148
Joined: May 29, 2014 22:01
Location: ID

Cursor in Framebuffer

Postby nimdays » Oct 26, 2017 21:11

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
Posts: 7474
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: Cursor in Framebuffer

Postby fxm » Oct 26, 2017 21:27

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

Re: Cursor in Framebuffer

Postby paul doe » Oct 26, 2017 21:37

Hi nimdays,

You may want to have a look at this topic: https://www.freebasic.net/forum/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: 148
Joined: May 29, 2014 22:01
Location: ID

Re: Cursor in Framebuffer

Postby nimdays » Oct 26, 2017 22:20

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: https://www.freebasic.net/forum/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: 7191
Joined: May 28, 2005 3:28

Re: Cursor in Framebuffer

Postby D.J.Peters » Oct 26, 2017 23:34

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: 148
Joined: May 29, 2014 22:01
Location: ID

Re: Cursor in Framebuffer

Postby nimdays » Oct 27, 2017 1:57

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
Posts: 7474
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: Cursor in Framebuffer

Postby fxm » Oct 27, 2017 6:03

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: 7191
Joined: May 28, 2005 3:28

Re: Cursor in Framebuffer

Postby D.J.Peters » Oct 27, 2017 14:51

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: 7191
Joined: May 28, 2005 3:28

Re: Cursor in Framebuffer

Postby D.J.Peters » Oct 27, 2017 18:54

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: 148
Joined: May 29, 2014 22:01
Location: ID

Re: Cursor in Framebuffer

Postby nimdays » Oct 28, 2017 4:28

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

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 1 guest