The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: GoneFishing on December 25, 2017, 10:58:37 PM

Title: New GTK3 example for UASM
Post by: GoneFishing 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:
Quoteuasm -elf64 ./dialogs.asm
Link:
Quotegcc ./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)
Title: GTK Basics
Post by: GoneFishing on December 26, 2017, 04:27:38 AM
Example-0 is ASM equivalent of official  GTK Basics tutorial (https://developer.gnome.org/gtk3/stable/gtk-getting-started.html#id-1.2.3.5) .
It's  "... a simple signal-based Gtk application. This program will create an empty 200 × 200 pixel window."


Title: Re: New GTK3 example for UASM
Post by: GoneFishing 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 !
Title: Re: New GTK3 example for UASM
Post by: aw27 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
Title: Re: New GTK3 example for UASM
Post by: johnsa 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. :)
Title: Re: New GTK3 example for UASM
Post by: GoneFishing on December 27, 2017, 02:02:42 AM
Fine!
How many empty slots do you have in your Samples folder for GTK examples?
Title: Re: New GTK3 example for UASM
Post by: johnsa 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 ;)
Title: Re: New GTK3 example for UASM
Post by: GoneFishing on December 27, 2017, 02:08:47 AM
For now I think about one more  custom dialog example with markup and  GTK Builder example.