Linux ignoring several settings from Xojo

I’m having some issues when compiling my app for Linux. Windows and Mac are working as expected. I’m running the latest Xojo IDE (2023) but I was seeing the same issues in 2020. I’m using Ubuntu 22.

  1. My window is a Global Floating Window, but it’s not acting like one. It doesn’t float above everything else and it also has a close button which it shouldn’t. I tried adding this declare I found in the forums, but it didn’t solve the issue.
if TargetLinux then
Soft Declare Sub gtk_window_set_keep_above Lib "libgtk-3.so" (WindowRef As Integer,b as Boolean)

gtk_window_set_keep_above Me.Handle,True

end

  1. I have my window set to Main Screen, which usually has it open somewhat centered. However on Linux it’s opening in the upper left corner. I tired trying to code the window to center with the following, but that had no effect either.
self.Left = (screen(0).Width - self.Width) / 2 
self.top = (screen(0).Height - self.Height) / 2
  1. On Linux, my app is ignoring any code I place into CancelClose.

I get that there are many flavors of Linux, and perhaps Ubuntu 22 is the issue, but does anyone know why this is happening and any workarounds?

Thanks!

Downloaded the most recent version of Mint (Cinnamon) and everything works fine! I did have to use the declare to get the floating window to work. Very impressed with Mint so far.

Your desired window positioning will be ignored if you’re in a Wayland (not x11) desktop environment.

Interesting, since I had both the latest versions of Ubuntu and Mint. Mint is based off of Ubuntu, but works much better, including Window positioning.

Your Ubuntu login screen likely offers the choice of x11 or Wayland.

So, a follow up question. I just now converted my project to API 2. Only a few minor syntax changes where needed. However, my Linux declare for keeping the floating window actually floating now gives me an error I’ve not seen before.

This is the declare that worked fine (on x11) with API 1.

if TargetLinux then
  Soft Declare Sub gtk_window_set_keep_above Lib "libgtk-3.so" (WindowRef As Integer,b as Boolean)
  
  gtk_window_set_keep_above Me.Handle,True
  
end

Now with API 2 I get this error.

MAIN_WINDOW.Opening, line 4
Parameter “WindowRef” expects type Integer, but this is type Ptr.
gtk_window_set_keep_above Me.Handle,True

I haven’t a clue.

Window handles are now Ptr, so change your declare to “WindowRef As Ptr”.

Perfect.

Thank, Tim!