Jump to content

UAK menu items not showing up in linux


mekans
 Share

Go to solution Solved by mekans,

Recommended Posts

sure, i don't have got my KDE desktop (traveling a lot lately) but on my i3 is disapearing (i saw a glimpse of menu that disapeared) while clicking button:
https://drive.google.com/file/d/1AiE0DdFlrYV91mjQsMEOB-EQTWt-oiTt/view

KDE though i can't show you right now but there's a visualisation (when i ll be back home i am going to show screenshot of that)

 

Untitled.png

Link to comment
Share on other sites

It was tested on Ubuntu but it's just using the X windowing system and they should all work the same.

What C++ IDE are you using? It looks interesting.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

It's CLion by jetbrains
in terms of the application - going to check on ubuntu - gnome (KDE debian works like visualisation on the image).
I don't have got access to ultra engine but if in ultra engine it will work properly i ll consider buying that

Link to comment
Share on other sites

I am wondering, mby it's fault of the libraries i set in the cmake

 

set(FLAGS -I/usr/include/freetype2 -I/usr/include/fontconfig -D_ULTRA_APPKIT -I${ULTRAENGINEPATH}/Include)
set(LFLAGS -no-pie -lX11 -lpthread -lXft -lXext -lXrender -lXcursor -ldl)

 

i've installed newest versions of the packages:  libxft-dev libxrender-dev libxcursor-dev libxmu-dev, going to check if i can include something more from UAK packages, and if i can i ll send the results of that

Link to comment
Share on other sites

I doubt it. The window positioning is very basic stuff in the X library.

You can try compiling the make file in VSCode if you want to be sure, but I doubt it will make a difference.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Solution

I Guess it's a real problem with UAK in terms of some widgets, Ultra Engine should be tested on Linux distros X11/Wayland on most popular window managers like i3 bspwm and on GNOME/KDE/XFCE and others.
If i find problems like that, i am going to report that in the future.

for now i created poor version of custom menu

#include "UltraEngine.h"

using namespace UltraEngine;

//Declare new style constants
enum CustomMenuStyle
{
    CUSTOM_MENU_DEFAULT = 0
};

//Declare new widget class
class CustomMenuWidget : public Widget
{
    //Custom members
    bool hover;
    shared_ptr<Panel> contextMenu;
    shared_ptr<Widget> editButton;
    shared_ptr<Widget> removeButton;

protected:

    virtual bool Initialize(const WString& text, const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, const int style)
    {
        bool isInit = Widget::Initialize(text, x, y, width, height, parent, 0);
        contextMenu = CreatePanel(x, y+25, 100, 40, gui->root);
        contextMenu->Hide();
        editButton = CreateButton("Edit", 0, 0, 100, 20, contextMenu, BUTTON_TOOLBAR);//just for an example, no function
        removeButton = CreateButton("Remove", 0, 20, 100, 20, contextMenu, BUTTON_TOOLBAR);
        ListenEvent(EVENT_WIDGETACTION, editButton, EditbuttonCallback, Self()->As<CustomMenuWidget>());
        ListenEvent(EVENT_WIDGETACTION, removeButton, RemoveButtonCallback, Self()->As<CustomMenuWidget>());

        return isInit;
    }
    static bool EditbuttonCallback(const Event& ev, shared_ptr<Object> extra)
    {
        auto listView = extra->As<CustomMenuWidget>();
        listView->contextMenu->Hide();
        Print("edit button run");
        return true;
    }

    static bool RemoveButtonCallback(const Event& ev, shared_ptr<Object> extra)
    {
        auto listView = extra->As<CustomMenuWidget>();
        listView->contextMenu->Hide();
        Print("remove button run");
        return true;
    }
    //Called when the mouse moves if this widget has the focus
    virtual void MouseMove(const int x, const int y) {}

    //Called when the mouse cursor enters the widget bounds
    virtual void MouseEnter(const int x, const int y)
    {
        hover = true;
        Redraw();
    }

    //Called when the mouse cursor leaves the widget bounds
    virtual void MouseLeave(const int x, const int y)
    {
        hover = false;
        Redraw();
    }


    //Called when the mouse button is pressed
    virtual void MouseDown(const MouseButton button, const int x, const int y)
    {

        if (button == MOUSE_LEFT)
        {
            if(contextMenu->hidestate) {
                contextMenu->Show();

            }
            else {
                contextMenu->Hide();

            }
        }
    }

    //Called when the mouse button is released
    virtual void MouseUp(const MouseButton button, const int x, const int y) {}

    //Called when another widget becomes selected
    virtual void LoseFocus() {}

    //Called when mouse double-click occurs
    virtual void DoubleClick(const MouseButton button, const int x, const int y) {}

    //Called when mouse triple-click occurs
    virtual void TripleClick(const MouseButton button, const int x, const int y) {}

    //Called when widget is selected
    virtual void GainFocus() {}

    //Called when key is pressed
    virtual void KeyDown(const UltraEngine::KeyCode key) {}

    //Called when key is released
    virtual void KeyUp(const UltraEngine::KeyCode key) {}

    //Called for each keydown event
    virtual void KeyChar(const int keychar) {}

    //Called when mouse wheel turns and mouse is hovered over this widget
    virtual void MouseWheel(const int delta, const int x, const int y) {}

    //Called each time the widget is redrawn
    virtual void Draw(const int x, const int y, const int width, const int height)
    {
        blocks.clear();
        Vec4 color = Vec4(0.255f, 0.10f, 0.10f, 1);
        if (hover) color = Vec4(0.255f, 0.255f, 0.255f, 1);

        //Background rectangle
        AddBlock(iVec2(0), this->size, color);

        //Foreground text
        AddBlock(text, iVec2(0), this->size, Vec4(1), TEXT_CENTER | TEXT_MIDDLE);
    }
public:

    //Constructor
    CustomMenuWidget() : hover(false)
    {}

    friend shared_ptr<Widget> CreateCustomMenuWidget(const WString&, const int, const int, const int, const int, shared_ptr<Widget>, const CustomMenuStyle);
};

//Create function
shared_ptr<Widget> CreateCustomMenuWidget(const WString& text, const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, const CustomMenuStyle style)
{
    auto widget = std::make_shared<CustomMenuWidget>();
    widget->Initialize(text, x, y, width, height, parent, style);
    return widget;
}

 

Thank you @Josh and @Dreikblack for supporting me before, i know my posts were annoying but i finally understand how widgets are created.

2023-07-02_13-23-48.png

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...