Author Topic: New GTK3 example for UASM  (Read 146 times)

GoneFishing

  • Member
  • *****
  • Posts: 1030
  • Gone fishing
New GTK3 example for UASM
« on: December 25, 2017, 10:58:37 PM »
Hello all with GTK3 on Linux  :biggrin:

Here's my new GTK3 example. It demonstrates various modal and nonmodal dialogs.

Assemble:
Quote
uasm -elf64 ./dialogs.asm
Link:
Quote
gcc ./dialogs.o -o ./dialogs `pkg-config --libs gtk+-3.0 gthread-2.0 gobject-2.0 gmodule-no-export-2.0`

Try it, please
Feedback is welcome.

NOTES:
- I use "Nimbus Mono L" font for label markup. If you don't have this font just replace it with "Ubuntu".   
-  as per documentation   gtk_image_new_from_file function never returns error . If it doesn't find specified image it just takes   picture "image not found". It doesn't work on my machine - app terminates with SEGFAULT
- notice LOCAL dummy:qword in activate PROC . Looks like the app crashes with SEGFAULT with odd number of LOCALS (one per line)

GoneFishing

  • Member
  • *****
  • Posts: 1030
  • Gone fishing
GTK Basics
« Reply #1 on: December 26, 2017, 04:27:38 AM »
Example-0 is ASM equivalent of official  GTK Basics tutorial .
It's  "... a simple signal-based Gtk application. This program will create an empty 200 × 200 pixel window."



GoneFishing

  • Member
  • *****
  • Posts: 1030
  • Gone fishing
Re: New GTK3 example for UASM
« Reply #2 on: December 26, 2017, 11:13:35 PM »
TO BE FIXED in Dialogs example:

- modal dialogs are growing in size when text view widget is scrolled  right / down

EDIT:  new version attached
Now you can keep track of text buffer char count via console output. I decided leave it as it is . You have full freedom to experiment with SPACE/ENTER/BACKSPACE keyboard buttons !
« Last Edit: December 27, 2017, 03:37:23 AM by GoneFishing »

aw27

  • Member
  • ****
  • Posts: 961
  • Let's Make ASM Great Again!
Re: New GTK3 example for UASM
« Reply #3 on: December 26, 2017, 11:46:26 PM »
I don't think UASM is properly aligning the stack.

This the prologue from this function:
show_nonmodal_clicked  PROC button:GtkButton,   user_data:gpointer
                       LOCAL nonmodal:GtkWidget , vbox:GtkWidget, lbl2:GtkWidget, image:GtkWidget, contentArea:GtkWidget

   0x401d6e <show_nonmodal_clicked>:   push   %rbp
   0x401d6f <show_nonmodal_clicked+1>:   mov    %rsp,%rbp
   0x401d72 <show_nonmodal_clicked+4>:   sub    $0x28,%rsp

 or with Intel syntax:
  0x401d6e <show_nonmodal_clicked>:   push   rbp
   0x401d6f <show_nonmodal_clicked+1>:   mov    rbp,rsp
   0x401d72 <show_nonmodal_clicked+4>:   sub    rsp,0x28

johnsa

  • Member
  • ****
  • Posts: 638
    • Uasm
Re: New GTK3 example for UASM
« Reply #4 on: December 27, 2017, 01:53:43 AM »
I'll get the sample setup and double check the stack alignments, I'm busy working on 2.46.6 update now anyway so if there is a stack alignment issue I will fix it for the  next update. :)

GoneFishing

  • Member
  • *****
  • Posts: 1030
  • Gone fishing
Re: New GTK3 example for UASM
« Reply #5 on: December 27, 2017, 02:02:42 AM »
Fine!
How many empty slots do you have in your Samples folder for GTK examples?

johnsa

  • Member
  • ****
  • Posts: 638
    • Uasm
Re: New GTK3 example for UASM
« Reply #6 on: December 27, 2017, 02:04:31 AM »
As many as you can make? :)

The more samples we have the better, make sure you put plenty of attributions in to yourself and we can add a mention in the documentations about contributors to the samples, I feel aw27 also has some valuable examples lying around that would be useful ;)

GoneFishing

  • Member
  • *****
  • Posts: 1030
  • Gone fishing
Re: New GTK3 example for UASM
« Reply #7 on: December 27, 2017, 02:08:47 AM »
For now I think about one more  custom dialog example with markup and  GTK Builder example.