about summary refs log tree commit diff stats
path: root/src/layout/engine.nim
Commit message (Expand)AuthorAgeFilesLines
* layout: table column size fixesbptato2024-03-161-33/+20
* Move around some modulesbptato2024-03-141-1/+1
* layout: remove word-spacingbptato2024-03-131-4/+1
* rudimentary support for <video>, <audio>bptato2024-03-131-0/+4
* strwidth, renderdocument: small refactoringbptato2024-03-031-5/+8
* layout: add whitespace width to end offset's x positionbptato2024-03-021-0/+4
* layout: fix float exclusion of other floatsbptato2024-03-021-2/+2
* css: remove caption-side: left, right, fix caption-side: bottombptato2024-03-011-16/+1
* layout: reduce useless empty lines in inline boxesbptato2024-02-291-10/+17
* layout: round atom offsets toobptato2024-02-281-10/+10
* layout: improve/simplify line box error correctionbptato2024-02-281-31/+17
* Fix tab size bug on double tabsbptato2024-02-271-4/+4
* term: improve pixels-per-column/line detectionbptato2024-02-251-1/+1
* layout: make it compile attempt 2bptato2024-02-241-2/+2
* layout: make it compilebptato2024-02-241-2/+2
* layout: make position: fixed, sticky act like staticbptato2024-02-241-7/+8
* layout: remove justifybptato2024-02-221-20/+1
* layout: do not apply error correction to first linebptato2024-02-221-5/+4
* layout: only reset charwidth on non-word atomsbptato2024-02-161-1/+1
* layout: avoid wrapping on dash inside double-width linesbptato2024-02-161-0/+4
* layout: skip newlines between full-width charactersbptato2024-02-111-0/+19
* twtstr: misc refactoringsbptato2024-02-091-0/+1
* layout: more consistent namingbptato2024-01-291-79/+41
* layout: consider inline positioning for absolute blocksbptato2024-01-291-16/+11
* Use std/* imports everywherebptato2024-01-071-4/+4
* Various fixesbptato2023-12-131-0/+1
* break up twtstr somewhatbptato2023-12-131-0/+1
* layout: rounding error correction fixesbptato2023-12-111-2/+6
* css: add text-transformbptato2023-12-111-3/+21
* layout: do not resolve floats if grandparent position is resolvedbptato2023-12-101-2/+2
* layout: fix rounding error correctionbptato2023-12-101-11/+8
* layout: rewrite inline box handlingbptato2023-11-271-371/+442
* layout: clamp size constraints to min/max sizes for floatsbptato2023-11-231-7/+12
* layout: add clear, etc.bptato2023-11-231-35/+91
* layout: simplify max width/height calculationbptato2023-11-211-41/+43
* layout: fix some sizing bugsbptato2023-11-211-103/+124
* css: add box-sizingbptato2023-11-211-12/+39
* layout: move charwidth into LineBoxStatebptato2023-11-171-9/+8
* layout: add floatsbptato2023-11-171-218/+555
* layout: refactor flow margin propagation, sizingbptato2023-11-121-508/+610
* layout: refactor block layoutingbptato2023-10-281-151/+165
* layout: refactorbptato2023-10-281-229/+278
* buffer: remove viewport referencebptato2023-10-281-11/+11
* layout/engine: refactor inline atoms etc.bptato2023-10-261-202/+223
* layout/engine: reformatbptato2023-10-261-26/+45
* layout/engine: add table row group/caption to anon tablebptato2023-10-261-0/+2
* reduce new() usagebptato2023-10-251-27/+34
* Remove trailing spacesbptato2023-10-231-1/+1
* WindowAttributes: refactorbptato2023-10-191-1/+1
* layout: move Strut from box -> enginebptato2023-10-141-0/+14
30 31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65



                                                              
                


                   


                     
            
 


                             
                                                             

 
            
 



                                    
 




                                 
    

                               
                   
 


                                     
                           


    
               
 
                                  
 



                                                




                                                             
                                 
                                                                  
                                                                                  

                                          
                        


                
/*
 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
 * See LICENSE file for license details.
 */
#include "dwm.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>

/* static */

static void
bad_malloc(unsigned int size)
{
	eprint("fatal: could not malloc() %u bytes\n", size);
}

/* extern */

void *
emallocz(unsigned int size)
{
	void *res = calloc(1, size);

	if(!res)
		bad_malloc(size);
	return res;
}

void
eprint(const char *errstr, ...)
{
	va_list ap;

	va_start(ap, errstr);
	vfprintf(stderr, errstr, ap);
	va_end(ap);
	exit(EXIT_FAILURE);
}

void
spawn(Arg *arg)
{
	static char *shell = NULL;

	if(!shell && !(shell = getenv("SHELL")))
		shell = "/bin/sh";

	if(!arg->cmd)
		return;
	if(fork() == 0) {
		if(fork() == 0) {
			if(dpy)
				close(ConnectionNumber(dpy));
			setsid();
			execl(shell, shell, "-c", arg->cmd, NULL);
			fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg->cmd);
			perror(" failed");
		}
		exit(0);
	}
	wait(0);
}